[x264-devel] problem with interlaced encoding

Erik Slagter erik at slagter.name
Thu Jun 2 20:56:00 CEST 2011


Hi guys,

I am hesitant to ask my question here, but there doesn't seem to be a 
user-level-help mailing list.

I am currently re-encoding footage from a video camera (actually I tried 
two from different brands), the source is AVCHD 1080i25, h264 in a "mts" 
file.

Both my STB and my PS3 play these files fine, with nice, smooth motion.

Then I re-encode using libx264. In between the material has been 
transcoded to mjpeg for easy editing, but I don't believe that has any 
significance here.

I am using ffmpeg as front-end to libx264 as it a) can re-encode the ac3 
audio track to aac on the fly as well and b) last time I checked it 
worked faster than the x264 cli. I add "tff=1:weightp=0" to the libx264 
options and I also add -flags +ildct+ilme to ffmpeg, as it doesn't 
activate interlaced encoding by libx264, even though tff=1 is specified 
(bug? intentional?).

The result is indeed encoded with interlacing, checked by the tag in the 
h264 output (it says: interlaced=tff) and checked with mplayer -lavdopts 
debug=8 and some mb's are indeed flagged as "=".

But when played on the STB or the PS3, the result is horrible. When 
singlestepping the cause is evident: the fields are reversed, it shows 
as back-and-forth movement.

So then I tried specifying "bff" (although that is fundamentally wrong 
for 25/50 fps material imho) instead of "tff". The tag says "bff", so 
libx264 got my option. Result is still the same.

I am not sure where to search for the problem. I don't think ffmpeg does 
anything to the picture before handing it to libx264, so I guess that I 
have to search there. Can it be that libx264 outputs a flag in the h264 
output wrong, signifying wrong field order? I do not expect that libx264 
actually is going to switch the fields in a frame?

I have tried both mpeg transport streams and mp4 files as container, the 
problem appears in both, so I don't think some field order bit in there 
is reversed.

I hope I am making some sense here ;-)

I am now trying with the field order physically swapped using a filter, 
I'll update with the output when it's ready.

Much thanks for your attention.

Erik.

PS. both ffmpeg and x264 are from git of "today".

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5110 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20110602/f93a22ee/attachment.bin>


More information about the x264-devel mailing list