Recover corrupted video files

Please provide complete information as applicable to your setup.

• Hardware Platform (GPU)
• DeepStream Version 6.0
• TensorRT Version 7.2.1
• NVIDIA GPU Driver Version (valid for GPU only) 460
• Issue Type( questions)
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)
Hi, I am running deepstream-app with sink type of 3 to save output in .mp4 file. Everything works fine as long as I don’t touch the pipeline. But if I ctrl+c to interrupt the pipeline suddenly, or I have a situation where the pipeline is running and the server loses power, then the .mp4 file is still written but I can’t open it to view it. I want to ask is there any way to edit this mp4 file into a complete viewable file? As far as I know it’s because when the pipeline completes it will have an eos signal to notify this, but I don’t know the mechanism to recover the corrupted .mp4 file. Looking forward to your help. Thank!

Hi @nguyentrongnhat4869 , If you interrupt the pipeline, the qtmux plugin cannot write some metadata to the mp4 file. So the player cannot recognize the file format. If you want to recover the mp4 file, you should know a little about h264 protocal. You can extract h264 stream from the mp4 file and play the h264 file.
Also, you can modify our source code, just save the file to h264 format.

I tried using ffmpeg (ffmpeg -r 24 -i out.h264 -c copy out.mp4) to convert h264 to mp4 and also vlc (Tools > Preferences > Show settings, click All > Demuxers: Demux module [H264 video demuxer] ) but still can’t open that file. With ffmpeg the error message is: invalid data found when processing input. Can you show me exactly how to extract h264 stream as you mentioned? Thank!

Hi @nguyentrongnhat4869 this file is broken cause you didn’t write the metadata in it. So even ffmpeg or vlc cannot recognize it. If you really want to recover this file, it’s very difficult. You should know the h264 protocal and read the h264 frame from the file by yourself.
If your env is not very stable, you can modify your source code to save the file to h264 format.

Thank you very much, I removed the qtmux element and saved the h264 format. Now everything works fine, I cut the pipeline and the output is still open

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.