[FFmpeg-devel] BUG? interlaced encoding using libx264, nal-hrd

Erik Slagter erik at slagter.name
Fri Jun 24 12:27:10 CEST 2011


Before I start diving into this really deep, I'd like
your comments on this. Maybe some of you can fix it
really easy or give directions of how to address it

This is the issue. If you're going to encode interlaced
material using ffmpeg/libx264, you're going to need
to jump through quite few loops to get it working. And
at the very last step, it fails.

IIRC you need to use -flags +ildct+ilme to enable
interlacing (also for libx264), -x264opts "tff=1"
doesn't seem to work. But that's a minor issue.

Interlaced encoding using libx264 is exactly that,
it enables mbaff, but doesn't signal the stream is
interlaced (at least not in a way that any of my
soft- and hardware players recognise it as being

For that you need to use the "nal-hrd" option of
libx264. And for that, you need to set vbv parameters.
A bit odd but fair enough. Tested with the x264 cli
and indeed, that does the trick.

If you try it using ffmpeg, with these parameters
(some skipped), you'll get an error.

ffmpeg [.. ] -i test.avi [ .. ] -flags +ildct+ilme -r 25
  -profile high -preset veryslow -vcodec libx264
  -x264opts level=40:aud=1:keyint=100:ref=4:nr=1000:\
:weightp=0 [ .. ] -f mpegts test_tmp.ts

[libx264 @ 0x10e77a0] VBV parameters cannot be changed when NAL HRD is in use

The source of the problem seems to be in libx264.c,
around line 118. Apparently the interlacing parameters
are set on a frame-by-frame basis, which libx264 doesn't
like when nal-hrd is active.

Is there a simple solution / approach to this?

I will do some testing in the meantime if this
error is actually harmful, or that all parameters
are already set correctly at this point.


-------------- 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://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110624/03dbd66d/attachment.p7s>

More information about the ffmpeg-devel mailing list