<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Ross,<div><br></div><div>I now have 2 file sinks, one QuickTime (using MP4 format) and one MPEG2-TS, working with the source of both being the video subsession of my MediaSession object. The QuickTime files are playing on VLC just fine, but the MPEG2-TS files seem to be missing the TS header, especially the sync byte 0x47. I made sure to follow the order of events described in your previous email, below is a simplified version of my code with only the relevant sections.</div><div><br></div><div><div>static MPEG2TransportStreamFromESSource* tsFrames;</div><div>static MediaSink* TS_Sink;</div><div>static H264VideoStreamDiscreteFramer* framer;</div><div>static FramedSource* streamMP4;</div><div>static FramedSource* streamTS = NULL;</div><div>static FramedSource* source;</div><div>static StreamReplicator* replicator;</div></div><div> ........</div><div><div>MediaSubsessionIterator iter(*session);</div><div>MediaSubsession *subsession;</div></div><div> ........</div><div>source = subsession->readSource();<br></div><div><div>replicator = StreamReplicator::createNew(*env, source, false);</div><div>streamMP4 = replicator->createStreamReplica();</div><div>streamTS = replicator->createStreamReplica();</div><div><br></div><div>subsession->addFilter((FramedFilter*) streamMP4);<br></div><div><br></div><div>framer = H264VideoStreamDiscreteFramer::createNew(*env, streamTS);</div><div>tsFrames = MPEG2TransportStreamFromESSource::createNew(*env);<br></div><div>tsFrames->addNewVideoSource(framer, 5);</div></div><div><div> ........ </div><div>while(true) {</div><div><div> TS_Sink = FileSink::createNew(*env, uniqueFileName);</div></div></div><div><div> TS_Sink->startPlaying(*streamTS, NULL, NULL);</div></div><div> sleep(2) // Continuous output of files with 2 seconds of video each</div><div><div> TS_Sink->stopPlaying()</div><div> Medium::close(TS_Sink)</div></div><div>}</div><div><br></div><div>Thanks,</div><div>Chris</div><div><br></div><div><br></div><div><br></div></div></div></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 22, 2019 at 5:16 PM Ross Finlayson <<a href="mailto:finlayson@live555.com">finlayson@live555.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">You seem to be on the right track (though I can’t address whatever specific problems you are having, because the word “issues” isn’t very descriptive :-)<br>
<br>
It’s important to do things in the right order, specifically:<br>
1/ Call “initiate()” on your “MediaSubsession” object (to create RTP source objects)<br>
2/ Call<br>
StreamReplicator* streamReplicator = StreamReplicator::createNew(env, mediaSubsession->.readSource())<br>
to create a replicator object.<br>
3/ Call<br>
FramedSource* replica1 = streamReplicator->createStreamReplica();<br>
FramedSource* replica2 = streamReplicator->createStreamReplica();<br>
4/ Call<br>
mediaSubsession->addFilter(replica1);<br>
to tell the downstream “QuickTimeFileSink” object (to be created next) to read from the (first) replica.<br>
5/ Call<br>
QuickTimeFileSink::createNew()<br>
on your “MediaSubsession” object.<br>
6/ Create appropriate filter(s) and sink for creating a Transport Stream from “replica2”. This will be similar to the code in “testH264VideoToTransportStream.cpp”, ***except that*** you must use a “H264VideoStreamDiscreteFramer” rather than a “H264VideoStreamFramer”. (This is because your input source (“replica2” in this case) will be a sequence of discrete H.264 NAL units, rather than an unstructured byte stream (e.g., from a file.)<br>
7/ Call “startPlaying()” on each of your sinks (the “QuickTimeFileSink” that you created in step 5/, and the sink (“FileSink”?) that you created in step 6/.<br>
<br>
<br>
Ross Finlayson<br>
Live Networks, Inc.<br>
<a href="http://www.live555.com/" rel="noreferrer" target="_blank">http://www.live555.com/</a><br>
<br>
<br>
_______________________________________________<br>
live-devel mailing list<br>
<a href="mailto:live-devel@lists.live555.com" target="_blank">live-devel@lists.live555.com</a><br>
<a href="http://lists.live555.com/mailman/listinfo/live-devel" rel="noreferrer" target="_blank">http://lists.live555.com/mailman/listinfo/live-devel</a><br>
</blockquote></div></div>