Post #3240790
2026-01-01 15:06 UTC
My current command template for re-encoding videos with ffmpeg:
ffmpeg -i [input] -map 0 -s [width]x[height] -c:v libx265 -ac 2 -c:a libopus -c:s copy [output].mkv
"-map 0" makes sure any attachments (e.g. subtitle fonts) are included.
"-s [width]x[height]" resizes the video. To keep the original size, you can omit this.
"-c:v libx265" sets the video codec. This one works fine for playback with mpv on my computer, and gets ~1/3 file size compared to the defaults.
"-c:a libopus" sets the audio codec. Again, this works in mpv and has small file size for good quality. "-ac 2" mixes down to stereo if needed, since libopus can't handle more channels.
"-c:s copy" preserves subtitles, if they exist. You can replace this with "-f:v subtitles=[input]" if you want to burn them in, where [input] is the input path repeated.
Replies (0)
No replies.