chrippa / python-librtmp

python-librtmp is a RTMP client library. It uses the implementation provided by librtmp via cffi.
BSD 2-Clause "Simplified" License
153 stars 33 forks source link

rtmpdump's --resume on VOD streams using python-librtmp? #19

Open brachna opened 9 years ago

brachna commented 9 years ago

I wonder if it's possible to introduce such functionality? It's quite easy to use in rtmpdump, but I need something like that in automatic python script. I see librtmp has --start arg, but I'm not sure how rtmpdump automatically finds how much time needs to be skipped (just uses timer?). If it's complicated I'll try to use timer or some mediainfo-type library and --start arg.

vadmium commented 9 years ago

To resume a file, rtmpdump parses the FLV file to figure out the last tag, and then (I think) works backwards to find the last keyframe. I know this because I was trying to fix it when the FLV is truncated and doesn’t end on a tag boundary. But if you don’t care about FLVs truncated at the wrong position, you should be able to just seek to the end and then read the length of the last tag, and work backwards from there.