[gstreamer-bugs] [Bug 638288] New: flvdemux: add property to toggle CTS offset in timestamp calculation

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Wed Dec 29 09:02:45 PST 2010


https://bugzilla.gnome.org/show_bug.cgi?id=638288
  GStreamer | gst-plugins-good | git

           Summary: flvdemux: add property to toggle CTS offset in
                    timestamp calculation
    Classification: Desktop
           Product: GStreamer
           Version: git
        OS/Version: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-plugins-good
        AssignedTo: gstreamer-bugs at lists.sourceforge.net
        ReportedBy: jonas at hallerud.se
         QAContact: gstreamer-bugs at lists.sourceforge.net
      GNOME target: ---
     GNOME version: ---


Created an attachment (id=177199)
 View: https://bugzilla.gnome.org/attachment.cgi?id=177199
 Review: https://bugzilla.gnome.org/review?bug=638288&attachment=177199

diff describing my changes to solve the issue

After upgrading gst + plugins remuxing flv -> mp4 is now broken and I have
traced the issue to the added CTS offset code in flvdemux.

The current code correctly calculates PTS using embedded CTS offsets, which is
great for playback but not for remuxing. When remuxing I want DTS set on the
buffers, not PTS. If buffers are stamped with PTS, they arrive out of order to
the downstream muxer if video is AVC/H264 with B-frames. That's not really good
when using for example the gst qtmux element.

I solved this by adding a new property on flvdemux and I wanted to share my
solution.

What I want to do:
gst-launch filesrc location=in.flv ! flvdemux ! queue !
video/x-h264,width=640,height=360 ! qtmux ! filesink location=out.mp4

What I get:
ERROR: from element /GstPipeline:pipeline0/GstQTMux:qtmux0: Could not multiplex
stream.
Additional debug info:
gstqtmux.c(2186): gst_qt_mux_add_buffer ():
/GstPipeline:pipeline0/GstQTMux:qtmux0:
Received buffer without timestamp/duration.

Problem is illustrated by (fakesink output reformatted for clarity):
gst-launch -v filesrc location=in.flv ! flvdemux ! queue !
video/x-h264,width=640,height=360 ! fakesink num-buffers=5

chain timestamp: 0:00:00.040000000, duration: none
chain timestamp: 0:00:00.120000000, duration: none
chain timestamp: 0:00:00.080000000, duration: none
chain timestamp: 0:00:00.200000000, duration: none
chain timestamp: 0:00:00.160000000, duration: none

Note the out of order timestamps due to B-frames.

With my changes:
gst-launch -v filesrc location=in.flv ! flvdemux avc-cts=false ! queue !
video/x-h264,width=640,height=360 ! fakesink num-buffers=10

chain timestamp: 0:00:00.000000000, duration: none
chain timestamp: 0:00:00.040000000, duration: none
chain timestamp: 0:00:00.080000000, duration: none
chain timestamp: 0:00:00.120000000, duration: none
chain timestamp: 0:00:00.160000000, duration: none

Timestamps are now monotonically increasing and I can go on remuxing my file:
gst-launch filesrc location=in.flv ! flvdemux avc-cts=false ! queue !
video/x-h264,width=640,height=360 ! qtmux ! filesink location=out.mp4

out.mp4 plays back fine on all players I have tested, including gst.

avc-cts defaults to TRUE so this change will not break playback of AVC videos
but enables easy remuxing if set to false.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.




More information about the Gstreamer-bugs mailing list