I want to create a video (bar.xxx) that is lossless from a video (foo.xxx) using ffmpeg. Could you please show me the parameters for such a video. The video must be playable on VLC and/or Totem. The wrapper format must be either mp4, avi or mov.


First make sure that you have FFmpeg and the extra codecs installed.

  1. Under Xenial Xerus this command should suffice:

    sudo apt-get install ffmpeg libavcodec-extra
  2. Under Trusty Tahr this guide should be followed:

Then for either Trusty or Xenial the following command will convert your input video to lossless H.264 in an mp4 container:

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

The file will be quite large and the video is lossless, but be aware that the value of converting to lossless depends very much on the quality of your initial file.

Neither Totem or vlc should have any troubles playing such a file. You could perhaps experiment a little with huffyuv:

-c:v huffyuv

but you might find that these files are massive for the arguably the same results as lossless H.264...


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.