PDA

View Full Version : Howto repair an invalid video duration



Hogi
05-29-2013, 03:52 AM
Certainly an offtopic post, but I hope someone can help anyway. I have a mkv video file with an invalid duration. VLC player and Mezzmo show a duration of "124051:44:17". In this case I usually repair this with

mkclean --remux --optimize --timecodescale 1000000 file.mkv file-repaired.mkv

But this time I still got this mkclean message:

"Impossible to remux, the TimecodeScale may be too low, try --timecodescale 1000000"

I tried higher values, but still no luck. Any further ideas how to repair the timescale?

Paul
05-30-2013, 10:49 AM
You could try ffmpeg.exe (you can download it yourself, or use the one we install into your Mezzmo program folder). Try a command line like:


ffmpeg.exe -i <inputfile>.mkv -vcodec copy -acodec copy <outputfile>.mkv

See http://ffmpeg.org/ffmpeg.html for more command line options.

Hogi
05-30-2013, 04:43 PM
I tried ffmpeg, but the remuxed file is only 1.7 GB (instead of 8 GB) and has a duration of 37min (should be somewhere > 90min). So I guess there is something wrong with my mkv file. I also tried the "-timecode" parameter of ffmpeg to set a new timecode, but that doesn't changed anything. I checked the mkv file with mkvalidator and it says

The timescode of cluster #xyz is not incrementing (may be intentional)"

Here is a the part of the mkvalidator sourcecode (https://github.com/Matroska-Org/foundation-source/blob/master/mkvalidator/mkvalidator.c):

ClusterTimecode = MATROSKA_ClusterTimecode((matroska_cluster*)*Clust er);
if (ClusterTimecode==INVALID_TIMECODE_T)
Result |= OutputError(0xC1,T("The Cluster at %") TPRId64 T(" has no timecode"),EL_Pos(*Cluster));
else if (ClusterTime!=INVALID_TIMECODE_T && ClusterTime >= ClusterTimecode)
OutputWarning(0xC2,T("The timecode of the Cluster at %") TPRId64 T(" is not incrementing (may be intentional)"),EL_Pos(*Cluster));
ClusterTime = ClusterTimecode;

But I don't know anything about the filestructure of mkv files and how to repair them. Any further ideas?

Paul
05-30-2013, 05:05 PM
Looks like your MKV is quite badly encoded. You may not be able to repair it. Can you create it again from the original source or re-download another video of the movie / tv show/ etc.?

Hogi
05-30-2013, 06:02 PM
Did some more reserach. The orginal file is a .ts file, which is as far as I know another container format. I always remux my movies with mkvtoolnix (mmg) to delete foreign audio stream just to save space. The duration of the .ts file is correct and I can stream it to my Samsung incl. FF/REW. After remuxing with mkvtoolnix and the option --clusters-in-meta-seek the audio stream and duration is broken. So I guess mmg doesn't remux it correctly. Perhaps, a later version of mkvtoolnix can do it better. Until that I keep my .ts file.

Paul
05-31-2013, 06:42 AM
A .ts file is an MPEG-TS video file and is generally an excellent container format for streaming, so I would suggest you keep it.