Wednesday, February 15, 2012

Converting AVI to Dirac

FFMPEG understands Dirac. So here's the command to convert MJPEG/AVI to Dirac. Use MKV extension for the output file to keep the sound.

$ ffmpeg -i t1.avi -vcodec libschroedinger t1.drc

It can be done the long way, by converting to YUV first:

$ lav2yuv +n DSC_0023.AVI > tmp.yuv
$ ffmpeg -i tmp.yuv -vcodec libschroedinger t1.drc

From a 55.2 MB AVI/MJPEG file with audio and 720x480 video, a 729.9 MB YUV420 file is produced.

Encoding to Dirac directly from AVI, results in a 562.4 KB file.
Encoding to MKV from AVI produces a 563.9 KB file.

Compare that to 6.8 MB H.264 file produced form YUV420.
$ ffmpeg -i tmp.yuv -vcodec libx264 t1.mp4
Note: FFMPEG crashes when converting directly from AVI to H.264.

Summary for File 1:

CodecMJPEGYUVDirac (.DRC)
Dirac (.MKV)
H.264
File size (MB)
55.2
729.9
0.562
0.563
6.8
Compression ratio (x)
13.22
1
1297.8
1294.4
107.3

But that's not the whole story. The quality of the Dirac video is so bad...because I used libschroedinger.

Here's the results for File 2, using libdirac switch:

CodecMJPEG
YUV
Dirac (.DRC)H.264(.MP4)
File size (MB)
47.0
1891.1
3.4
8.1
Compression ratio (x)
40.2
1
556.2
233.5

Suddenly, Dirac doesn't look so bad.

No comments:

Post a Comment