[vlc-devel] RTP/H.264 to MPEG-TS mux bug
Tim at video-dynamics.com
Fri Apr 29 15:37:04 CEST 2011
Some of you may have seen a cry for help out about a month ago about
transcoding and rebroadcasting some Panasonic cameras (If you read
FFMpeg devel). I believe I have isolated the issue down to a specific
point that will hopefully allow someone to provide me with the knowledge
to write a hack around for my personal use and/or to implement a long
term solution that can be written back into the main branch of VLC.
Here is where I believe the issue lays and I'll provide supporting
documentation at the end.
When I view the camera directly in VLC the picture quality is good and I
receive very minor disruptions during viewing. However when I request
that the audio be transcoded and then be remuxed to an MPEG-TS that's
when issues start to arise. Because H.264 and RTP do not carry a DTS
and only a time stamp the DTS values for the TS packets must be
calculated (guessed?). I believe occasionally a packet is created with
a DTS that is very far into the future (between 80,000 and 400,000 more
than the previous packet). That packet is then appended onto the output
chain and processed by the UDP transmission tool. When the UDP tool
realizes that it just got a packet that has a new DTS with a value less
than the OLD DTS (the packet right after the future packet) it dumps the
output chain and starts over. This is the cause of my video freezes
that can be up to 4 seconds in duration.
I believe the way to hack around this issue (in my case) is to place a
check right before a new TS packet is placed on the chain to be sent
out. It would look something like this
If (new_packet->i_dts > previous_packet->i_dts + 80000) // packet is too
far into the future
// else continue with processing to add this packet to the chain
I believe that I can afford to drop a couple of packets verse having my
restreamed image freeze up for a couple of seconds.
If someone could provide some information where I can look to add this
in or if you would like access VIA SSH to a machine that is configured
to build VLC and has this camera on the network for testing and/or
confirmation of the problem please let me know. I would be happy to
provide this information.
Pastebin has a full output log from one restream attempt . (cam5.log)
Additionally here is a link to Panasonics documentation about how they
write their H264 and RTP information to the packets. Pages 250-270 seem
to fully document the formats.
You have to wait about45 seconds for the ads and then the file will
download, sorry it was a free service I found.
Here is my complete CLI:
./cvlc -vvv rtsp://10.0.2.5/MediaInput/h264
x=ts,dst=22.214.171.124:1234}' :ttl=4 :sout-keep --rtsp-tcp
--rtp-caching=1200 --rtsp-caching=1800 --sout-udp-caching=900
--rtp-max-misorder=25 --sout-ts-shaping=4000 >cam5.log 2>&1
Many thanks to a bunch of the people who have been helping me to date in
#VideoLan. Other than that I love VLC, I truly applaud all of the great
work and effort that has gone into this product to make it what it is
Thanks for reading
Sr. Systems Engineer
Video Dynamics Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vlc-devel