在好例子网,分享、交流、成长!
您当前所在位置:首页C/C++ 开发实例多媒体编程 → FFmpeg basic.pdf

FFmpeg basic.pdf

多媒体编程

下载此实例
  • 开发语言:C/C++
  • 实例大小:22.63M
  • 下载次数:16
  • 浏览次数:153
  • 发布时间:2019-07-26
  • 实例类别:多媒体编程
  • 发 布 人:8803530
  • 文件格式:.pdf
  • 所需积分:2
 相关标签: FFmpeg

实例介绍

【实例简介】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

标签: FFmpeg

实例下载地址

FFmpeg basic.pdf

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警