Lossless ffmpeg conversion/encoding

Marc Brown picture Marc Brown · Jul 30, 2012 · Viewed 18k times · Source

I'm looking for the best in quality when converting videos.

I only want to use lossless audio and video encoders and a good container.

How do I enable lossless x264 vcodec for ffmpeg?

I currently use ffmpeg -i "inputvideo" -s 1280x720 -ar 48000 -threads 4 -vcodec libx264 -acodec copy -dsur_mode 2 -ac 6 "outputvideo720p.mkv"

I plan on using flac for the acodec by am unsure because I don't want to use quality if it switches to 16-bit instead of 24-bit

Answer

Hamed Tabatabaei picture Hamed Tabatabaei · May 4, 2013

You can use x264 in lossless manner I think. As in here and here use these flags for ffmpeg:

ffmpeg -i input.avi -c:v libx264 -preset veryslow -qp 0 output.mkv

In case you couldn't load libx264, remove ffmpeg and install from source with x264 enabled. Here is how to.