[Live-devel] PES to Transport Stream Framer

Ionut Cotoi icotoi at rolabs.com
Tue Jul 22 00:53:51 PDT 2008


Thanks for the quick response,
you are right. It seems that the filter 
MPEG2TransportStreamFromPESSource does not generate correct PCR data, as 
the ts file generated with the sample overflows vlc also. If I open the 
out.ts file with VLC , the messages window  fills with "main debug: 
waiting decoder fifos to empty" messages. Also, if i stream the ts file 
with testMpeg2TransportStreamFramer the result is the same, it sends 
with about 50Mbps instead of 6Mbps which is the correct bitrate. If I 
pass a ts file created with a third party muxer to  
testMpeg2TransportStreamFramer  it seems to work ok.


Regards,
Ionut Cotoi

Ross Finlayson wrote:
>> My problem is that instead of sending with the right bitrate, this 
>> will stream as fast as it can to the network
>
> When this happens, it's usually because your 'framer' object is not 
> able to compute the duration of each Transport Packet (and so, each 
> packet gets the default duration of 0).  The reason for this is 
> probably that your "MPEG2TransportStreamFramer" is not finding PCRs in 
> the Transport Stream data.
>
>> What I do is basically this:
>> {
>>    ByteStreamFileSource* fileSource
>>    = ByteStreamFileSource::createNew(*env, inputFileName);
>>  if (fileSource == NULL) {
>>    *env << "Unable to open file \"" << inputFileName
>>     << "\" as a byte-stream file source\n";
>>    exit(1);
>>  }
>>  MPEG2TransportStreamFromPESSource* tsFrames;
>>  MPEG2TransportStreamFramer* tsFramer;
>>    FramedSource* esVideoSource;
>>
>>    MPEG1or2Demux* baseDemultiplexor = MPEG1or2Demux::createNew(*env, 
>> fileSource);
>>
>>    MPEG1or2DemuxedElementaryStream *videoES = 
>> baseDemultiplexor->newRawPESStream();
>>
>>    tsFrames = MPEG2TransportStreamFromPESSource::createNew(*env, 
>> videoES);
>>
>>    tsFramer = MPEG2TransportStreamFramer::createNew(*env, tsFrames);
>
> This looks good. However, you should first try just converting the 
> Program Stream file into a Transport Stream file, e.g., using our 
> "testMPEG1or2ProgramToTransportStream" demo application (whose code 
> you have adapted).
>
> I.e., first try to generate a Transport Stream file from your Program 
> Stream file.  Then, try to stream that file.  That may give you some 
> insight into what is going wrong.



More information about the live-devel mailing list