Multimedia file processing

Jun 02, 2024

#linux #video #audio


FFmpeg

ffmpeg is a cli tool for video, audio file processing. It is cross-platform and support all major operating system.

convert video

ffmpeg -i input.avi -c:v libx264 -preset slow -crf 20 -c:a aac -b:a 160k -vf format=yuv420p -movflags +faststart output.mp4

Lower the size

ffmpeg -i input.mp4 -vcodec libx264 -crf 28 output.mp4

lower crf means higher resolution and vice versa. Further compression can be done using libx265 codec (but browser doesn't support)

add an overlay

ffmpeg -i input.avi -i image.png -filter_complex "[0:v][1:v] overlay=0:0:enable='between(t,0,50)'" -vcodec libx264 -vprofile high -crf 19 -pix_fmt gray output.mp4

To list all available pixel format run ffmpeg -pix_fmts (e.g yuv420p)

create video

ffmpeg -i images%d.png -c:v libx264 -r 30 output.mp4

HandBrake

HandBrake is a very nice gui tool which gives userfriently options out of the box.