FFmpeg tips fr

Here are a few commands for FFmpeg that were useful for me.

The help page for all parameters is here.

A nice tool that uses FFmpeg is Handbrake.

Get some info about a file

ffmpeg -i video.mp4

Parameters:

Extract the audio part of a video

ffmpeg -i video.mp4 -vn -acodec copy audio.m4a

Parameters:

Convert an audio file to another format

ffmpeg -i audio.m4a -acodec libmp3lame -ac 0 -ab 320k audio.mp3

Parameters:

Of course, the previous command and this one can be merged for a 1 step audio extraction & conversion.

Crop a video

ffmpeg -i video.mp4 -vf "crop=760:430:520:0" output.mp4

Parameters:

Pro-tip: use ffplay to preview the cropped area !

ffplay -i video.mp4 -vf "crop=760:430:520:0"

Create a gif from a video

ffmpeg -i dauphin.mp4 -r 10 dauphin.gif

Parameters:

Resize a video

ffmpeg -i cut.mp4 -vf "scale=500:-1" -c:a copy resized.mp4

Parameters:

Rotate a video

ffmpeg -i video.mp4 -vfilters "rotate=90" -c:a copy out.mp4

Parameters: