Main Menu

"Broken" MP4 files

Started by oshae, January 21, 2018, 09:18:05 PM

Previous topic - Next topic


Hello all

I'm trying to fix some MP4 videos that do not function properly. It's kind of hard to describe the symptom, if there was just a word for it I would maybe have an easier time searching the internet for a solution.

Essentially, with most of them the play length that is detected is very long. Like if it's a 1 hour video, the player might think it's 8 hours. The video will play and you can seek in it, but you can only seek by clicking on a small portion of the progress bar. Otherwise you go outside it into the empty space of the video and the screen goes black. I have been able to fix these with Avidemux, by just choosing the beginning as A and where the video truly ends as B and then copying.

Some others are not so simple. In another, the first say 20 minutes of the video encompasses all of what the player knows about. So if you skip to what you think is the end it's actually only about 20 minutes into the video. In Avidemux, the progress bar will move almost to the end of the video and then stop. But the video keeps playing all the way to the end. If I play the video in a normal video player, after the first 20 minutes that is normal, the player goes blank and progress freezes. These I have not been able to fix. I did just a straight copy of the whole video, the file size ended up smaller and it was only the first 20 playable minutes. It's like Avidemux can see what is there but cannot assemble it when doing a copy.

Sorry if my description is terrible. It's hard to explain without seeing. I'm wondering if I need to re-encode them versus just a copy operation?

Thanks in advance for any hints!

Jan Gruuthuse

Make sure you're using the latest (nightly) avidemux.
Delete the .idx2 for the related videos, and try copy operation again.
If the issue is still there, then try re-encoding one. See if that would help.


What if it is a file someone already encoded and there are no idx files?

Jan Gruuthuse

The index file would be created, in most cases upon loading into avidemux. (Not for mkv)
Quote from: eumagga0x2a on January 23, 2018, 12:41:38 AM
Index files are created only for MpegTS and MpegPS streams.


And if I see no index files? I'm looking where the video is stored and don't see anything. Hidden files etc. shown.


Index files are created only for MpegTS and MpegPS streams.

If a MP4 video container specifies an excessive video duration, Avidemux won't discard it AFAIR, but setting the B marker at the last frame and saving the video in copy mode should fix this. If the duration is not sufficient, it is ignored. Providing samples would allow to look into the issue if something goes wrong here.


I would upload some samples, but they are quite large. And the content is personal.

I've fixed a few of them. Generally speaking, the ones where the video runtime is much longer than the actual content itself, I can cut out the end and copy it.

The ones I can't fix are the ones where the runtime is shorter than the actual content. The progress bar in Avidemux moves to the end after about 30 minutes of actual video content and stops. But then the video keeps playing for the next 1.5hours and as you watch it looks like it is sped up, like fast forwarding.

Wish I understood more about video encoding/editing. I'm sure I could fix them somehow.


Could you at least launch Avidemux, load the said video, then compress and attach the log file (admlog.txt from %localappdata%\avidemux\ on Windows; redirected console output on Linux and macOS)?


Just open the file and gather the log? Or try to edit/copy the video first then get the log?


For now just load the video, no other operations prior to getting the log.


It's because of faulty muxing. In avi it's faulty interleaving. Maybe a bad combination of video and audio. Maybe fault of converter /editor.