ffmpeg commands

This page contains ffmpeg commands that I find useful. ffmpeg is super powerful and can sometimes be enough for quick media manipulations. For more commands check the ffmpeg documentation page.

Cut a part of a video :

ffmpeg -i input.mp4 -ss 00:00 -to 00:10 -c:v libx264 -crf 30 output.mp4

Concatenate videos

ffmpeg -f concat -i input.txt -c copy output.mp4

Create a text file with the files you want to concatenate into a single video or audio file.

file 'video1.mp4'
file 'video2.mp4'
file 'video4.mp4'

Add audio to video

ffmpeg -i input.mp4 -i input.mp3 -c copy -map 0:v:0 -map 1:a:0 output.mp4

Encode audio file to mp3

ffmpeg -i input.opus -ar 44100 -ac 2 -b:a 128k output.mp3

Add metatags to audio file

ffmpeg -i input.mp3 -i img.jpg -c copy -map 0 -map 1 -metadata title="title" output.mp3
Initially published: March 18th, 2021
Generated: November 12th, 2021
Statistics for: ffmpeg commands Time spent
Time spent
1 hours total
Started
week 11 of 2021
Last update
week 11 of 2021
All times entries for this page
YearWeekHours
2021111