[Live-devel] Record every X seconds wtih playlist (piped ffmpeg?)

Ross Finlayson finlayson at live555.com
Sat Dec 10 15:19:01 PST 2016


> This is working, it generates recordingXXX.ts files every 10 seconds and adds them into a m3u8 playlist which is nice, however I also want to attach the audio stream, so I tried the following:
> 
> ./openRTSP -4 -t rtsp://user:password@hostname:port/path/to/stream | ffmpeg -i - -codec copy -hls_time 10 /data/recording.m3u8

The reason why this doesn’t work is that (because of the stupidity of the “.mp4” file format) “.mp4”-format files need to be ‘finalized’ before they can be played.  Therefore, when you give “openRTSP" the “-4” or “-q” option, you can’t pipe its output to something else; instead, you have to let it output a file (and have “openRTSP” end normally).


> I understand that moov atom should be there but as it arrives directly from openRTSP it is not there at that time.

That’s correct.  The “moov” atom cannot be written until the file is completed (i.e., until “openRTSP” has ended).  (Again, blame the stupidity of the “.mp4” file format.)  See above.


> An alternative would be if I could set openRTSP to also output a playlist if I use the -P 10 option.

Yes, I suggest using the “-P 10” option (along with “-4”) to output a “.mp4”-format file every 10 seconds.  Then use some other software (e.g., a simple shell script) to create a “m3u8”-format playlist for these files.


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/




More information about the live-devel mailing list