Quick Start Guide to FFmpeg
A FULL-COLOUR book from Apress/SpringerNature
- Need to process audio/video files without spending much on software?
- Need a quick tutorial or desk-side reference for FFmpeg?
FFmpeg is THE BEST software to easily create, edit, enhance and convert audio and video files. It is a free and open-source command-utility available for Linux, Mac and Windows.
Quick Start Guide to FFmpeg is THE BEST book for an extensive FFmpeg tutorial, hack collection and quick reference. It is richly illustrated with color screenshots, code examples and tables to help you work with audio, video, images, animations, fonts, subtitles and metadata like a PRO.
This book begins with a simple introduction to FFmpeg executables — ffmpeg, ffprobe and ffplay, and explains how you can use them to process multimedia containers, streams, audio channels, maps and metadata. It then describes how you can easily edit, enhance and convert audio, video, image and text files. There are dedicated chapters for filters, audio, subtitles and metadata, as well as a big collection of FFmpeg tips and tricks. Sample lists of FFmpeg filters, encoders, decoders, formats and codecs are also available as appendices. The book is richly illustrated with screenshots and syntax-highlighted code snippets, all in FULL COLOUR. It is based on the latest Long Term Support (LTS) version of FFmpeg.
Quick Start Guide to FFmpeg is for anyone who needs to edit or process multimedia files including studio professionals, broadcast personnel, video content creators (such as Youtubers), podcasters, librarians, archivists and webmasters. It will be indispensable for those wanting to process a variety of multimedia files from the command line and inside shell scripts.
Format | Store | Order | Get the FULL-COLOUR paperback |
---|---|---|---|
Colour paperback | Amazon (USA) | 44.99 | |
Colour paperback | Barnes & Noble (USA) | $44.99 | |
Colour paperback | Springer-Nature (with free worldwide shipping) |
$44.99 | |
PDF ebook | Springer-Nature (worldwide) | $29.99 | |
Colour paperback | Bookswagon (India) | ₹2500 | |
Universal link for all stores | |||
https://books2read.com/ffmpeg |
This book will help you learn to:
- Convert from one format to another video-to-video, video-to-audio, video-to-image, image-to-video, video-to-animation, animation-to-video, text-to-audio, text-to-video
- Edit video files by cutting them with and without re-encoding, appending (joining clips together), resizing, changing frame rate and aspect ratio, mixing in audio
- Use filters to rotate, flip, crop, overlay (side-by-side or inset), remove logos, blur, smooth and sharpen, apply transitions as well as speed up or down playback
- Edit audio files by changing, normalizing or compressing volume, mixing and splitting channels and detecting silence. Also, learn to generate waveforms as video or image
- Add subtitles, place them anywhere on the screen, use custom fonts and colors, and use different languages
- Set metadata such as MP3 tags for and album art, set global and stream-specific metadata. And, learn how to import, export and remove metadata
- Automate your FFmpeg tasks
List of Contents
- Introduction
- Extra resources for the book
- Chapter 1: Installing FFmpeg
- Chapter 2: Starting with FFmpeg
- Chapter 3: Formats and codecs
- Chapter 4: Media containers and FFmpeg numbering
- Chapter 5: Format conversion
- Chapter 6: Editing videos
- Chapter 7: Using FFmpeg filters
- Chapter 8: All about audio
- Chapter 9: All about subtitles
- Chapter 10: All about metadata
- Chapter 11: FFmpeg tips and tricks
- Chapter 12: Annexures
- Annexure 1: Sample list of codecs
- Annexure 2: Sample list of decoders
- Annexure 3: Sample list of encoders
- Annexure 4: Sample list of filters
- Annexure 5: Sample list of formats
On the right, you can see real pages from the paperback published by Apress in 2023. (The animation is low-resolution to conserve file size.) Note the special formatting, syntax highlighting and usability aids that I got them to include. (You will not find that in other books.)
For a full-resolution sample, check this PDF containing the first few pages of the book.
More sample pages and annexures updated to v6
This book was originally self-published in 2020 as FFmpeg Quick Hacks. When I presented the book to Apress for republication under their imprint, they asked me to rewrite the book using my own videos or explicitly public-domain videos instead of leveraging fair-use doctrine on random videos grabbed from Youtube (included in the PDF linked below). I have also updated the book to FFmpeg v5.1 LTS (Long Term Support). It is good for FFmpeg v6 totally and FFmpeg v7 with the exception of loopback decoders.
Unlike other authors (who use Microsoft Word), I write my books in CommonMark (standarised MarkDown) and output them as PDF using a bash
script — starting with the very first line. As I usually create my own covers, I made replica Apress covers for that PDF.
In the PDF download below, I have excerpted here a few sample pages out of both books. (The book published by Apress will have a different formatting. Read the release announcement.)
Also included are annexures (updated for FFmpeg v6) and my books backlist (with no watermarks of course). The annexures contain ffmpeg
output for the options -codecs
, -formats
, -filters
, -encoders
and -decoders
from Windows and Linux OSs.
Extra Resources — Latest articles
- On my blog:
- Compositing videos, images and text using FFmpeg
- Your FFmpeg build compilation from source failed because of libvmaf?
- My FFmpeg book has been published by Apress/SpringerNature
- How to compile FFmpeg 6.0 in Linux and what new things can you do with it
- Fix for FFmpeg error ‘Frame rate very high for a muxer not efficiently supporting it. Please consider specifying a lower framerate, a different muxer or setting vsync/fps_mode to vfr’
- What's new in FFmpeg 6.1
- The anti-racism filter that every White Youtuber needs (satirical version)
- How to create a slideshow with FFmpeg
- How to play videos using FFplay
- How to add text, image, colour and timer overlays on videos using FFmpeg
- Problems in compiling FFmpeg 7.0 from source on old Linux systems
- How to create a collection of several video clips
- How to replace a colour in a video with another colour using FFmpeg
- How to build FFmpeg 7.0 from source and what you can do with its new features
- On Open Source For You magazine:
- On CodeProject:
- FFmpeg Filters Every Youtuber Needs (non-satirical version)
- How to Use FFmpeg Filters to Jazz Up Your Audio and Video Files
Extra Resources — Source code
The list of commands used in the book is available in this text file:
QuickStartGuideToFFmpegByVSubhash-ER-CommandsList.md.txt
Extra Resources — Video demos
Stop wasting hours on expensive timeline-based video editors such as Premiere Pro or Final Cut Pro! Most video-editing tasks REQUIRE LESS THAN 5 MINUTES USING FFMPEG. (Rendering time not included.) FFmpeg can create almost all kinds of complex videos with fonts, animations, subtitles, overlays, transitions, etc. From the command line! Using just one command! FFmpeg! No problem!
-
All-in-one video demo at the end of the book
-
How to play videos with
ffplay
— Read the related blog post for more details. -
How to fade in fade out audio and video
-
Convert a video into an animated image
This is my software implementation for Chandler Bing's ‘Run, Yasmine! Run!’ challenge.ffmpeg -y -i baywatch.m4v \ -filter_complex "fps=7,scale=w=320:h=-1:flags=lanczos,split[v1][v2]; [v1]palettegen=stats_mode=diff[p]; [v2][p]paletteuse=dither=bayer:bayer_scale=4" \ run-yasmine-run-4.gif
This command creates a GIF animation with good frame quality and file size, but the motion is not smooth.
If you change the filter to
paletteuse=dither=bayer:bayer_scale=0
, you get smoother motion but bigger file size and a dotted texture.Instead of creating an animated GIF, which is limited to 256 colours, try creating an animated PNG. A PNG file supports millions of colours. ImageMagick is the tool you should use, not FFmpeg.
magick animated.gif animated.apng
If you convert from PNG source files (instead of the already downsampled image frames in the animated GIF), you will be able to create an animated PNG with richer colours.
For my first fiction title Unlikely Stories, I initially used an animated GIF. When I learned about APNG file, I was able to eliminate the effects of downsampling. I did not use FFmpeg to create the APNG file. ImageMagick was the tool I used as I had the source images.
magick -delay 200 -loop 0 \ chapter-image-*.png \ -units PixelsPerInch -density 72 -resize '>x400' \ animation-unlikely-stories.apng
Animated GIF Animated PNG When converting a video to an animated PNG, I use FFmpeg. In that case, FFmpeg is the appropriate tool.
ffmpeg -i bw.m4v \ -vf "scale=w=250:h=-2, hqdn3d, fps=6" \ -dpi 72 -plays 0 \ bw.apng
-
Generate noise in audio and video
-
Bleep part of a video
-
Add audio waveforms to video
-
Reverse audio and video
-
MP3-to-MP4 or audio-to-video conversion using audio power spectrum filter
-
How to add echo to a video
-
Blurring a portion of a video
-
Write text on video
-
Render transparent GIF on video with infinite looping
-
Replace green-screen background on another video
-
Fade into another video using a transition effect
-
Slow down a video
Ms. Lennon's original video is available on her channel.
After slowing down a Tom & Jerry video, I was able to confirm poltergeist activity in a doll.
-
Subtitle a video
In the subtitle file (SSA), I used the following style for using my own custom font and other subtitle display settings.
Style: Default,Florentia,30,&H2200CCCC,&H000000FF,&H220000EE,&HAA00CCCC,-1,-1,0,0,100,100,0,30.00,3,2,3,1,20,20,40,1
-
A stop-motion video created using Cheese and FFmpeg
- Increase volume using FFMPEG and or Audacity for Dynamic Range Compression
Acknowledgements & Thanks
- "Rowdy" Roddy Piper/John Carpenter (They Live)
- Alaska Granny
- Amazing Lucas
- Barbara 2.0
- 'Beto' O'Rourke (Born to be president… ial campaign)
- Chills
- Jack Benny (The Jack Benny Program)
- Jean-Claude Van Damme (public-domain videos)
- ‘Jerome Weiselberry’
- Jimmy Fallon (Tonight Show)
- Joking.com
- Laurie Lennon
- Naomi 'Sexy Cyborg' Wu
- Sara Gonzales Unfiltered
- Yasmine Bleeth (Baywatch)
Use an RSS feed-reader such as Liferea, Thunderbird/Seamonkey or RSS Owl if you would like to anonymously subscribe to these channels. If you have no choice but to use Android, then use my app Subhash Browser & RSS Reader. It is also FREE.
Some other videos that I have created using FFmpeg
- Climate Change teen's message - improved, expletives deleted, bleeped & subtitled
In 2018, a Linux update ensured that all swear words in the kernel code submits will be automatically replaced. For example, 'f***' would be replaced with the word 'hug'. I did the same to a speech by a Swedish climate teen.
- Alexandria Ocasio-Cortez, meet Garbage Disposal
-
FAA under AOC Socialist administration
ffmpeg -y -i Prime-Time.mp4 \ -ss 0:43:51 -t 0:0:33 \ -filter_complex "color=c=green:s=640x360[c]; [c]drawtext=x=20:y=20:fontcolor=yellow:alpha=0.6:shadowx=1:shadowy=1:textfile=t1.txt:fontsize=22:fontfile=Dummies_.ttf[t1]; [t1]drawtext=x=270:y=320:fontcolor=yellow:alpha=0.6:shadowx=1:shadowy=1:textfile=t2.txt:fontsize=22:fontfile=Dummies_.ttf[t2]; [t2]drawtext=x=10:y=330:fontcolor=white:alpha=0.6:textfile=t3.txt:fontsize=16:fontfile=SourceSerifPro-It.ttf[t3]; [0:v:0]crop=640:250:0:35[v]; [t3][v]overlay=0:55" \ aoc-faa.mp4
- Rachel Maddow crying offscreen footage
- "So many people don't share Google's values!"
- Can the New York Times legally copy Naomi Wu's video without permission?
- Joe Biden is US comedy relief
- Jennifer Lawrence and Steve Buscemi deep-fake videos composited with images, text, background colour boxes
Check my blog post for theffmpeg
command that created this video.
Companion book
FFmpeg is a command-line program. If you are going to use it a lot, then you might as well become an expert at the command-line. Here is is one of my other books that will make your terminal time more fun and easy.
This is the first and only paperback with colour syntax highlighting! (This feature is not available in the ebook form of the book.) No other publisher has done something like this.