Skip to main content

Video Encoding

My TV does not play some video files, this is an attempt to document why and how to reencode things.

mediainfo is a handy tool, running it against a file gives you handy info, such as that the encoding settings of the video stream are ref=10 ... bframes=10, which is more than my TV can handle, so let's re-encode this.

I've tried using nvenc (hevc_nvenc for x265) to encode, but then it ignores the crf setting and produces garbage quality output, so am stuck rendering on a CPU.

The -map 0 option needs to be there, or only one audio track will be copied.

The -y option is to overwrite the output file without asking.

The -crf 18 option is there to set quality. You can play around with this if you're not satisfied with the image or think you can save space.

ffmpeg -y -i original.mkv -c:v libx264 -crf 18 -preset slow -c:a copy -map 0 reencodedx264.mkv
ffmpeg -y -i original.mkv -c:v libx265 -crf 18 -preset slow -c:a copy -map 0 reencodedx265.mkv