ffmpeg arguments for reoccurring tasks


For scaling a video with ffmpeg with a target of 1280px width or height, I use the following filters:

enter image description here

If the source width or height is less than 1280px, the original dimensions will be kept.

If the source width or height is larger than 1280px, the output is scaled to 1280px

Since scaling requires division by 2, the dimensions are calculated and ensured to add up

Change (both) '1280' to fit your output needs.

Escaping ruins the formatting, click here to get the source in plain text


ffmpeg, crop video

- Posted in ffmpeg by

Crop 8 seconds of a video, starting from 3 seconds, using the copy method (no reencode)

ffmpeg -i input.mp4 -ss 00:00:03 -t 00:00:08 -c copy output-crop.mp4

ffmpeg, rip audio from video

- Posted in ffmpeg by

Rip 3 seconds of audio from a video, starting from the 7 second mark:

ffmpeg -ss 7 -t 3.0 -i source.mp4 output.mp3