Correcting for wildly incorrect time of .webm with FFMPEG

7,355

There is an old related bug report, marked as fixed. about this: Incorrect duration displayed in webm file. This seems to be related to the fact that a webm file doesn't contain an index of all frames, but only keyframes.

First option is to rewrap the WebM

ffmpeg -i current.webm -c copy -fflags +genpts new.webm
Share:
7,355

Related videos on Youtube

Ron
Author by

Ron

Updated on September 18, 2022

Comments

  • Ron
    Ron almost 2 years

    I have a file that when I run ffpmeg -i on it will display a time of 351909:41:29.64.

    I know I didn't record for 40 + years. Any suggestions on what would be the best way to fix this?

    I appreciate any and all answers!

    Regards,

    • Metabolix
      Metabolix over 8 years
      What is your ffmpeg version? Have you tried ffmpeg -i old.webm -c:a copy -c:v copy new.webm or the like?
    • Gyan
      Gyan over 8 years
      To the OP, post the full output of ffprobe for the file.
    • Ron
      Ron over 8 years
      ffprobe output Input #0, matroska,webm, from 'recording.webm': Duration: 351909:41:29.64, start: 0.000000, bitrate: N/A Stream #0.0(eng): Video: vp8, yuv420p, 640x360, PAR 1:1 DAR 16:9, 1k fps, 1k tbr, 1k tbn, 1k tbc (default) Metadata: title : Video Stream #0.1(eng): Audio: vorbis, 48000 Hz, stereo, s16 (default) Metadata: title : Audio
    • Ron
      Ron over 8 years
      ffmpeg version 0.8.13-4:0.8.13
    • Gyan
      Gyan over 8 years
      That's an ancient version. Get something 2.8+ or nightly build.
    • Ron
      Ron over 8 years
      Updating. Thanks for all the help by the way!
  • Ron
    Ron over 8 years
    I don't know if it's just an ffmpeg thing though. I see it when watching the video in the browser and VLC. I think it may actually be a file encoding issue.
  • Gyan
    Gyan over 8 years
    As Metabolix said, rewrap it in a new WebM, except add -fflags +genpts to their command.
  • Ron
    Ron over 8 years
    Thanks for the help! Kind of new to FFMPEG. So the command would be ffmpeg -fflags +genpts -i old.webm -c:a copy -c:v copy new.webm
  • Gyan
    Gyan over 8 years
    See edited answer.
  • Ron
    Ron over 8 years
    Updated ffmpeg, ran the above command and then used ffprobe and got: Input #0, matroska,webm, from 'new.webm': Metadata: encoder : Lavf56.36.100 Duration: 351909:41:29.65, start: 0.000000, bitrate: N/A Stream #0:0(eng): Video: vp8, yuv420p, 640x360, SAR 1:1 DAR 16:9, 1k fps, 1k tbr, 1k tbn, 1k tbc (default) Metadata: title : Video Stream #0:1(eng): Audio: vorbis, 48000 Hz, stereo, fltp (default) Metadata: title : Audio
  • Ron
    Ron over 8 years
    I believe my file may be corrupt as I look at it. The video seems to be only 6kb while the audio is 9000+ kb
  • Gyan
    Gyan over 8 years
    Looks like it. How long is the file supposed to be?
  • Ron
    Ron over 8 years
    Sorry for the delay in my response. It is actually supposed to be 16:54.