A client wants me to write some software, perhaps ffmpeg wrapped in scripting, which will monitor a streaming video feed, and copy clips from it in near real-time, delivering them as self-contained video files. It is not acceptable for me to wait for the feed to finish, and the video to be completely stored as a local file, before I copy the clips. On the other hand, I can take say tens of seconds after the end time of the clip before delivering it. Can I do this without building a video processing suite from scratch? Do I need to require that the streaming video feed be a certain format?
So say the video feed is of a 1-hour live event. At some point, maybe 5 minutes in, my software may get the command, "clip from 4 minutes 30 seconds to 6 minutes 0 seconds, save as file X.mpg". I have to tap into the video feed, copy 90 seconds of video, and store it as file X.mpg, by about 7 minutes in. The actual times are more flexible, I just want to emphasise that I must be able to tap into the streaming feed in progress, I can't wait for a static video file.
I don't even know if streaming video formats permit this kind of operation. If a receiver writes the feed to disc, will the beginning of the file be legal syntax which a normal tool like ffmpeg can parse?
I don't know details of encoding formats, but I understand that they store key frames every so often, and intermediate video frames are stored as differences from the key frame and/or preceding frames. Is it important to know when the key frames are added? Can normal tools parse video past the most recent key frame to the frame just being written, or would the data in the stored file be still be in some temporary state, and thus not yet parseable?
Or, is copying video clips from streaming video a difficult task which requires more sophisticated software than ffmpeg or the like, wrapped with scripts?
Advice on specific formats, and tool chains which make this possible are welcome.