FFMPEG Book
FFMPEG Book
FFMPEG Book
Frantisek Korbel
Links
Book homepage: http://ffmpeg.tv
Facebook: http://ffmpeg.tv/facebook
Twitter: http://twitter.com/FFmpeg
YouTube: http://youtube.com/FFmpegTv
Brief Contents
Introduction
1. FFmpeg Fundamentals
2. Displaying Help and Features
3. Bit Rate, Frame Rate and File Size
4. Resizing and Scaling Video
5. Cropping Video
6. Padding Video
7. Flipping and Rotating Video
8. Blur, Sharpen and Other Denoising
9. Overlay - Picture in Picture
10. Adding Text on Video
11. Conversion Between Formats
12. Time Operations
13. Mathematical Functions
14. Metadata and Subtitles
15. Image Processing
16. Digital Audio
17. Presets for Codecs
18. Interlaced Video
19. FFmpeg Components and Projects
20. Microphone and Webcam
21. Batch Files
22. Color Corrections
23. Advanced Techniques
24. Video on Web
25. Debugging and Tests
Glossary
About the author
12
15
29
60
64
69
73
77
81
87
93
99
108
113
117
122
128
138
142
147
154
159
164
179
193
200
207
216
Table of Contents
Introduction ......................................................................................................12
Welcome................................................................................................................................12
First steps..............................................................................................................................12
Dedicated website.................................................................................................................12
Conventions ..........................................................................................................................13
Your feedback is important ................................................................................................14
Table of Contents
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
Table of Contents
Table of Contents
Table of Contents
Table of Contents
Table of Contents
Glossary .............................................................................................................207
About the author...............................................................................................216
Introduction
Welcome
Dear reader,
welcome to the book that will try to make you familiar with many interesting features of the FFmpeg
project. Its quality indicates several FFmpeg users:
Facebook, the largest social network, handles videos from users with ffmpeg tool
Google Chrome, popular web browser, uses FFmpeg libraries for HTML5 audio and video support
YouTube, the biggest video sharing website, converts uploaded videos with ffmpeg.
The books focus is to explain the basic video editing like resizing, cropping, padding, denoising, overlay,
etc., but included are instructions for more complex processing and experiments.
The chapter Digital Audio describes how to convert and create audio, advanced sound processing is in the
chapters Batch Files and Advanced Techniques.
First steps
The first step is to download FFmpeg binaries, if not already done, the details are in the first chapter or on
the dedicated website. Many Linux distributions already have FFmpeg tools installed or advanced users can
compile their own binaries.
The first chapter contains basic information about FFmpeg project and how to simplify the work with its
tools. If already familiar with these data or if it looks too technical for the start, you can move to the second
chapter and start to enter various ffmpeg commands.
Please note, that many commands in this book are simplified to illustrate the currently explained feature
and some parameters are omitted, especially in conversions, the details are in the chapter Conversion
Between Formats.
Dedicated website
For the book was created a special website on ffmpeg.tv that contains:
book index, table of contents and description of the book
examples from the book in the video format, videos are located in the particular chapters
user forum to discuss the book topics and various ideas
list of found errors (errata)
contact form
40 last articles from 6 FFmpeg mailing lists (constantly updated)
Introduction
Conventions
Text that should be entered on the command line is printed in a serif proportional typeface, for example:
ffmpeg -i input.mpg -q 1 output.avi
The part of the command that should be replaced with a particular text is printed in italics, for example:
ffmpeg -i input -vf mp=denoise3d -s vga output
The console output is printed in a sans serif proportional typeface:
Muxer avi [AVI (Audio Video Interleaved)]:
Common extensions: avi.
Mime type: video/x-msvideo.
Default video codec: mpeg4.
Default audio codec: mp3.
The blue caret ^ indicates that the command is too long to be printed on one line in the book and continues
on another, but on computer it remains a 1-line command, for example:
ffplay -f lavfi -i color=c=white ^
-vf drawtext=fontfile=/Windows/Fonts/arial.ttf:text=Welcome
Please note a space between the word white and ^ in the previous example, the space indicates that there
will be space also on the command line. This form of notation is required in the batch files that will be
explained in the chapter Batch Files.
13
Introduction
For a better orientation the book contains a colored differentiation of FFmpeg elements like the filters,
devices, sources and other items.
Colored differentiation of devices, filters, etc. related to audio and video
audio only
video only
both audio and video
12