User Tools

Site Tools


ffmpeg

This is an old revision of the document!


ffmpeg vault

Essentials

What?

ffmpeg is a swiss army knife for everything audio/video. It can do practically every task under the sun, and in fact powers most major dedicated “video players” (VLC, MPC-HC, built-in players in Chrome and Firefox…)1)

How?

If you're on Windows, it's possible to install ffmpeg and use it directly https://ffmpeg.zeranoe.com/builds/ - but since the windows Command Prompt sucks ass, it's recommended to just install Ubuntu as part of the Windows Subsystem for Linux, and then apt-get install ffmpeg.

If you're on Linux, you know what to do 8-)

Techniques

video // image files // frames

images -> video

1. creating a list of images

ffmpeg needs a list of images in a text file in a specific format in order to convert them to a video. There's a couple ways to do this:

ls *.jpg | xargs -I xyz echo "file 'xyz'" > list.txt
for f in *.jpg; do echo "file '$f'" >> list.txt; done

It's up to preference, all end up with a list of all JPGs in current directory, in list.txt.

2. list to video
ffmpeg -f concat -r 30 -i list.txt out.mp4

-f concat tells ffmpeg to handle list.txt as a list.

-r 30 specifies resulting FPS (30 FPS)

out.mp4 is output file - autodetected as h264-encoded. (out.avi, out.gif, etc. also work - refer to ffmpeg manual)

video -> images

ffmpeg -i FILE image%05d.png

Where FILE is the video file, and image%05d.png is the format string for image filenames; this will create image00001.png, image00002.png, image00123.png, etc. (%05d means pad with 5 zeroes; %010d for padding with 10 zeroes…)

ffmpeg.1584029303.txt.gz · Last modified: 2020/03/12 17:08 by sdbs