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

James Board jpboard2 at yahoo.com
Tue Jul 9 14:52:14 CEST 2013

Okay, so then if I start with some specific color space, compress with the lossless codecs, and then transcode back to that same original colorspace (assuming everything else is the same too: resolution, frame-rate, etc), then the frames should be exactly the same as the original (except for maybe small round-off errors, or artifacts of that nature)?
I know that's what the name implies, but I just wanted to make sure.  The problem I had was that I grabbed a 30 second segment from a video to experiment with.  That segment started at the 10-second mark of the original video and ended at the 40-second mark.  The purpose of that was to have a small fast piece of video merely to experiment with. But somehow it looks like mencoder put the full 42 seconds in the experimental video file, and then when I translated to lossless, and back to the original format, it became the expected 30 seconds.  So I was seeing large reductions of filesize, which made me wonder if these lossless codecs really were.

From: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
To: James Board <jpboard2 at yahoo.com>; "MPlayer usage questions, feature requests, bug reports" <mplayer-users at mplayerhq.hu> 
Sent: Tuesday, July 9, 2013 4:05 AM
Subject: Re: [MPlayer-users] Are mencoder lossless codecs really lossless?

James Board <jpboard2 at yahoo.com> wrote:

>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
>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
> 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
>MPlayer-users mailing list
>MPlayer-users at mplayerhq.hu

Yes, of course. Why else would they be called that?
But the codec being lossless doesn't necessarily mean all other parts involved in transcoding are lossless.

More information about the MPlayer-users mailing list