[gst-devel] Extract video packets from media file using playbin problem

Qin Chen eric.qin.chen at gmail.com
Wed Jun 3 03:07:45 CEST 2009


Hi,

Basically I am interested in using playbin to extract video packets from a
media file.

I have replaced the video decoder element in decodebin by a identity
element, to bypass the video decoding process. I also modified playbin such
that the colorspace, videoscale, and videosink are replaced by a filesink,
to save the extracted video packets into a file. I was able to extract video
packets and save them into a file. However, there are two problems:

1. using an mpeg-4 video file (only contains video stream, and encoded by
ffmpeg) as the input, the output file size is smaller than that of the
input. I would expect they have the same file size since the input only
contains video stream (ffmpeg shows there is no muxing overhead).  And the
output file is not decodable by neither gstreamer nor ffplay. As another
test, I use an avi file as the input. It has both video and audio streams.
Video is encoded in H.264. The output file size is smaller than that of the
input as expected. And interestingly, the output file, which is basically an
H.264 bitstream, is decodable by ffplay, but not by gstreamer. My question
is: could this be a threading problem since the new "playback" is much
faster than normal decode + display process? And how to solve (or
investigate) this?

2. verbose output shows that the offset and offset_end of identity element
in decodebin seem to be wrong (shown below). Also it seems that the
"playback" already starts before "Setting pipeline to PLAYING". I am not
sure if this is normal since I know little about the lower level threading
within gstreamer.

partial verbose output for a mpeg-4 video sequence "playback" is shown here:
/GstPlayBin:playbin0/GstBin:vbin.GstGhostPad:sink.GstProxyPad:proxypad2:
caps = video/mpeg, mpegversion=(int)4, systemstream=(boolean)false,
codec_data=(buffer)000001b001000001b58913000001000000012000c48d8800cd0b04241463000001b24c61766335322e32302e30,
width=(int)352, height=(int)288, framerate=(fraction)25/1
/GstPlayBin:playbin0/GstDecodeBin:decodebin0/GstIdentity:identity0:
last-message = "chain   ******* (identity0:sink)i (1230 bytes, timestamp:
0:00:00.320000000, duration: 0:00:00.040000000, offset: -1, offset_end: -1,
flags: 256) 0x839ae30"
/GstPlayBin:playbin0/GstBin:vbin/GstFileSink:vfsink.GstPad:sink: caps =
video/mpeg, mpegversion=(int)4, systemstream=(boolean)false,
codec_data=(buffer)000001b001000001b58913000001000000012000c48d8800cd0b04241463000001b24c61766335322e32302e30,
width=(int)352, height=(int)288, framerate=(fraction)25/1
/GstPlayBin:playbin0/GstDecodeBin:decodebin0/GstIdentity:identity0:
last-message = "chain   ******* (identity0:sink)i (1282 bytes, timestamp:
0:00:00.360000000, duration: 0:00:00.040000000, offset: -1, offset_end: -1,
flags: 256) 0x839ae80"
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
/GstPlayBin:playbin0/GstDecodeBin:decodebin0/GstIdentity:identity0:
last-message = "chain   ******* (identity0:sink)i (1153 bytes, timestamp:
0:00:00.400000000, duration: 0:00:00.040000000, offset: -1, offset_end: -1,
flags: 256) 0x839aed0"
/GstPlayBin:playbin0/GstDecodeBin:decodebin0/GstIdentity:identity0:
last-message = "chain   ******* (identity0:sink)i (1287 bytes, timestamp:
0:00:00.440000000, duration: 0:00:00.040000000, offset: -1, offset_end: -1,
flags: 256) 0x83866f0"
/GstPlayBin:playbin0/GstDecodeBin:decodebin0/GstIdentity:identity0:
last-message = "chain   ******* (identity0:sink)i (16000 bytes, timestamp:
0:00:00.480000000, duration: 0:00:00.040000000, offset: -1, offset_end: -1,
flags: 0) 0x8386600"
/GstPlayBin:playbin0/GstDecodeBin:decodebin0/GstIdentity:identity0:
last-message = "chain   ******* (identity0:sink)i (1432 bytes, timestamp:
0:00:00.520000000, duration: 0:00:00.040000000, offset: -1, offset_end: -1,
flags: 256) 0x83865b0"
New clock: GstSystemClock
/GstPlayBin:playbin0/GstDecodeBin:decodebin0/GstIdentity:identity0:
last-message = "chain   ******* (identity0:sink)i (2095 bytes, timestamp:
0:00:00.560000000, duration: 0:00:00.040000000, offset: -1, offset_end: -1,
flags: 256) 0x8386560"
/GstPlayBin:playbin0/GstDecodeBin:decodebin0/GstIdentity:identity0:
last-message = "chain   ******* (identity0:sink)i (2781 bytes, timestamp:
0:00:00.600000000, duration: 0:00:00.040000000, offset: -1, offset_end: -1,
flags: 256) 0x8386510"


I am quite new to gstreamer. Hopefully some experts can give me some hints.
Thanks.

Regards,

Qin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20090602/4e085f21/attachment.htm>


More information about the gstreamer-devel mailing list