Changing the container format.

Sameer Naik sameer.subscriptions at damagehead.com
Mon Jun 6 06:28:52 PDT 2011


Hello,

I am writing an application to change the container format of a media
stream from flv -> mpegts, matroska, etc. I understand how i should go
about building the pipeline i began testing sample pipelines using the
very handy gst-launch utility.

My input stream is an FLV file having h.264 video and mpeg2 audio. My
ultimate task is to simply change the container format while keeping
the encoded audio and video streams the same. So i constructed the
pipeline as follows:

gst-launch filesrc location=infile.flv ! flvdemux name=demux !
video/x-h264 ! queue ! matroskamux name=mux ! queue ! filesink
location=outfile.mkv  demux. ! audio/mpeg ! queue ! mux.

This sample pipeline would not work and gst-launch is stuck at
"pipeline is pre-rolling message". If i change the pipeline so that
only one stream is contained within the container format, everything
is file. i.e:

gst-launch filesrc location=infile.flv ! flvdemux name=demux !
video/x-h264 ! queue ! matroskamux name=mux ! queue ! filesink
location=outfile.mkv
OR
gst-launch filesrc location=infile.flv ! flvdemux name=demux !
audio/mpeg ! queue ! matroskamux name=mux ! queue ! filesink
location=outfile.mkv

The other multiplexers i tested with were, mpegtsmux and avimux. Each
of these behave similarly.

I went ahead and translated this pipeline into a gstreamer
application. Here what i did:

Create a pipeline with filesrc -> queue -> flvdemux  and an unlinked
bin called encodebin with mpegtsmux -> queue -> udpsink
I registered callbacks for the the pad-added and no-more-pads signals
and set the pipeline to PAUSED state.

Whenever a "pad-added" callback is called, a queue is added to the
encodebin, linked to the mpegtsmux plugin. A ghost pad is added to the
encodebin and the elements are linked.

When no-more-pads signal is received is put the pipeline in the PLAYING state.

But the application behave the same way as the gst-launch utility. If
only one stream (audio/video) is linked in the "pad-added" callback
then the application works. But if both audio and video are linked
then the whole application just gets stuck. I tried, tried and tried a
lot of things, nothing seems to work! Looks like i am making some huge
mistake (can't figure it out though).

I would like to know if i am missing something in the construction of
the pipeline or not doing the right things.
Any help would be greatly appreciated.

Thanks and Regards
~Sameer


More information about the gstreamer-devel mailing list