[Live-devel] Multiple File Sinks Issue

Chris Paucar chris.paucar at roc-connect.com
Mon Feb 25 14:10:06 PST 2019


Hi Ross,

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.

static MPEG2TransportStreamFromESSource* tsFrames;
static MediaSink* TS_Sink;
static H264VideoStreamDiscreteFramer* framer;
static FramedSource* streamMP4;
static FramedSource* streamTS = NULL;
static FramedSource* source;
static StreamReplicator* replicator;
         ........
MediaSubsessionIterator iter(*session);
MediaSubsession *subsession;
         ........
source = subsession->readSource();
replicator = StreamReplicator::createNew(*env, source, false);
streamMP4 = replicator->createStreamReplica();
streamTS = replicator->createStreamReplica();

subsession->addFilter((FramedFilter*) streamMP4);

framer = H264VideoStreamDiscreteFramer::createNew(*env, streamTS);
tsFrames = MPEG2TransportStreamFromESSource::createNew(*env);
tsFrames->addNewVideoSource(framer, 5);
         ........
while(true) {
  TS_Sink = FileSink::createNew(*env, uniqueFileName);
  TS_Sink->startPlaying(*streamTS, NULL, NULL);
  sleep(2) // Continuous output of files with 2 seconds of video each
  TS_Sink->stopPlaying()
  Medium::close(TS_Sink)
}

Thanks,
Chris




On Fri, Feb 22, 2019 at 5:16 PM Ross Finlayson <finlayson at live555.com>
wrote:

> 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 :-)
>
> It’s important to do things in the right order, specifically:
> 1/ Call “initiate()” on your “MediaSubsession” object (to create RTP
> source objects)
> 2/ Call
>         StreamReplicator* streamReplicator =
> StreamReplicator::createNew(env, mediaSubsession->.readSource())
>   to create a replicator object.
> 3/ Call
>         FramedSource* replica1 = streamReplicator->createStreamReplica();
>         FramedSource* replica2 = streamReplicator->createStreamReplica();
> 4/ Call
>         mediaSubsession->addFilter(replica1);
>    to tell the downstream “QuickTimeFileSink” object (to be created next)
> to read from the (first) replica.
> 5/ Call
>         QuickTimeFileSink::createNew()
>    on your “MediaSubsession” object.
> 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.)
> 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/.
>
>
> Ross Finlayson
> Live Networks, Inc.
> http://www.live555.com/
>
>
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20190225/2618ff2d/attachment.html>


More information about the live-devel mailing list