Make splitmuxsink flush every file written
Hello,
I'm trying to create an app which records a live RTSP source into 5 seconds .ts files. My pipeline is the following:
rtspsrc location=%s ! rtph264depay name=depay ! h264parse name=parse ! splitmuxsink muxer=mpegtsmux max-size-time=%d location=%s name=splitmux
.
I should support the case that any moment during the recording, the computer might lose power.
I did notice that what happens is usually I won't just lose the last .ts file, but rather a few.
I tried adding a call to sync()
every time the format-location
callback is called, which worked, but that's just wasteful since I only want to call fsync
on the actual file that was written by the pipeline.
Is there a way to make splitmuxsink call fsync on the last file written? Or alternatively, obtain the fd of the last written file?
Thank you very much. Omer