0

I have a webm file (vp8 codec) with 2m:39s of duration

Using ffmpeg -i video.webm it says that the video have 15fps

nput #0, matroska,webm, from 'video.webm': Metadata: encoder : Lavf54.17.3 Duration: 00:02:39.63, start: 0.000000, bitrate: 417 kb/s Stream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp (default) Stream #0:1: Video: vp8, yuv420p(progressive), 320x240, SAR 1:1 DAR 4:3, 15 fps, 15 tbr, 1k tbn, 1k tbc (default)

I tried to convert setting to the same framerate and add to a mp4 container

$ x264 --output intermediate.264 --fps 15 --preset slow --bitrate 400 --vbv-maxrate 800 --vbv-bufsize 1600 --min-keyint 48 --keyint 48 --scenecut 0 --no-scenecut --pass 1 --video-filter "resize:width=426,height=240" video.webm

$ MP4Box -add intermediate.264 -fps 15 out.mp4

But the generated file out.mp4 now have a 2m:57s duration

  • 1
    check the statistics in vlc player for webm file and mp4 file. ( decoded block/displayed frame) both the cases no of frames should be the same. – mail2subhajit Oct 24 '19 at 22:36
  • original vídeo had 2654 displayed frames and 5307 decoded blocks, converted file had 2643 displayed frames and 5302 decoded blocks – Thomas Anderson Oct 24 '19 at 22:52
  • I am assuming vlc might be dropping some of the frames while displaying them. – mail2subhajit Oct 24 '19 at 23:08
  • Possibly, x264cli does not respect timestamps. Use ffmpeg instead. – Gyan Oct 25 '19 at 04:30
  • ffmpeg works, but my final objective its generate a dash file for adaptative resolution based on user bandwith, when i convert with ffmpeg i cant seek to a random media time with dash.js player, with x264 it works but i have the media duration problem – Thomas Anderson Oct 25 '19 at 14:08

1 Answers1

1

As you are generation the .mp4 file out of the raw .264 dump file .

Here is the simple calculation for the duration :

No of original frames : 2654

Frame Rate : 15 frames per second

Duration of mp4 file : 2654 /15 = 176.93333 seconds /60 = 2 min 56.93 seconds = ~ 2min 57 sec

The Webm file might have less Audio data than video frames. So its duration is less than the mp4 file.

mail2subhajit
  • 1,106
  • 5
  • 16
  • i played both videos side by side, its like the original file have 16~17 fps, i dont think vp8 codec accelerate or slow the video frames to fit the audio, but a wrong output from ffmpeg -i – Thomas Anderson Oct 25 '19 at 14:14