Deinterlacing 1080i videos

I bought our video camera, a Sony HDR-CX305, in the faith that it can record "Full HD" video. The format has been dubbed "AVCHD" by Sony and the videos are stored in .MTS, acronym for "MPEG-2 Transport Stream".

What I, very unfortunately, did not know/see/recognize when buying the camera is that the "Full HD" that the camera promises is not real Full HD. Near the end of the "technical data" page is the following text:

Video Quality: HD; FX (1920 x 1080i, 24 Mb/s)/FH (1920 x 1080i, 16 Mb/s)/HQ (9 Mb/s)/LP (5 Mb/s), SD; HQ (9 Mb/s)

The table also says:

Video format: High Definition, AVCHD (1920 x 1080, 1440 x 1080)/Default resolution, MPEG2

The camcorder only has a horizontal resolution of 1440 pixels, not 1920. To overcome that limitation, the camera defines a pixel to be rectangular and not quadratic.

Now if we combine the information with what we know after trying out:

Type Quality Resolution Real resolution Fields per second Frames per second Bitrate
HDFX1920 x 1080i1440 x 540502524 Mb/s
HDFH1920 x 1080i1440 x 540502516 Mb/s
HDHQ1920 x 1080i1440 x 54050259 Mb/s
HDLP1920 x 1080i1440 x 54050255 Mb/s
SDHQ720 x 576i720 x 28850259 Mb/s

So, 1440 x 540 it is. That's supposed to be Full HD? It's less than half of the real Full HD resolution (1080p50)!

In the end I had to deinterlace all of the videos.

VLC

I tried all of VLC's deinterlacing filters and found Yadif (2x) to give the best results with quick camera movements (panning shots).

VLC offers a command line conversion mode that can be used to quickly transform (demux) all video files from the camera to nicely deinterlaced movie files. Or so I thought.

Very very unfortunately for me, VLC has a bug that results in missing video when converting .mts files, which makes VLC unusable for me.

ffmpeg

After VLC I tried mencoder, but failed to find a good deinterlacing mode.

HandBrake also sucked very much; their deinterlacing modes were equally bad (yep, I tried them all).

After I had given up and was putting up with HandBrake's bad deinterlacing, I finally used the correct search terms with $searchengine and found the solution, which gives me awesome smoooooooooth deinterlaced videos:

$ ffmpeg -i in.MTS -vf yadif=1 -acodec ac3 -ab 192k -vcodec mpeg4 -f mp4 -y -sameq out.mp4

The interesting option here is =1 after -vf yadif: It generates a full frame for each field, which means 50 fps in the resulting movie. A standard -vf yadif (which implies =0) gives you 25 fps only, which was laggy on some scenes here.

I know now that mencoder also supports yadif=1. Oh, and using -acodec copy resulted in broken/unsynced audio for me.

Written by Christian Weiske.

Comments? Please send an e-mail.