[MPlayer-users] Are mencoder lossless codecs really lossless?

James Board jpboard2 at yahoo.com
Mon Jul 8 23:03:39 CEST 2013

But are the codecs really lossless?

 From: Phil Rhodes <phil_rhodes at rocketmail.com>
To: James Board <jpboard2 at yahoo.com>; "MPlayer usage questions, feature requests, bug reports" <mplayer-users at mplayerhq.hu> 
Sent: Monday, July 8, 2013 12:12 PM
Subject: Re: [MPlayer-users] Are mencoder lossless codecs really lossless?

Is "raw" YUV 4:2:2, like the input? You may find raw implies RGB, but it may default to whatever pixel format comes out of the codec. That'd make it bigger, anyway.

You also mention "VY12" by which I assume you mean YV12, which is a 4:2:0 format with lower chroma resolution. If mencoder is maintaining the chroma dimensions, then yes it will be smaller than a 4:2:2 input, by about a sixth.

There are also a number of different ways of building AVI files, with various types of interleaving and chunk sizes, which could account for a reasonably small difference in file sizes.

As regards precision, these sorts of codecs are theoretically capable of providing bit-exact results, but real world, practical implementations of them may not due to scaling and rounding errors, etc. This should not affect the file size as raw output of the same resolution and pixel format should be the same size regardless of image content.


 From: James Board <jpboard2 at yahoo.com>
To: "mplayer-users at mplayerhq.hu" <mplayer-users at mplayerhq.hu> 
Sent: Monday, 8 July 2013, 16:33
Subject: [MPlayer-users] Are mencoder lossless codecs really lossless?

My input file is an uncompressed raw YUV 4.2.2 format.  I want to compress individual frames with a lossless codec.  My mencoder implementation listed three such codecs it the man page: 
    * ljpeg: lossless jpeg
ffv1: FFmpeg's lossless video codec
    * ffvhuff: nonstandard 20% smaller HuffYUV using VY12
I encoded my file using the following:
    mencoder -ovc lavc -lavcopts ljpeg -oac copy -o out.avi in.avi
And then I converted it back to raw pixels with
    mencoder -ovc raw -oac copy -o out2.avi out.avi
The above two steps should regenerate exactly the
 original file in.avi, right?  I did this with the three lossless codecs I listed above.  The problem is that my original input file in.avi is bigger than the final output file out2.avi: they should be exactly the same, right?
So, my question is this: are those codecs really lossless?  Bit-exact lossless?  Or are they merely pretty good?
MPlayer-users mailing list
MPlayer-users at mplayerhq.hu

More information about the MPlayer-users mailing list