[FFmpeg-devel] Problem with DVD VOB encoding - NAV packets not included properly.

Neil Brown neilb
Sun Jul 15 08:09:49 CEST 2007

 I've been working with kdenlive (which uses the MLT framework which
 uses the ffmpeg libraries) to make a DVD and found that the VOB
 created does not have the correct NAV packets.
 This shows up when I run dvdauthor as it cannot find places to put
 chapter links, and when viewing the DVD on a DVD player as
 fast-forward and rewind don't work properly.

 The "dvd" format is being requested by kdenlive, but the NAV packets
 don't get produced - well to be fair, a 22 minute VOB had 6 NAV
 packets rather than the expected 2600 odd.

 I looked through the code and found that in libavformat/mpegenc.c, in
 mpeg_mux_write_packet, towards the end, is this code fragment:

    if (s->is_dvd){
        if (is_iframe && (s->packet_number == 0 || (pts - stream->vobu_start_pts >= 36000))) { // min VOBU length 0.4 seconds (mpucoder)
            stream->bytes_to_iframe = av_fifo_size(&stream->fifo);
            stream->align_iframe = 1;
            stream->vobu_start_pts = pts;
        } else {
            stream->align_iframe = 0;

 If I remove the assignment of 0 to align_iframe in the 'else' clause,
 the code appears to work.  i.e. I get lots of NAV packets, dvdauthor
 correctly sets all of the chapter points, and FF/REW works properly
 in my DVD player.

 I confess that I only have a shallow understanding of this code, and
 it could be that my change has some unintended consequences.  I would
 appreciate if it someone more familiar with the code would check if
 this is an appropriate change and hopefully get the problem fixed.

 I am quite happy to test any alternate changes to make sure they
 still do the right thing on my files if that will help.

 (Yes, I have checked current SVN code).


More information about the ffmpeg-devel mailing list