mp2t -> rtp woes

Chuck Crisler ccrisler at mutualink.net
Wed Jan 9 11:35:06 PST 2013


I am still not able to convert from an mp2t stream to an rtp stream using
gstreamer. VLC does it OK.

I am using gstreamer 0.10.30, good plugins 0.10.25 and bad plugins 0.10.20.
Regrettably I had to really work to get to that 'recent' version. :-(

First, I can capture video, H264 encode, mp2t and transmit over UPD to
another system, mp2t demux, h264 decode and display. Works fine. Same for
RTP.

I T'ed the mp2t mux output to a capture file and played that from a file
source on the display system. It properly displayed video but was about 10x
the correct speed.

I tried to capture video, H264 encode, mp2t and transmit over UPD, receive,
mp2t demux, rtppay, transmit over udp, receive, rtpdepay, h264decode,
display. I do get some video, but never a full screen (though the output
window is sized properly) and it updates erratically. It may freeze for
extended periods of time.

I repeated the former test but added an h264decode and h264encode between
the mp2t demux and the rtppay. That didn't work any differently.

I have captured logs from these tests. When the mp2t demux to h264 decode
works, I typically see the demux flush the buffer of 188 bytes about 23
times to trigger the decoder to decode what looks like a single frame.

In the failure case there are a couple of differences. First, it only
flushes the buffer ~3 times to trigger the h264 decoder (or the
rtppayloader). Second, all of those mp2t packets will have had adaption
fields, which none of the mp2t packets in the version that worked had.
Third, I have noticed that the ffmpeg h264 decoder (in the failure case)
complains about a non-existant PPS that was referenced. Obviously the
packet that the h264 decoder received was completely bogus. I ran this test
with the captured mp2t file that I also had tested for simple display, so I
have controlled for a single, standard and valid mp2t input stream.

It looks to me like something in the mp2t demuxer is being triggered by
downstream components to fail, which doesn't make sense and I don't see any
indication of anything like that in the logs.

Here is a version of my 'transmuxing' script reading from the file.

export GST_DEBUG=mpegtsdemux:5,ffmpeg:5
gst-launch filesrc location=TestMP2T.out ! mpegtsdemux ! video/x-h264 ! \
  rtph264pay pt=96 ! udpsink host=$2 port=$3


Here are log messages from mp2t demux processing for a typical mpt2 packet
in the success case.

0:00:00.464731978  5932  0x8662800 LOG    
         mpegtsdemux
gstmpegtsdemux.c:2252:gst_mpegts_demux_parse_stream:<mpegtsdemux0> afc
0x1, pusi 0, PID 0x0040 datalen 184
0:00:00.464755143  5932  0x8662800 LOG    
         mpegtsdemux
gstmpegtsdemux.c:2278:gst_mpegts_demux_parse_stream:<mpegtsdemux0>
Packet payload 184 bytes, PID 0x0040
0:00:00.464800865  5932  0x8662800 LOG    
         mpegtsdemux
gstmpegtsdemux.c:2404:gst_mpegts_demux_parse_stream:<mpegtsdemux0>
Elementary packet of size 184 for PID 0x0040
0:00:00.464841753  5932  0x8662800 DEBUG  
         mpegtsdemux
gstmpegtsdemux.c:3049:gst_mpegts_demux_chain:<mpegtsdemux0> flushing
188/564

Here are log messages from mp2t demux processing for a typical mp2t packet
in the failure case.

0:00:07.023077666 19005  0x9ba2968 LOG    
         mpegtsdemux
gstmpegtsdemux.c:2252:gst_mpegts_demux_parse_stream:<mpegtsdemux0> afc
0x3, pusi 1, PID 0x0010 datalen 184
0:00:07.023204989 19005  0x9ba2968 DEBUG  
         mpegtsdemux
gstmpegtsdemux.c:1697:gst_mpegts_demux_parse_adaptation_field:<mpegtsdemux0>
parsing adaptation field, length 139
0:00:07.023288660 19005  0x9ba2968 LOG    
         mpegtsdemux
gstmpegtsdemux.c:1702:gst_mpegts_demux_parse_adaptation_field:<mpegtsdemux0>
flags 0x00
0:00:07.023369956 19005  0x9ba2968 LOG    
         mpegtsdemux
gstmpegtsdemux.c:2273:gst_mpegts_demux_parse_stream:<mpegtsdemux0>
consumed: 140 datalen: 44
0:00:07.023482821 19005  0x9ba2968 LOG    
         mpegtsdemux
gstmpegtsdemux.c:2278:gst_mpegts_demux_parse_stream:<mpegtsdemux0>
Packet payload 44 bytes, PID 0x0010
0:00:07.023582206 19005  0x9ba2968 DEBUG  
         mpegtsdemux
gstmpegtsdemux.c:2336:gst_mpegts_demux_parse_stream:<mpegtsdemux0>
section finished
0:00:07.023666296 19005  0x9ba2968 LOG    
         mpegtsdemux
gstmpegtsdemux.c:1331:gst_mpegts_stream_parse_pmt:<mpegtsdemux0> PMT
section_length: 40
0:00:07.023748849 19005  0x9ba2968 LOG    
         mpegtsdemux
gstmpegtsdemux.c:1337:gst_mpegts_stream_parse_pmt:<mpegtsdemux0> PMT
version_number: 0
0:00:07.023830006 19005  0x9ba2968 LOG    
         mpegtsdemux
gstmpegtsdemux.c:1341:gst_mpegts_stream_parse_pmt:<mpegtsdemux0> PMT
current_next_indicator 1
0:00:07.023911442 19005  0x9ba2968 INFO   
         mpegtsdemux
gstmpegtsdemux.c:1351:gst_mpegts_stream_parse_pmt:<mpegtsdemux0> No
program number set, so using first parsed PMT's program number: 1
0:00:07.023993227 19005  0x9ba2968 DEBUG  
         mpegtsdemux
gstmpegtsdemux.c:1363:gst_mpegts_stream_parse_pmt:<mpegtsdemux0> PMT
program_number: 1
0:00:07.024219167 19005  0x9ba2968 DEBUG  
         mpegtsdemux
gstmpegtsdemux.c:1366:gst_mpegts_stream_parse_pmt:<mpegtsdemux0> PMT
section_number: 0
0:00:07.024340762 19005  0x9ba2968 DEBUG  
         mpegtsdemux
gstmpegtsdemux.c:1370:gst_mpegts_stream_parse_pmt:<mpegtsdemux0> PMT
last_section_number: 0
0:00:07.024457189 19005  0x9ba2968 DEBUG  
         mpegtsdemux
gstmpegtsdemux.c:1375:gst_mpegts_stream_parse_pmt:<mpegtsdemux0> PMT
PCR_PID: 0x0040
0:00:07.024557692 19005  0x9ba2968 DEBUG  
         mpegtsdemux
gstmpegtsdemux.c:609:gst_mpegts_demux_get_stream_for_PID:<mpegtsdemux0>
creating stream 0xb5f02f10 for PID 0x0040, PID_type 0
0:00:07.024648975 19005  0x9ba2968 DEBUG  
         mpegtsdemux
gstmpegtsdemux.c:1400:gst_mpegts_stream_parse_pmt:<mpegtsdemux0> PMT
program_info_length: 12
0:00:07.024780278 19005  0x9ba2968 DEBUG  
         mpegtsdemux
gstmpegtsdemux.c:1483:gst_mpegts_stream_parse_pmt:<mpegtsdemux0>   PMT
stream_type: 1b, PID: 0x0040 (ES_info_len 10)
0:00:07.024913397 19005  0x9ba2968 DEBUG  
         mpegtsdemux
gstmpegtsdemux.c:1490:gst_mpegts_stream_parse_pmt:<mpegtsdemux0> PMT
CRC: 0xfba2e249
0:00:07.025007405 19005  0x9ba2968 DEBUG  
         mpegtsdemux
gstmpegtsdemux.c:1260:gst_mpegts_activate_pmt:<mpegtsdemux0>
activating PMT 0x00000010
0:00:07.025170836 19005  0x9ba2968 DEBUG  
         mpegtsdemux
gstmpegtsdemux.c:3049:gst_mpegts_demux_chain:<mpegtsdemux0> flushing
188/564

Does anyone have any ideas about why this is wrong and/or what to
investigate to fix it?

Thank you for consideration and any/all help.

Chuck Crisler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130109/cbe1ce40/attachment.html>


More information about the gstreamer-devel mailing list