How to record playable video files in gstreamer even if recording is interrupted unexpectedly (e.g. power disconnects)?

Letty letizia.mariotti at gmail.com
Tue Sep 14 14:08:36 UTC 2021


I have been recording video streams on my Jetson Xavier NX using a simple
gstreamer pipeline such as this


gst-launch-1.0 -v \
nvarguscamerasrc sensor-id=0 ! \
'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080,
format=(string)NV12, framerate=(fraction)30/1' ! \
nvv4l2h265enc ! 'video/x-h265, stream-format=(string)byte-stream' ! \
h265parse ! qtmux ! filesink location=video.mp4 -e

All is working if the recording is interrupted by keyboard interrupt Ctrl +
C, but if the recording is interrupted unexpectedly (e.g. power gets
disconnected) the resulting file has no playable stream, even if the file
size is correct.

I know that mp4 recording needs to be stopped properly otherwise it won't
have the necessary information at the end of the file, but I was wondering
if there was any other gstreamer pipelines or final file formats that would
allow for an H265 encoded video file to be playable even if the recording
is ended unexpectedly.

It would be good even if the recorded file needed to be converted before
being playable (e.g. with ffmpeg), as long as the information can be
recovered without having to go through non-free mp4 recovery tools.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210914/269a4183/attachment.htm>


More information about the gstreamer-devel mailing list