I have some video files which were converted to MP4, but not quite correctly. When I examine one with exiftool, I see these metadata values:
Duration : 0:11:23
Track Duration : 0:11:23
Media Duration : 0:04:13
That last one is incorrect. In VLC media player, the videos play fine, but the tool I'm using to play them in a web app (Flowplayer) takes the "Media Duration" value seriously and truncates the video.
To fix the metadata I tried
exiftool -"Media Duration"="0:11:23" video_1.mp4
But I got
Warning: Sorry, Media is not writable
Nothing to do.
Sudo didn't help. According to its man page and web site, exiftool can read and write metadata on MP4 files, but "ExifTool will not rewrite a file if it detects a significant problem with the file format."
How can I fix those files?
EDIT: I've had no luck with ffmpeg or mediainfo.
Best Answer
I found a solution. Rather than editing the metadata, I re-encoded the files using ffmpeg, in such a way that the video and audio content was simply copied and wrapped in a new, error-free MP4 container. Here's the command: