[Libav-user] Dump unmodified MPEGTS from RTSP streaming server

Julian Herrera julian.herrera at tvgenius.net
Thu Feb 28 12:53:52 CET 2013


I'm relatively new to development with libav but has already managed to 
create an iOS-based video player for DVB-S (MPEGTS) streams that are 
delivered by a set-top box via RTSP. After few modifications to libav, 
it is now able to download and play the stream directly from the box. 
Now I have to implement time-shifting so I intend to use a local file to 
store the stream as a circular buffer of fixed size. Please note that 
the box's RTSP server only supports PLAY, not pause or anything useful.

My problem is that I cannot figure out how to dump the MPEG-TS stream 
unmodified to a local file. I'm not really sure at what point should I 
store the current packet's pkt->data to a file in such a way that at the 
end the file will be perfectly played as an mpegts movie. I'm not sure 
even if pkt->data holds enough information to reconstruct the mpegts 
movie sequentially as the packets are being read.

In the process I don't need to transcode anything, just need to store a 
table of timestamps/byte positions for the time-shifting to work.

I'd appreciate if someone could share some ideas.

Thank you!

Julian Herrera

More information about the Libav-user mailing list