[FFmpeg-user] Re-writing hot .ts file that rotates every 24 hours in realtime
Carl Zwanzig
cpz at tuunq.com
Thu Feb 18 08:18:00 EET 2021
On 2/15/2021 11:33 PM, Korn Moffle wrote:
> What I am trying to do:
> a. copy the file in realtime ? So, ffmpeg would be rewriting file1.ts into file2.ts as file1.ts is constantly being written into.
What's the goal of that?
> b. tell ffmpeg to read the file with a constant 3 second delay from the most updated frame?
...to add a 3 second delay?
If it's a real mpeg-ts stream, you could simply skip ffmpeg and as
bytes/blocks are written to one file*, read/buffer for 3 seconds/write out
to other file. You'll, of course, need a long enough circular buffer to hold
that much stream.
*watch that with select(), poll(), or the windoze equivalent
> c. if a new file appears, detect it and switch to it?
Also, do this with your program. Be careful of the boundary conditions when
starting and when switching files; if nothing else, you're probably not
guaranteed that the new file will start on a new frame; depends on the
writer. Fortunately, transport streams are designed to be somewhat resilient
to interruptions.
Later,
z!
More information about the ffmpeg-user
mailing list