<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal">     I’m trying to extract multiple elementary streams (belonging to different programs) from a transport stream simultaneously.<o:p></o:p></p>
<p class="MsoNormal">Currently I can only get this to work by adding a tee element and connecting a separate tsdemux for each program. Is this the only way? It seems an unnecessary complication.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If I run a pipeline like:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">GST_DEBUG=6 gst-launch-1.0 -v filesrc location=foo.ts ! tsdemux name=demux  demux.audio_0_006a ! mpegaudioparse ! mpg123audiodec ! audioresample ! audio/x-raw, rate=8000 ! wavenc ! filesink location=audio1.wav 2>&1 | grep "creating pad"
 | grep audio | tee audiopads<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">It looks like the tsdemux element provides pads for all the audio streams:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">GST_DEBUG=6 gst-launch-1.0 -v filesrc location=foo.ts ! tsdemux name=demux  demux.audio_0_006a ! mpegaudioparse ! mpg123audiodec ! audioresample ! audio/x-raw, rate=8000 ! wavenc ! filesink location=audio1.wav 2>&1 | grep "creating pad"
 | grep audio | tee audiopads2<o:p></o:p></p>
<p class="MsoNormal">0:00:01.284886317 28409 0x5643c2334320 LOG                  tsdemux tsdemux.c:1594:create_pad_for_stream: stream:0x7fae8c00cd00 creating pad with name audio_0_0066 and caps audio/mpeg, mpegversion=(int)1<o:p></o:p></p>
<p class="MsoNormal">0:00:01.285548634 28409 0x5643c2334320 LOG                  tsdemux tsdemux.c:1594:create_pad_for_stream: stream:0x7fae8c00ef10 creating pad with name audio_0_006a and caps audio/mpeg, mpegversion=(int)1<o:p></o:p></p>
<p class="MsoNormal">0:00:01.295740367 28409 0x5643c2334320 LOG                  tsdemux tsdemux.c:1594:create_pad_for_stream: stream:0x7fae8c09eb80 creating pad with name audio_1_00ca and caps audio/mpeg, mpegversion=(int)1<o:p></o:p></p>
<p class="MsoNormal">[snip]<o:p></o:p></p>
<p class="MsoNormal">0:00:01.316647548 28409 0x5643c2334320 LOG                  tsdemux tsdemux.c:1594:create_pad_for_stream: stream:0x7fae8c0b5400 creating pad with name audio_1_0044 and caps audio/mpeg, mpegversion=(int)1<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">So it <i>looks</i> like a single tsdemux can be used to get at all the elementary streams.<o:p></o:p></p>
<p class="MsoNormal">However, when I try to do this programmatically I find I only get the elementary streams
<o:p></o:p></p>
<p class="MsoNormal">for a single program as if the program_number property is set (explicitly setting it to -1 does not help).<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Similarly from the command line I’d like to do something like:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">gst-launch-1.0 -v filesrc location=foo.ts ! tsdemux name=demux \<o:p></o:p></p>
<p class="MsoNormal">demux.audio_0_0066 ! queue ! mpegaudioparse ! mpg123audiodec ! audioresample ! audio/x-raw, rate=8000 ! wavenc ! filesink location=audio1.wav \<o:p></o:p></p>
<p class="MsoNormal">demux.audio_1_00ca ! queue ! mpegaudioparse ! mpg123audiodec ! audioresample ! audio/x-raw, rate=8000 ! wavenc ! filesink location=audio2.wav<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Which fails as follows:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">WARNING: from element /GstPipeline:pipeline0/GstTSDemux:demux: Delayed linking failed.<o:p></o:p></p>
<p class="MsoNormal">Additional debug info:<o:p></o:p></p>
<p class="MsoNormal">./grammar.y(506): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstTSDemux:demux:<o:p></o:p></p>
<p class="MsoNormal">failed delayed linking pad  audio_1_00ca of GstTSDemux named demux to some pad of GstQueue named queue1<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Bruce.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<br>
<a href="http://www.kantar.com/disclaimer.html">Kantar Disclaimer</a>
</body>
</html>