Merge two MPEG-TS streams with higher bitrate
Rafal Garbat
garbbraf at gmail.com
Mon Sep 23 11:42:18 UTC 2019
Hm, I almost got my example working with the pipeline:
*`gst-launch-1.0 -e mpegtsmux bitrate=51253960 name=mux ! filesink
location=out.ts filesrc location=in.ts ! tsdemux emit-stats=true
name=demux \demux. ! mpegvideoparse ! queue ! mux. \demux. !
mpegaudioparse ! queue ! mux. \demux. ! mpegaudioparse ! queue ! mux. \*
*demux. ! 'subpicture/x-dvb' ! dvbsuboverlay enable=true name=r! queue !
mux.`*
except the subtitles - when I added this subpipe my pipeline stucks in
PREROLLING state. Is that something related to queues being out of sync?
Regards
pon., 23 wrz 2019 o 11:51 Rafal Garbat <garbbraf at gmail.com> napisał(a):
> Hi Mathieu.
>
> Thank you very much. This got me process further.
> One more question: is there a appropriate (all -in-one) video and audio
> parser to use without pads naming (I use `mpegvideoparse`, but - as
> expected - I got only video stream)?
>
> BR,
> Rafal
>
> śr., 18 wrz 2019 o 19:21 Mathieu Duponchelle <mathieu at centricular.com>
> napisał(a):
>
>> tsdemux doesn't number its pads starting from 0, instead it names them
>> according to
>> the PID of the streams. From the command line you can get away with not
>> explicitly
>> naming the pads:
>>
>> demux. ! <parser> ! queue ! mux.
>>
>>
>> The parser is necessary for most stream types because mpegtsmux expects
>> parsed streams, check the output of gst-inspect-1.0 mpegtsmux .
>>
>> If you need to transmux TS files containing arbitrary streams, you should
>> definitely
>> write an application. You don't have to write it in C however, python and
>> rust are
>> also options.
>>
>> --
>> Mathieu Duponchelle · https://www.centricular.com
>>
>> On 9/18/19 6:54 PM, Rafal Garbat wrote:
>>
>> Hi Mathieu.
>>
>> Thank you for the quick anwer.
>> The content of the ts file is as follows:
>> container: MPEG-2 Transport Stream
>> audio: MPEG-1 Layer 2 (MP2)
>> subtitles: DVB subtitles
>> audio: MPEG-1 Layer 2 (MP2)
>> video: MPEG-2 Video (Main Profile)
>>
>> I have tried the example you gave, but I'm getting errors like:
>> ```
>> WARNING: from element /GstPipeline:pipeline0/GstTSDemux:demux: Delayed
>> linking failed.
>> Additional debug info:
>> ./grammar.y(510): gst_parse_no_more_pads ():
>> /GstPipeline:pipeline0/GstTSDemux:demux:
>> failed delayed linking pad sink_0 of GstTSDemux named demux to some pad
>> of GstQueue named queue0
>> ```
>>
>> Is that related to wrong parser I was using (mpegvideoparse) ? Do I
>> really need to parse it before remuxing?
>>
>> Additionally, the example TS file is just for a testing purposes, in a
>> real world I'll be getting MPEG-TS without a priori knowledge what kind of
>> streams are there, therefore a static pipeline won't do the trick here. Is
>> the only way to dynamically connect a parsers (if they are needed) to write
>> an app with adding pad ad hoc as the type of stream is know?
>>
>> Regards,
>> R
>>
>>
>> śr., 18 wrz 2019 o 18:15 Mathieu Duponchelle <mathieu at centricular.com>
>> napisał(a):
>>
>>> mpegtsmux now has support for CBR as you've noticed (the bitrate
>>> property), so
>>> it should simply be a matter of remuxing the input file indeed.
>>>
>>> If you want to do this from the command line, the command line will need
>>> to
>>> match the streams contained in your input file, so it's not possible for
>>> us to
>>> give you a working pipeline :)
>>>
>>> It should more or less look like:
>>>
>>> mpegtsmux bitrate=<bitrate> name=mux ! filesink location=<path> filesrc location=<path> ! tsdemux name=demux \
>>>
>>> demux.sink_%d ! <parser> ! queue ! mux.
>>>
>>> <repeat above for every stream in the input file>
>>>
>>>
>>> --
>>> Mathieu Duponchelle · https://www.centricular.com
>>>
>>> On 9/18/19 5:58 PM, Rafal Garbat wrote:
>>>
>>> Hi.
>>>
>>> I'm quite new to GStreamer. I have an input MPEG-TS stream with a low
>>> bitrate. I need to stuff it with NULL packets to make it higher (of course
>>> all the data like PCR must be adjusted).
>>>
>>> 1. I was thinking about merging my original stream with the one, filled
>>> with null packets, but with target bitrate. Is there as some
>>> straightforward solution for that? I was thinking about something like:
>>> filesrc location=in.ts ! ...some magic here... ! mpegtsmux
>>> bitrate=51253960 ! filesink location=out.ts
>>> I have tried some variations but couldn't setup a working pipeline so
>>> far.
>>>
>>> 2. Maybe there is a simpler and obvious solution I'm missing here.
>>>
>>> BR,
>>> Rafal
>>>
>>> _______________________________________________
>>> gstreamer-devel mailing listgstreamer-devel at lists.freedesktop.orghttps://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>>
>>> _______________________________________________
>>> gstreamer-devel mailing list
>>> gstreamer-devel at lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>>
>> _______________________________________________
>> gstreamer-devel mailing listgstreamer-devel at lists.freedesktop.orghttps://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190923/ca2b3949/attachment-0001.html>
More information about the gstreamer-devel
mailing list