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

Thomas Worth dev at rarevision.com
Fri Jun 24 12:36:52 CEST 2011


On Fri, Jun 24, 2011 at 3:27 AM, Erik Slagter <erik at slagter.name> wrote:
> Hi,
>
> 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
> beforehand.
>
> 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
> interlaced).
>
> 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:\
> bframes=8:threads=16:vbv-bufsize=31250:\
> vbv-maxrate=25000:nal-hrd=vbr:crf=24:tff=1\
> :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.

Have you tested this using standalone x264? Perhaps it's a problem
with FFmpeg's parameters sent to libx264.


More information about the ffmpeg-devel mailing list