My security camera recorder produced a H.264 MP4 video file that appears to be malformed as it reports an incorrect video duration. Using ffmpeg and following this answer I get the same result of 38 minutes and 10 seconds when the duration is actually 7 hours 3 minutes and 14 seconds:
$ ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 video.mp4
2289.759000
$ ffprobe -v error -select_streams v:0 -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 video.mp4
2289.759000
VLC also struggles as the elapsed time (seen on the left of the scrubber below) reports an incorrect value:
If I try to re-encode the video file with ffmpeg, it stops at 38 minutes. If I try to export a portion of the video file after 38 minutes, ffmpeg produces an empty file. Trying to convert the video with VLC has the same results.
Is there a way I can force or override ffmpeg and give it the correct duration? Or is there another way I can fix this video file to report the correct duration?
