[theora] Loseless Video Codec

Basil Mohamed Gohar abu_hurayrah at hidayahonline.org
Fri Jan 8 06:27:42 PST 2010

On 01/08/2010 08:00 AM, Maik Merten wrote:
> Perhaps mplayer (or any other tool writing YUV video data) and dump_psnr 
> (example program of libtheora, 
> http://svn.xiph.org/trunk/theora/examples/dump_psnr.c) would work:
> "mplayer -vo yuv4mpeg my-video-file" will dump the decoded stream to 
> stream.yuv.
> If "dump_psnr original.yuv ljpeg.yuv" gives an infinite score your most 
> likely rather lossless ;-)
> Maik
The chroma subsampling that mplayer uses/converts to when using yuv4mpeg
output is always 4:2:0.  This is not useful if you started-off with a
different subsampling, such as 4:4:4 or 4:2:2, as chroma sampling
conversions are not lossless in and of themselves, even going
back-and-forth (higher-lower-higher).

The way I've done it is to dump the raw, decompressed video to a file,
compare filesizes, and if they are the same, then I hash them and
compare the hashes.  Then I know they are truly identical.

For example, this works when I have a Y4M video with yuv420p pixel
format, and I then I compress it using the FFV1 lossless video codec. 
If I decompress the FFV1-compressed video back into Y4M format, the
resulting file is bit-for-bit identical to the original Y4M file, as it
should be.

The same process SHOULD work for all other lossless video codec,
provided they support the pixel formats you're using.

More information about the theora mailing list