Gstreamer video output file corrupted , when suddenly shutdown device

Hi
i try to use Jetson TK1 as a video recorder (DVR) and i successfully save video stream by this code

gst-launch-1.0 v4l2src device="/dev/video0" ! "video/x-raw,width=640,height=480,format=(string)YUY2" ! videoconvert  ! omxh264enc ! qtmux ! filesink location=test.mp4

if i stop recording by Ctrl+C the output file is OK and i could play video output file successfully by VLC . but if i turn off the device while recording the output file is corrupted and will no longer be playable.
note that i use TK1 as a DVR and users can shutdown it suddenly.
what can i do to solve this problem?
Best Regards,
Akrita

Hi,
If your system is possible to have sudden shutdown, please use mpegtsmux or matroskamux. qtmux for generating mp4/mov requires EoS(End of Stream) event to output a valid file. mpegtsmux and matroskamux are streaming-based container, and more suitable for sudden shutdown.

Hi DaneLLL

Thank you for your response , mpegtsmux not recognize by gstreamer but matroskamux worked for me but i still have little problem with mp4 output file , that when i play it with a player like VLC player
SeekBar is not active and i can not forward and backward video output file .
Thank you.

Hi,
For streaming-based container, seeking is not supported. This is my understanding.

Container plugins are implemented by gstreamer developers. You may go to gstreamer forum to get other suggestions. Probably there are container plugin that can handle sudden shutdown and support seeking.
http://gstreamer-devel.966125.n4.nabble.com/

Hi,
Thank you for your attention
i will ask it on http://gstreamer-devel.966125.n4.nabble.com/
Best Regards,
Akrita

Usually, The CCTV or surveillance camera video recordings are saved using either DVRs (digital video recorder) and NVRs (network video recorder) depending on the type of security camera. More information you can read the source repair & recover Videos from Surveillance/CCTV Cameras.

Source: https://www.stellarinfo.com/blog/recover-lost-videos-from-surveillance-cctv-cameras/