基本信息
源码名称:FFmpeg basic.pdf
源码大小:22.63M
文件格式:.pdf
开发语言:C/C++
更新时间:2019-07-26
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
FFmpeg basic.pdf
Table of Contents Introduction ......................................................................................................12 Welcome................................................................................................................................12 First steps..............................................................................................................................12 Dedicated website.................................................................................................................12 Conventions..........................................................................................................................13 Your feedback is important................................................................................................14 1. FFmpeg Fundamentals ................................................................................15 FFmpeg introduction...........................................................................................................15 Developers of FFmpeg.........................................................................................................16 Participation in FFmpeg development ..............................................................................16 FFmpeg download ...............................................................................................................17 Command line syntax..........................................................................................................17 Windows Command Prompt and its alternatives.............................................................18 Path setting...........................................................................................................................19 Renaming to shortened form ..............................................................................................20 Displaying output preview ..................................................................................................21 Preview with FFplay media player ...................................................................................21 Preview with SDL output device ......................................................................................21 SI prefixes available in FFmpeg .........................................................................................21 Transcoding with ffmpeg ....................................................................................................22 Filters, filterchains and filtergraphs..................................................................................23 Selection of media streams..................................................................................................25 Lavfi virtual device ..............................................................................................................27 Color names..........................................................................................................................27 2. Displaying Help and Features .....................................................................29 Text help in FFmpeg tools...................................................................................................29 Available bitstream filters...................................................................................................29 Available codecs...................................................................................................................30 Available decoders...............................................................................................................36 Available encoders...............................................................................................................43 Available filters....................................................................................................................46 Available formats.................................................................................................................48 Available layouts of audio channels...................................................................................52 FFmpeg license.....................................................................................................................54 Available pixel formats........................................................................................................54 Available protocols..............................................................................................................57 Available audio sample formats.........................................................................................58 FFmpeg version............................................................................... Table of Contents 6 Setting bit rate ......................................................................................................................62 Constant bit rate (CBR) setting..........................................................................................62 Setting maximum size of output file ...................................................................................63 File size calculation ..............................................................................................................63 4. Resizing and Scaling Video..........................................................................64 Resizing video.......................................................................................................................64 Predefined video frame sizes...............................................................................................64 Considerations when resizing - Nyquist sampling theorem.............................................66 Special enlarging filter.........................................................................................................67 Advanced scaling..................................................................................................................67 Scaling video proportionately to input...............................................................................68 Scaling to predefined width or height................................................................................68 5. Cropping Video ............................................................................................69 Cropping basics....................................................................................................................69 Cropping frame center ........................................................................................................70 Automatic detection of cropping area................................................................................71 Cropping of timer ................................................................................................................71 6. Padding Video...............................................................................................73 Padding basics......................................................................................................................73 Padding videos from 4:3 to 16:9 .........................................................................................75 Padding videos from 16:9 to 4:3 .........................................................................................75 Padding from and to various aspect ratios........................................................................76 Pillarboxing - adding boxes horizontally ..........................................................................76 Letterboxing - adding boxes vertically..............................................................................76 7. Flipping and Rotating Video .......................................................................77 Horizontal flip ......................................................................................................................77 Vertical flip...........................................................................................................................77 Introduction to rotating.......................................................................................................78 Rotation by 90 degrees counterclockwise and flip vertically...........................................79 Rotation by 90 degrees clockwise .......................................................................................79 Rotation by 90 degrees counterclockwise ..........................................................................80 Rotation by 90 degrees clockwise and flip vertically ........................................................80 8. Blur, Sharpen and Other Denoising ...........................................................81 Blur video effect ...................................................................................................................81 Sharpen video.......................................................................................................................83 Noise reduction with denoise3d ..........................................................................................84 Noise reduction with hqdn3d ..............................................................................................85 Noise reduction with nr option ...........................................................................................86 9. Overlay - Picture in Picture.........................................................................87 Introduction to overlay........................................................................................................87 Command structure for overlay.........................................................................................87 Logo in one of corners.........................................................................................................88 Logo in top-left corner ......................................................................................................89 Logo in top-right corner....................................................................................................89 Logo in bottom-right corner..............................................................................................89 Table of Contents 7 Logo in bottom-left corner................................................................................................90 Logo shows in specified moment ........................................................................................90 Video with timer ..................................................................................................................91 Other overlay examples.......................................................................................................92 10. Adding Text on Video ................................................................................93 Introduction to adding text on video..................................................................................93 Text positioning....................................................................................................................95 Horizontal location setting ................................................................................................95 Vertical location setting ....................................................................................................95 Font size and color setting...................................................................................................96 Dynamic text.........................................................................................................................97 Horizontal text movement.................................................................................................97 Vertical text movement.....................................................................................................98 11. Conversion Between Formats....................................................................99 Introduction to media formats ...........................................................................................99 File formats .......................................................................................................................99 Media containers...............................................................................................................99 Transcoding and conversion...............................................................................................99 Introduction to codecs.........................................................................................................100 Overwriting same named output files................................................................................101 Generic options for conversion...........................................................................................102 Private options for conversion............................................................................................105 MPEG-1 video encoder.....................................................................................................105 MPEG-2 video encoder.....................................................................................................106 MPEG-4 video encoder.....................................................................................................106 libvpx video encoder.........................................................................................................106 AC-3 audio encoder ..........................................................................................................107 Simplified encoding of VCD, SVCD, DVD, DV and DV50..............................................107 12. Time Operations.........................................................................................108 Duration of audio and video ..............................................................................................108 Setting with -t option.........................................................................................................108 Setting with number of frames..........................................................................................108 Setting delay from start.......................................................................................................108 Extracting specific part from media file............................................................................108 Delay between input streams..............................................................................................109 One input file.....................................................................................................................109 Two or more input files.....................................................................................................109 Limit for processing time ....................................................................................................109 Shortest stream determines encoding time........................................................................109 Timestamp and time bases..................................................................................................110 Encoder timebase setting ....................................................................................................110 Audio and video speed modifications.................................................................................111 Video speed change...........................................................................................................111 Audio speed change ..........................................................................................................112 Synchronizing audio data with timestamps ......................................................................112 13. Mathematical Functions ............................................................................113 Table of Contents 8 Expressions that can use mathematical functions.............................................................113 Built-in arithmetic operators..............................................................................................114 Built-in constants .................................................................................................................114 Table of built-in mathematical functions...........................................................................114 Examples of using functions................................................................................................116 14. Metadata and Subtitles..............................................................................117 Introduction to metadata ....................................................................................................117 Creating metadata ...............................................................................................................117 Saving and loading metadata to/from the file ...................................................................119 Deletion of metadata............................................................................................................119 Introduction to subtitles......................................................................................................119 Subtitles encoded directly to video .....................................................................................121 15. Image Processing ........................................................................................122 Supported image formats....................................................................................................122 Creating images....................................................................................................................123 Screenshots from videos....................................................................................................123 Animated GIFs from videos..............................................................................................123 Images from FFmpeg video sources..................................................................................123 Video conversion to images..............................................................................................124 Resizing, cropping and padding images.............................................................................125 Flipping, rotating and overlaying images..........................................................................126 Conversion between image types........................................................................................127 Creating video from images................................................................................................127 Video from one image.......................................................................................................127 Video from many images ..................................................................................................127 16. Digital Audio...............................................................................................128 Introduction to digital audio...............................................................................................128 Audio quantization and sampling......................................................................................128 Audio file formats ................................................................................................................130 Sound synthesis ....................................................................................................................130 Stereo and more complex sounds.......................................................................................132 Binaural tones for stress reduction ....................................................................................132 Sound volume settings .........................................................................................................133 Multiple sounds mixed to one output.................................................................................133 Downmixing stereo to mono, surround to stereo ..............................................................134 Simple audio analyzer..........................................................................................................135 Adjusting audio for listening with headphones.................................................................136 Audio modifications with -map_channel option ...............................................................136 Switching audio channels in stereo input..........................................................................137 Splitting stereo sound to 2 separate streams......................................................................137 Muting one channel from stereo input ..............................................................................137 Merging 2 audio streams to 1 multichannel stream .........................................................137 Audio stream forwarding with buffer order control........................................................137 17. Presets for Codecs ......................................................................................138 Introduction to preset files..................................................................................................138 Examples of preset files.......................................................................................................139 Table of Contents 9 Preset file libvpx-1080p.ffpreset.......................................................................................139 Preset file libvpx-1080p50_60.ffpreset.............................................................................139 Preset file libvpx-360p.ffpreset.........................................................................................140 Preset file libvpx-720p.ffpreset.........................................................................................140 Preset file libvpx-720p50_60.ffpreset...............................................................................141 18. Interlaced Video..........................................................................................142 NTSC, PAL and SECAM TV standards ...........................................................................142 Interlaced frame type setting..............................................................................................143 Field order change of interlaced video ..............................................................................143 Deinterlacing ........................................................................................................................144 yadif filter..........................................................................................................................144 Option -deinterlace............................................................................................................144 Deinterlacing filters from MPlayer project.......................................................................144 Pullup filter........................................................................................................................145 Interlaced video and digital television ...............................................................................145 19. FFmpeg Components and Projects...........................................................147 FFplay introduction.............................................................................................................147 Key and mouse controls during playback .........................................................................148 FFplay show modes...........................................................................................................148 FFprobe introduction ..........................................................................................................149 FFserver introduction .........................................................................................................150 FFmpeg software libraries..................................................................................................150 libavcodec .........................................................................................................................150 libavdevice ........................................................................................................................150 libavfilter...........................................................................................................................151 libavformat ........................................................................................................................151 libavutil .............................................................................................................................151 libpostproc.........................................................................................................................151 libswresample....................................................................................................................151 libswscale ..........................................................................................................................151 Projects using FFmpeg components...................................................................................152 HTML5 support in Google Chrome..................................................................................152 Videoprocessing on YouTube and Facebook ...................................................................152 Multimedia frameworks utilizing FFmpeg .......................................................................152 Video editors.....................................................................................................................152 Audio editors.....................................................................................................................152 Media players using FFmpeg ............................................................................................153 20. Microphone and Webcam..........................................................................154 Introduction to input devices..............................................................................................154 List of available cameras and microphones......................................................................154 Available options for webcam ..........................................................................................155 Displaying and recording webcam input...........................................................................156 Using two webcams..............................................................................................................156 Recording sound and sending it to loudspeakers..............................................................158 21. Batch Files...................................................................................................159 Advantages of batch files.....................................................................................................159 Table of Contents 10 Batch file commands............................................................................................................159 Typical usage of batch files.................................................................................................161 Tone generator .....................................................................................................................161 Creating Jingle Bells............................................................................................................162 Simplified conversion ..........................................................................................................163 22. Color Corrections.......................................................................................164 Video modifications with lookup table...............................................................................164 Conversion to monochrome (black-and-white) image......................................................164 Introduction to color spaces................................................................................................165 YUV color space and its derivatives...................................................................................166 Luma (luminance) and chroma (chrominance) .................................................................166 Pixel formats.........................................................................................................................166 RGB pixel format modifications.........................................................................................167 Color balance.....................................................................................................................168 Modifications of YUV pixel format....................................................................................169 Brightness correction.........................................................................................................170 Hue and saturation setting ..................................................................................................171 Comparison in 2 windows...................................................................................................172 2 windows compared horizontally ....................................................................................172 2 windows compared vertically.........................................................................................173 Space between windows....................................................................................................173 Modified version first........................................................................................................174 2 modified versions without input.....................................................................................174 Comparison in 3 windows...................................................................................................175 3 windows compared horizontally ....................................................................................175 3 windows compared vertically.........................................................................................175 Input in the middle window...............................................................................................176 Brightness correction in 2 and 3 windows.........................................................................176 Comparison in 4 windows...................................................................................................178 23. Advanced Techniques................................................................................179 Joining audio and video files...............................................................................................179 Concatenation with shell command ..................................................................................179 Concatenation with concat protocol..................................................................................180 Concatenation with concat filter .......................................................................................180 Other types of joining........................................................................................................180 Removing logo ......................................................................................................................181 delogo filter .......................................................................................................................181 Fixing of shaking video parts..............................................................................................182 Adding color box to video....................................................................................................183 Number of frames detection................................................................................................183 Detection of ads, section transitions or corrupted encoding............................................184 Detection with blackframe filter .......................................................................................185 Selecting only specified frames to output ..........................................................................186 Scaling input by changing aspect ratios.............................................................................187 Screen grabbing ...................................................................................................................188 Detailed video frame information ......................................................................................188 Table of Contents 11 Audio frequency spectrum..................................................................................................189 Audio waves visualization ...................................................................................................190 Voice synthesis .....................................................................................................................190 Saving output to multiple formats at once ........................................................................191 Additional media input to filtergraph................................................................................192 24. Video on Web..............................................................................................193 HTML5 support on main browsers ...................................................................................193 Adding audio with HTML5 ................................................................................................194 Adding video with HTML5.................................................................................................195 Adding video for Flash Player ............................................................................................196 Video sharing websites........................................................................................................196 Videoprocessing on webserver............................................................................................198 Monetizing video uploads....................................................................................................199 25. Debugging and Tests ..................................................................................200 debug, debug_ts and fdebug options..................................................................................200 Flags for error detection .....................................................................................................202 Logging level setting ............................................................................................................202 Timebase configuration test................................................................................................203 Testing encoding features....................................................................................................203 Test patterns.........................................................................................................................205 RGB test pattern................................................................................................................205 Color pattern with scrolling gradient and timestamp........................................................205 SMPTE bars pattern ..........................................................................................................205 Simple packet dumping or with payload (hexadecimally)...............................................205 CPU time used and memory consumption ........................................................................206 Glossary .............................................................................................................207 About the author...............................................................................................216