### Installation and Dependencies Source: https://context7.com/tjunttila/pdf2video/llms.txt Provides instructions for installing pdf2video using pip, including recommended virtual environment setup. It also details system dependency installation for Ubuntu/Debian and macOS, and AWS CLI configuration for Polly. ```bash # Install from GitHub using pip python3 -m pip install git+https://github.com/tjunttila/pdf2video.git # Install in a virtual environment (recommended) python3 -m venv pdf2video-env source pdf2video-env/bin/activate pip install git+https://github.com/tjunttila/pdf2video.git # Ubuntu/Debian: Install system dependencies sudo apt-get update sudo apt-get install poppler-utils ffmpeg # macOS: Install system dependencies with Homebrew brew install poppler ffmpeg # Configure AWS CLI with Polly-enabled profile aws configure --profile pdf2video-profile # Enter AWS Access Key ID, Secret Access Key, and region # Choose a region supporting neural voices: # us-east-1, us-west-2, eu-west-1, eu-central-1, ap-southeast-1, etc. # Test AWS Polly access aws polly describe-voices --profile pdf2video-profile --engine neural # Verify installation pdf2video --help # Run example from repository git clone https://github.com/tjunttila/pdf2video.git cd pdf2video pdf2video sample.pdf sample.txt \ --pages "1,2,4-6" \ --voice Matthew \ --neural \ --conversational \ sample_output.mp4 ``` -------------------------------- ### Install pdf2video using pip Source: https://github.com/tjunttila/pdf2video/blob/master/README.md Installs the pdf2video package directly from GitHub using pip. It is recommended to use Python 3.6 or later and a virtual environment for package management. ```bash python3 -m pip install git+https://github.com/tjunttila/pdf2video.git ``` -------------------------------- ### pdf2video Advanced Command-Line Options Source: https://context7.com/tjunttila/pdf2video/llms.txt Illustrates advanced command-line features for pdf2video, including subtitle control, custom temporary file prefixes, quiet mode, specifying external tool paths, and a comprehensive example with multiple options. Also shows how to view help. ```bash # Disable subtitles (smaller file size, no caption support) pdf2video slides.pdf script.txt video.mp4 \ --ignore_subtitles \ --voice Emma \ --neural # Custom temporary file prefix pdf2video presentation.pdf script.txt output.mp4 \ --temp_prefix /tmp/my-video-temp \ --voice Matthew \ --neural # Quiet mode (suppress progress information) pdf2video slides.pdf script.txt video.mp4 \ --quiet \ --voice Joanna \ --neural # Specify custom tool paths pdf2video slides.pdf script.txt video.mp4 \ --ffmpeg /usr/local/bin/ffmpeg \ --pdfinfo /opt/poppler/bin/pdfinfo \ --pdftoppm /opt/poppler/bin/pdftoppm # Full example with all options pdf2video lecture.pdf lecture.txt lecture_final.mp4 \ --voice Matthew \ --neural \ --conversational \ --pages "1,3-10,15" \ --only "intro,main_content_1-5,conclusion" \ --aws_profile my-aws \ --audio_cache ~/.pdf2video-cache \ --temp_prefix /tmp/pdf2video-work \ --ffmpeg /usr/bin/ffmpeg \ --pdfinfo /usr/bin/pdfinfo \ --pdftoppm /usr/bin/pdftoppm # View all available options pdf2video --help ``` -------------------------------- ### pdf2video Script File Formatting Source: https://github.com/tjunttila/pdf2video/blob/master/README.md Demonstrates the formatting for the script file used by pdf2video. Lines starting with '#' denote page markers, '%' indicate comments, and special syntax is used for text emphasis, spelling, pitch/rate adjustments, pauses, phonetic pronunciation, and subtitle overrides. ```text #page [name] // Following text is the script for the current page. % This is a comment and will be ignored. *emphasized text* @s.p.e.l.l.e.d. text@ #slow/text/ #high/text/ #low/text/ #n (where n is a positive integer for pause duration) #ph/word/pronunciation/ #sub/text/subtitle/ ``` -------------------------------- ### pdf2video Nested Modifier Example Source: https://github.com/tjunttila/pdf2video/blob/master/README.md Illustrates the use of nested modifiers in the pdf2video script file. This example shows how to combine a subtitle override with phonetic pronunciation for complex character representations. ```text #sub/big-#ph!Theta!Ti:.t@! of n/Θ(n)/ ``` -------------------------------- ### Basic pdf2video Command-Line Usage Source: https://context7.com/tjunttila/pdf2video/llms.txt Demonstrates fundamental command-line arguments for converting PDF slides and script text into video using different voice options. It showcases standard and neural voices, as well as conversational styles. ```bash pdf2video slides.pdf script.txt video1.mp4 --voice Joanna pdf2video slides.pdf script.txt video2.mp4 --voice Matthew pdf2video slides.pdf script.txt video3.mp4 --voice Brian pdf2video slides.pdf script.txt video4.mp4 --voice Joanna --neural pdf2video slides.pdf script.txt video5.mp4 --voice Matthew --neural pdf2video slides.pdf script.txt video6.mp4 --voice Amy --neural pdf2video slides.pdf script.txt video7.mp4 \ --voice Joanna \ --conversational pdf2video slides.pdf script.txt video8.mp4 \ --voice Matthew \ --conversational pdf2video slides.pdf script.txt video9.mp4 \ --voice Lupe \ --conversational ``` -------------------------------- ### Python API: Programmatic Execution Source: https://context7.com/tjunttila/pdf2video/llms.txt Demonstrates how to use the main function of the pdf2video Python library programmatically. This involves setting command-line arguments via `sys.argv` before calling the `main()` function. ```python import sys from pdf2video.pdf2video import main # Set command-line arguments programmatically sys.argv = [ 'pdf2video', 'presentation.pdf', 'script.txt', 'output.mp4', '--voice', 'Matthew', '--neural', '--pages', '1-5', '--audio_cache', './cache' ] # Run the main function main() ``` -------------------------------- ### Python API: Parsing Script Text Source: https://context7.com/tjunttila/pdf2video/llms.txt Shows how to use the pdf2video Python API to parse script text into an Abstract Syntax Tree (AST). Demonstrates converting AST nodes to SSML, word lists, and subtitles, including options for neural voices. ```python #!/usr/bin/env python3 from pdf2video.parser import parse_to_ast, parse # Parse script text to Abstract Syntax Tree line = "Welcome to *emphasized* text with #10 pause and @spelling@." ast_nodes = parse_to_ast(line, err_linenum=1) # Each AST node has methods: to_ssml(), to_words(), to_sub() for node in ast_nodes: ssml_output = node.to_ssml(neural=True) words = node.to_words() subtitle = node.to_sub() print(f"SSML: {ssml_output}") print(f"Words: {words}") print(f"Subtitle: {subtitle}") # Parse complete line with neural voice line = "The #sub/big-O/O(n)/ complexity is #high/important/." (ssml, words, subtitle) = parse(line, neural=True) print("SSML output:") print(ssml) # Output: "The O(n) complexity is important." print("Word list:") print(words) # Output: ['The', 'O(n)', 'complexity', 'is', 'important'] print("Subtitle text:") print(subtitle) # Output: "The O(n) complexity is important." ``` -------------------------------- ### Basic Video Generation with pdf2video Source: https://context7.com/tjunttila/pdf2video/llms.txt Generates a narrated video from a PDF presentation and a text script using default or specified Amazon Polly voices and styles. Options include selecting neural voices, conversational style, and using custom AWS profiles or cache directories. ```bash # Simple conversion with default voice (Joanna) pdf2video presentation.pdf script.txt output.mp4 # Using neural voice with conversational style pdf2video lecture.pdf lecture_script.txt lecture_video.mp4 \ --voice Matthew \ --neural \ --conversational # Select specific pages (pages 1, 2, and 4-6 from PDF) pdf2video slides.pdf slides_script.txt video.mp4 \ --pages "1,2,4-6" \ --voice Emma \ --neural # Use custom AWS profile and cache directory pdf2video demo.pdf demo_script.txt demo.mp4 \ --aws_profile my-aws-profile \ --audio_cache ./audio-cache \ --voice Joey \ --neural ``` -------------------------------- ### Selective Page Compilation with pdf2video Source: https://context7.com/tjunttila/pdf2video/llms.txt Compiles only specific script pages during video generation using page names or numbers. This allows for targeted development and testing of specific sections of the presentation. Supports numeric ranges, named pages, and combinations thereof. ```bash # Compile only the page named "intro" pdf2video presentation.pdf script.txt test.mp4 \ --only "intro" \ --voice Matthew \ --neural # Compile pages 1, 3, and the page named "conclusion" pdf2video slides.pdf script.txt video.mp4 \ --only "1,3,conclusion" # Compile a range of named pages (examples_1 through examples_5) pdf2video demo.pdf demo_script.txt demo.mp4 \ --only "examples_1-5" # Combine numeric ranges and names pdf2video lecture.pdf lecture.txt lecture.mp4 \ --only "1-3,advanced_topic,summary" \ --voice Joanna \ --neural # Script file with named pages # File: development_script.txt #page section_a Content for section A. #page section_b Content for section B. #page conclusion Final remarks. ``` -------------------------------- ### Advanced pdf2video command-line usage Source: https://github.com/tjunttila/pdf2video/blob/master/README.md Converts a PDF file and a text script into a video, specifying pages, voice, and enabling neural and conversational speech. Generates MP4 video and separate WebVTT subtitles. ```bash pdf2video sample.pdf sample.txt --pages "1,2,4-6" --voice Matthew --neural --conversational sample.mp4 ``` -------------------------------- ### Basic pdf2video command-line usage Source: https://github.com/tjunttila/pdf2video/blob/master/README.md Converts a PDF file and a text script into a video file with default narration and subtitles. The script file is UTF-8 encoded. ```bash pdf2video presentation.pdf script.txt video.mp4 ``` -------------------------------- ### Script Text Modifiers for Narration Styling Source: https://context7.com/tjunttila/pdf2video/llms.txt Demonstrates various text modifiers within script files to control emphasis, spelling pronunciation, pauses, pitch, speed, and subtitle display. Modifiers can be nested for complex styling. ```text # File: modifiers_demo.txt #page emphasis Use *asterisks* for emphasized text with louder volume. This makes *important* words stand out in narration. #page spelling Spell abbreviations: @HTML@, @CSS@, @API@, @URL@. Characters are read individually: @xyz@ becomes "x y z". #page pauses Short pause#5 continues quickly. Medium pause#10 gives breathing room. Long pause#20 creates dramatic effect. #page pitch_control #high/This sentence has higher pitch./ #low/This sentence has lower pitch./ Normal pitch continues here. #page speed_control #slow/This text is read more slowly for emphasis./ Regular speed text follows naturally. #page pronunciation Mathematical symbols need special handling: The #ph/theta/Ti:.t@/ function is pronounced "theta". Use #ph/Fibonacci/fI.b@"nA.tSi/ for non-standard pronunciation. #page subtitle_override The expression #sub/big-O of n squared/O(n²)/ shows differently. Speech says "big-O of n squared" but subtitle displays "O(n²)". #page nested_modifiers Complex example: #sub/big-#ph!theta!Ti:.t@! of n/Θ(n)/. This reads as "big-theta of n" but displays as "Θ(n)". Note: delimiter can be any character not in the content. ``` -------------------------------- ### Script File Format for pdf2video Narration Control Source: https://context7.com/tjunttila/pdf2video/llms.txt Defines the format for script files used by pdf2video, including page markers, text modifiers for emphasis, spelling, speed, pitch, and pronunciation. Comments are ignored. ```text # File: sample_script.txt #page intro Welcome to this presentation about the *pdf2video* tool. This video is #slow/produced automatically/ with the tool. #20 You can find more details at GitHub. #page motivation Need to make videos of your PDF presentations? Tired of spending *hours* recording audio? #10 The pdf2video tool can help you! It converts PDF slides and text scripts into narrated videos, using the Amazon Polly @TTS@ engine. #page technical_details The algorithm has #sub/big-O of n squared/O(n²)/ complexity. We pronounce this as #ph/theta/Ti:.t@/. Use @HTML@ for web markup and @CSS@ for styling. #page examples_1 This demonstrates *emphasized* text for important points. Numbers like #low/negative three/ sound different with pitch control. #high/High priority items/ get higher pitch. #page examples_2 % This is a comment line and will be ignored The system supports multiple modifiers: *Emphasis*, @spelling@, #slow/slower speech/, #high/higher pitch/, #low/lower pitch/, and #10 pauses. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.