[FFmpeg-user] Duplicates frames when converting interlaced h264 to png frames and double length when converting interlaced .png to interlaced mp4

Mark Himsley mark at mdsh.com
Sun Nov 20 22:56:33 CET 2011

On 18/11/2011 21:39, Lionel Trésaugues wrote:
> Dear FFmpeg users,
> I am currently encountering two major problems during my video-editing
> process (I am running the 64bits edition of Ubuntu Linux 11.10). My
> camcorder (Panasonic HDC-SD60) shots 1080/50i (AVCHD in a mts
> container).
> First problem)
> I want, in a first step, to convert the .mts into a sequence of .png
> frames while preserving the interlacing.
> To do so, I used the following FFmpeg command-line:
> ffmpeg -i 00030.MTS -an -vcodec png -r 50 -flags +ilme+ildct+mv4+aic
> -top 1 -qscale 1 -s 1920x1080 -sameq 00030%05d.png
> Then for a 2min21sec long .mts movie, ffmpeg produces 7080 frames each
> of them clearly showing signs of interlacing (which was the expected
> result) (and 7080/50=2min21sec).
> But, indeed, two consecutive frames are absolutely identical (e.g
> frames 1 and 2 are identical, 3 and 4 are identical, 5 and 6, etc..)

I suspect you are mistaken in your thinking of what 1080/50i means.
Unless I am very much mistaken, and your description backs me up on 
this, your camera is actually shooting 25 interlaced frames per second. 
That is 50 interlaced fields per second, which is why some manufacturers 
write 50i. And since 50 is twice as many as 25 it's got to be better.

This really gets my goat. To quote Wikipedia, so it must be right:

The European Broadcasting Union (EBU) prefers to use the resolution and 
frame rate (not field rate) separated by a slash, as in 1080i/30 and 
1080i/25, likewise 480i/30 and 576i/25.[1] Resolutions of 1080i60 or 
1080i50 often refers to 1080i/30 or 1080i/25 in EBU notation.


So, try -r 25. I think that will give you 25 interlaced frames, each 
being unique.


> When I try to do the same process using avisynth and VirtualDub (on
> windows), while using this avisynth script :
> DirectShowSource("E:\00030.MTS").AssumeTFF().DoubleWeave()
> I, then obtain once again 7080 interlaced png frames but this time
> they all are different.
> So, first question, how would I be able to produce the same results
> with ffmpeg ?
> Second problem)
> Then, I want to convert the interlaced png frames (ideally after
> processing in Blender) and merge them with an audio track into a mp4
> container and still want to preserve the interlacing.
> I used the following command-line :
> ffmpeg -threads 2 -i %05d.png -i audio.aac -qscale 1 -vcodec mpeg4
> -acodec copy -minrate 0 -b 50000k -mbd 2 -trellis 2 -cmp 2 -subcmp 2
> -g 300 -r 50 -flags +ilme+ildct+mv4+aic -top 1 -f mp4 00030.mp4
> And I obtain a slow-motion interlaced movie which lasts twice the
> duration of the initial footage. The problem is the same whether I use
> the 7080 frames produced by ffmpeg (containing duplicates) or the 7080
> frames (without duplicates) produced by VirtualDub.
> How would I be able to use the sequence of .png frames to produce an
> interlaced movie (50i) in a mp4 container correctly ?
> Thanks a lot for your suggestions


More information about the ffmpeg-user mailing list