qtmux throws away first incoming buffer?

Paul Stuart paul_stuart at seektech.com
Tue Jan 24 13:24:01 PST 2012


Hi,
When I record an H.264 video and mux it using mp4mux (from 
plugins-good-0.10.30/gst/isomp4), on playback VLC gives me the following 
warning:

[00000292] main input debug: `testMeVideo.mp4' successfully opened
[00000304] mp4 demuxer debug: track[Id 0x1] using Sync Sample Box (stss)
[00000304] mp4 demuxer debug: stts gives 1 --> 0 (sample number)
[00000304] mp4 demuxer debug: track[Id 0x2] does not provide Sync Sample 
Box (stss)
[00000306] ffmpeg decoder warning: AVC: Consumed only 90 bytes instead 
of 11574
 (h264 at 0x848d7f0)
[00000306] ffmpeg decoder warning: AVC: nal size -298012672
 (h264 at 0x848d7f0)
[00000306] ffmpeg decoder warning: no frame!
 (h264 at 0x848d7f0)
[00000306] ffmpeg decoder warning: cannot decode one frame (11578 bytes)
[00000306] ffmpeg decoder warning: AVC: Consumed only 90 bytes instead 
of 11574
 (h264 at 0x848d7f0)
[00000306] ffmpeg decoder warning: AVC: nal size -298012672
 (h264 at 0x848d7f0)
[00000306] ffmpeg decoder warning: no frame!
 (h264 at 0x848d7f0)
[00000306] ffmpeg decoder warning: cannot decode one frame (11578 bytes)
[00000338] faad decoder warning: decoded zero sample
[00000306] ffmpeg decoder warning: warning: first frame is no keyframe
 (h264 at 0x848d7f0)


So, no keyframe.

Digging into the plugin code, in gstqtmux.c...

At the top of gst_qt_mux_add_buffer, we have this little snip:

  last_buf = pad->last_buf;
  if (G_UNLIKELY (qtmux->dts_method == DTS_METHOD_REORDER)) {
    buf = gst_qt_mux_get_asc_buffer_ts (qtmux, pad, buf);
    if (!buf && !last_buf) {
      GST_DEBUG_OBJECT (qtmux, "no reordered buffer");
      return GST_FLOW_OK;
    }
  }

  if (last_buf == NULL) {
#ifndef GST_DISABLE_GST_DEBUG
    if (buf == NULL) {
      GST_DEBUG_OBJECT (qtmux, "Pad %s has no previous buffer stored and "
          "received NULL buffer, doing nothing",
          GST_PAD_NAME (pad->collect.pad));
    } else {
      GST_LOG_OBJECT (qtmux,
          "Pad %s has no previous buffer stored, storing now",
          GST_PAD_NAME (pad->collect.pad));
    }
#endif
    pad->last_buf = buf;
    goto exit;
  } else
    gst_buffer_ref (last_buf);



It looks to me that we *always* throw away the first buffer coming in 
since there is no last_buf yet. Since the first frame I encode is my IDR 
frame, and it gets tossed, I reckon that this would be the reason VLC is 
whining about no keyframe.


Am I barking up the right tree here? I want to ask before I start 
hacking the plugin since this seems fundamental, and qtmux has been 
around for a while, so I'm guessing I must be missing something.

Any insight would be appreciated.

Thanks,
Paul






More information about the gstreamer-devel mailing list