Lossless ffmpeg conversion/encoding

24,308

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 -qp 0 output.mkv

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

Share:
24,308
Marc Brown
Author by

Marc Brown

Mechatronics Engineering Inventor, Innovator, Programmer, Designer, Entrepreneur.

Updated on August 05, 2022

Comments

  • Marc Brown
    Marc Brown almost 2 years

    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

  • Marc Brown
    Marc Brown about 11 years
    I'm currently using ffmpeg's FFV1 loss-less codec. Even though it has a 40mbit bit-rate, it's the closest I can get to true loss-less conversions without presets.
  • MoDJ
    MoDJ over 9 years
  • Hamed Tabatabaei
    Hamed Tabatabaei over 9 years
    I see what he adds is pixel_format:444. Although it will be theoretically more lossless to have it, but in 99.9% of cases the input itself is already chroma-subsampled to 4:2:0. So practically no advantage in that. All a person needs is "-qp 0".
  • Валерий Заподовников
    Валерий Заподовников over 2 years
    Hamed, that is not tur for 10 bit, because only high444 supports lossless, high 10 is not lossless.