Kodi Community Forum

Full Version: Incorrect duration after editing with avidemux
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm posting this in the forums to see if anyone else has run across this behavior before possibly adding to the bug tracker.

The issue is that, after cutting a file with the program Avidemux, XBMC reports the duration to be ridiculously long (60hrs, 72hrs, etc). I initially figured this to be an issue with Avidemux, but Windows media player and VLC both report the duration correctly. This is not a game-breaking bug, however - the video plays fine and finishes when it should - it only displays the incorrect duration.

I've made a small file that can be used for testing (6MB). It's only the intro to Adventure Time, but I've named it so that XBMC will recognize it as episode 21 of season 5. Here it is:


This is a screen capture of what it looks like (In this case it reports the duration as 2hrs 12 minutes, when it is actually 24 seconds):


Here is the same file in Windows Media Player and VLC (which both correctly identify it as 24 seconds long):


I'm sure the easy thing is to blame the software I used to cut the file, but I feel that is irrelevant if other programs have no issue correctly identifying the duration. Please let me know if this is already in the bug tracker, or if there is an easy fix. Thanks!
I am not sure exactly what the problem is - it shows wrong for me too.

Can be fixed though with

ffmpeg -i Adventure.Time.S05E21\ intro.avi -vcodec copy -acodec copy Adventure.Time.S05E21\ intro-fixed.avi

This copies the video and audio streams (no re-encoding) and remuxes them into a new container. It them shows correct duration in XBMC. It took less than a second on that small sample (0.058s actually).
I tried using ffmpeg to fix that, though I'd never used it before and downloaded the latest from here: http://ffmpeg.zeranoe.com/builds/

I used the same command you did, but the video is very slow in the beginning and gets way out of sync from the audio (when testing it in VLC, it couldn't play the audio at all for it). Perhaps the Windows version of ffmpeg sucks. But XBMC did recognize that the video was 24 seconds while playing. In the menus it was still having issues, though - does yours do this?


Both files still read as 2hrs, 13 minutes in the menus.
The duration in the menu is of everything in that directory.

It seems to play correctly, but it is pretty hard to tell if sync is right on a cartoon.
Oh right, I forgot that it summed up all the durations (which doesn't seem very useful unless you're doing a marathon).

Yours is probably fine - you would have noticed it, since it was very obviously screwed up after the re-encoding. Did you do that on Windows, or Linux?

Regardless, it seems that WMP and VLC read the duration in a different way, or have a failsafe that XBMC doesn't employ.
The total is for gloating purposes I think. I used linux.
My experience is sometimes Avidemux can barf (I use the 32 bit nightly but also can happen on the release ver). It depends on the encodings and container used. For example works good for me on AVC/AAC in mp4 or mkv, mpeg-2 not so much. I haven't had any trouble running ffmpeg on windows. That's what's under the hood in XBMC dvdplayer.

scott s.