Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to find the most suitable lossless video format for 1280x720 25fps video. The video has 4 minutes. Sound will be 320 kbps mp3, that is not a big deal. Ideal conditions:

  • Lossless (can be perceptionaly lossless)
  • Container + codec can be played on most platforms
  • Container + codec can be played on modern DVD players (supporting other formats than DVD)
  • Size is less than 700 MB

Is that even possible? Have been struggling three days already, without any satisfying results, even getting 12 GB files (seems a lot - 3 GB/minute).

share|improve this question
    
For a comparison, see en.wikipedia.org/wiki/List_of_codecs#Lossless_compression –  artistoex Oct 11 '12 at 11:20
4  
I'm sorry but you practically cannot get a (visually) lossless 720p video of 4 minutes compressed to less than 700 MB (I assumed Megabyte here, not "mb" which would mean "bit"). Why do you have such a constraint? Can't the video be h.264-encoded? –  slhck Oct 11 '12 at 11:24
    
yes, MB, sorry about the confusion. I need to fit cca 5 videos x 4 minutes into 4 GB (medium limitations). –  mrkva Oct 11 '12 at 11:32
2  
Since you're getting 12GiB files I assume that you use 24Bit colour depth. The uncompressed video data stream is about 4GiB per minute. That's a huge amount of data. What you want is about 170MiB per minute. Regardless of the codec you choose you can only achieve this with a static scene without much movement. I'm afraid you have to relax the contraint to be lossless, reduce the frame rate or tolerate a larger file size. –  Marco Oct 11 '12 at 11:57
    
Can you clarify, "Container + codec can be played on modern DVD players (supporting other formats than DVD)"? –  LordNeckbeard Oct 11 '12 at 17:17

1 Answer 1

The best actual, mathematically lossless format I know of is huffyuv, but that will produce hilariously huge files, and wouldn't be compatible with much. For the record, ffmpeg can do it with:

ffmpeg -i input -c:v huffyuv -c:a libmp3lame -b:a 320k output.avi

X264, the open-source h.264 encoder, has a lossless mode. This can go inside an MP4 container, and should be compatible with most hardware made in the last few years. The first command will give a fast encode speed, but large file; the second command will take a lot longer, but the file should be about half the size of the fast-encoded one (it will still be pretty big though):

ffmpeg -i input -c:v libx264 -crf 0 -preset ultrafast -c:a libmp3lame -b:a 320k output.mp4

ffmpeg -i input -c:v libx264 -crf 0 -preset veryslow -c:a libmp3lame -b:a 320k output.mp4

If that doesn't give you a small enough file, a crf of 18 is generally considered 'visually lossless':

ffmpeg -i input -c:v libx264 -crf 18 -preset veryfast -c:a libmp3lame -b:a 320k output.mp4

I generally recommend the veryfast preset for encoding with x264, in my experience it offers the best speed/size tradeoff (there's a big dropoff in file size between superfast and veryfast, any slower than that and it's more incremental). General advice is to use the slowest preset you can handle, the presets are: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow.

See here for a more in-depth guide to x264 encoding.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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