Why does FFMPEG report the wrong duration?

ffmpeg fix duration
fix incorrect video length mp4
ffmpeg change length of video
mkv duration incorrect
ffmpeg duration

I have an oldish build of FFmpeg that I can't easily change.

We use FFmpeg to find the duration of video and sound files. So far it has been working wonderfully.

Recently on an uploaded file, FFmpeg has reported a 30 second file as being 5 minutes 30 seconds in length.

Could it be something wrong with the file rather than FFmpeg?

If I use FFmpeg to convert to another file, the duration is restored.

In case it matters, ffmpeg -i 'path to the file' produces:

    FFmpeg version Sherpya-r15618, Copyright (c) 2000-2008 Fabrice Bellard, et al.
      libavutil     49.11. 0 / 49.11. 0
      libavcodec    52. 0. 0 / 52. 0. 0
      libavformat   52.22. 1 / 52.22. 1
      libavdevice   52. 1. 0 / 52. 1. 0
      libswscale     0. 6. 1 /  0. 6. 1
      libpostproc   51. 2. 0 / 51. 2. 0
      built on Oct 14 2008 23:43:47, gcc: 4.2.5 20080919 (prerelease) [Sherpya]
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'H:\path\to\file.mov':
      Duration: 00:05:35.00, start: 0.000000, bitrate: 1223 kb/s
        Stream #0.0(eng): Audio: aac, 44100 Hz, stereo, s16
        Stream #0.1(eng): Video: h264, yuv420p, 720x576, 25.00 tb(r)
    Must supply at least one output file

It's that very command I use to then extract the duration with RegEx.

Does anyone have a nice application that can do what I'm trying above but get it right 100% of the time?

Check it with a newer version of ffmpeg (you don't have to replace your build), and if it gives the same duration you can probably blame the file.

Wrong audio duration with ffmpeg, After conversion, the duration seems weird. The original m4a was 4:06. But for the new mp3, OS X Finder and Google Play report 09:24, while iTunes still reports  ffmpeg report the good duration in the stream info at the start, but the wrong duration at the end of the process. The problem is not present if I don't use dvd2concat (by specifying .iso directly as the input or by specifying .VOB of the mounted .iso).

You can try tcprobe, part of transcode pack.

Cutting videos with ffmpeg : length not accurate, But it gives me a output wmv that is 11 seconds longer which is twice the duration specified. What am I doing wrong? Any idea? Thanks. share. We use FFmpeg to find the duration of video and sound files. So far it has been working wonderfully. Recently on an uploaded file, FFmpeg has reported a 30 second file as being 5 minutes 30 seconds in length.

I'd guess it's a problem with the file. The length is probably written in a header incorrectly. Unfortunately there is no such thing as a validator (like for web standards) so you can't know for sure if a file is correct.

Video converted by FFMPEG has a different duration, why?, Sometimes this happens unintentionally due to bad metadata in the input file. But not in your case, which, as noted above, correspond with a single frame dropped​  I don't understand: Why do you add this option if it breaks remuxing? I also have files which require this option to be able to remux or transcode. I wanted to try to create a single set of options which work on all my files. But I could try it without this option first, if it does not work try it with this option.

Make sure you are defining the channel and the frequency that is known for the file. Also make sure you are defining the format using -f. Check ffmpeg -formats to view all the available ones.

Use -ac to define the channel. Use -ar to define the rate for the audio. If it is defaulting the bitrate or frequency then the duration will be different than the actual.

Ffmpeg duration wrong, Ffmpeg duration wrong. 48 minutes, it transcodes 48 minutes but then reports it as 2 minutes. webm The video is less than a minute long but is identified as  FFmpeg detect wrong duration of the vob files containing two titles. I'm not sure about that, but from my observations and comparing how this file is playback with MPC MPEG Splitter. I can say that real file duration is 21:34 and after 16:17 is video for other dvd title. Reproduced with multiple files.

You should not rely on the stderr.

The stderr output is not intended to be machine parsed: it is for informational purposes only and prone to breakage.

Parse it with

ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 input.mp4
30.024000

You can also use ffmpeg to get the duration by fully decoding the file.

ffmpeg -i input.webm -f null -
...
frame=206723 fps=1390 q=-0.0 Lsize=N/A time=00:57:28.87 bitrate=N/A speed=23.2x

For detail refer to Format (container) duration

#2433 (FFMPEG reporting wrong video duration after encoding WTV , Summary of the bug: The duration here is e.g. 48 minutes, it transcodes 48 minutes but then reports it as 2 minutes. This is a regression bug,  Every now and then, usually when a long video is recorded (3-4+ hours, but today happened also with a 1:30 hours video) and the stream is stopped and restarted 1 or more times, the recorded file shows a totally wrong duration of some 20+ hours when played in JW Player or checked with ffmpeg; trying to skip to a time past the true length of the recording hangs the player.

#2065 (ADPCM_MS audio duration is incorrect) – FFmpeg, Summary of the bug: The duration of an ADPCM_MS file is incorrectly reported. FFmpeg reports a duration of 24:51:18.49 for this file when it should be 2:00 (2  Why Does ffprobe Report an Incorrect Number of Frames?. Hi, all First-up, although I've been using the FFmpeg suite of utilities for a while, I've only ever used them in a fairly limited way, so

#5307 (HLS start_time and duration incorrect) – FFmpeg, Do you want to report that a frame is missing in an output file? Or audio? I want to report that the duration and start_time are incorrect after transcoding to HLS. Bug Reports. Before reporting a bug, please consider the following: FFmpeg is in a state of perpetual development. As such, if you wish to query or report a bug, you must try with the latest development branch revision of FFmpeg to confirm the issue still exists.

-codec copy creates incorrect duration when edit atoms are in input , r/ffmpeg: FFmpeg is the leading multimedia framework, able to decode, encode, -codec copy creates incorrect duration when edit atoms are in input report. 100% Upvoted. This thread is archived. New comments cannot be posted and  WAV file that is giving the wrong duration time WAV incorrect wrong removed uncut console output of ffmpeg -i thermo.wav -f null - to make this a valid ticket.

Comments
  • If you still have the file, report it here: ffmpeg.org/bugreports.html
  • I notice it too with aac files superuser.com/questions/121298/…
  • Did you ever get to the bottom of this - I am seeing the same thing. Like you I find that other applications (e.g. Quicktime) can read the duration correctly.
  • I have a related question: superuser.com/questions/728687/… FFmpeg is adding incorrect metadata (duration and start time) in my destination files.
  • stackoverflow.com/questions/10640088/… i find out answer here.. as i was also finding this ..
  • Great idea, I will deffo give this a shot.
  • Thanks for the recommendation, I will have a look at this soon.
  • Hmmmmmmm, maybe. VLC and Quicktime report the right length though.