Changing the container format.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Changing the container format.

Sameer Naik
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
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Changing the container format.

Sameer Naik
FYI,

I am using the latest releases of gstreamer.

flvdemux would not link to mpegtsmux because of the bytestream=avc on
the caps. To make it link it removed the caps bytestream property from
the flvdemux src caps.

Thanks and Regards
~Sameer

On Mon, Jun 6, 2011 at 6:58 PM, Sameer Naik
<[hidden email]> wrote:

> 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
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Changing the container format.

Sameer Naik
Ok,
I was able to get the encode working with mpegtsmux only by specifying
the queue limits.

gst-launch filesrc location=infile.flv ! flvdemux name=demux !
video/x-h264 ! queue max-size-buffers=0 max-size-time=0
max-size-bytes=5242880 ! matroskamux name=mux ! queue ! filesink
location=outfile.mkv demux. ! audio/mpeg ! queue max-size-buffers=0
max-size-time=0 max-size-bytes=262114 ! mux.

There won't be any sync though.

Regards
~Sameer

On Mon, Jun 6, 2011 at 7:22 PM, Sameer Naik
<[hidden email]> wrote:

> FYI,
>
> I am using the latest releases of gstreamer.
>
> flvdemux would not link to mpegtsmux because of the bytestream=avc on
> the caps. To make it link it removed the caps bytestream property from
> the flvdemux src caps.
>
> Thanks and Regards
> ~Sameer
>
> On Mon, Jun 6, 2011 at 6:58 PM, Sameer Naik
> <[hidden email]> wrote:
>> 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
>>
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel