Opened 11 years ago

Last modified 11 years ago

#3199 new defect

duration incorrect for mpeg file

Reported by: DonMoir Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mpegps duration
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

The file dolbycity.vob has an audio, video, and data stream. The audio and video streams have different durations.

The duration computed in ../libavformat/utils.c in estimate_timings_from_pts seems to take first stream it finds and computes that stream duration and this is then propagated to the other streams. The real audio stream duration is 31808 ms. The video stream duration is 32000 ms. Seems estimate_timings_from_pts computes the audio stream duration at 31776 since it lacks the duration of the last packet in it's calculation. 31776 + 32 = 31808. 32 is the duration of the last audio packet in ms.

So estimate_timings_from_pts seems to be overkill and not enough ( at same time :) to get accurate results.

I think mediainfo is the only program I have that reports the audio duration at 31808 and video duration at 32000 and overall duration at 32000. But I verified those numbers by walking the packet list. It's important I get these durations as exact as possible and for this particular case it is possible but not happening.

http://sms.pangolin.com/temp/dolbycity.vob

ffmpeg -i dolbycity.vob
ffmpeg version N-58733-gf65afef Copyright (c) 2000-2013 the FFmpeg developers

built on Dec 3 2013 22:04:42 with gcc 4.8.2 (GCC)
configuration: --disable-static --enable-shared

--enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig
--enable-frei0r --enable-gnutls --enable-iconv
--enable-libass --enable-libbluray --enable-libcaca
--enable-libfreetype --enable-libgsm --enable-libilbc
--enable-libmodplug --enable-libmp3lame
--enable-libopencore-amrnb
--enable-libopencore-amrw

b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en
able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis

--enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs --enable-

libxvid --enable-zlib

libavutil 52. 56.100 / 52. 56.100
libavcodec 55. 45.100 / 55. 45.100
libavformat 55. 22.100 / 55. 22.100
libavdevice 55. 5.102 / 55. 5.102
libavfilter 3. 91.100 / 3. 91.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100

Input #0, mpeg, from 'dolbycity.vob':

Duration: 00:00:31.78, start: 0.049756, bitrate: 5291 kb/s

Stream #0:0[0x1bf]: Data: dvd_nav_packet
Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x576 [SAR 16:1

5 DAR 4:3], max. 9800 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc

Stream #0:2[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s

Change History (2)

comment:1 by Carl Eugen Hoyos, 11 years ago

Component: undeterminedavformat
Keywords: mpegps added
Version: unspecifiedgit-master
$ ffmpeg -i dolbycity.vob -f null -
ffmpeg version N-58755-gaf7562a Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec  5 2013 23:36:29 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      52. 56.100 / 52. 56.100
  libavcodec     55. 45.100 / 55. 45.100
  libavformat    55. 22.100 / 55. 22.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     3. 91.100 /  3. 91.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mpeg, from 'dolbycity.vob':
  Duration: 00:00:31.78, start: 0.049756, bitrate: 5291 kb/s
    Stream #0:0[0x1bf]: Data: dvd_nav_packet
    Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x576 [SAR 16:15 DAR 4:3], max. 9800 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:2[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf55.22.100
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 720x576 [SAR 16:15 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 25 tbc
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, 5.1(side), s16, 4608 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (mpeg2video -> rawvideo)
  Stream #0:2 -> #0:1 (ac3 -> pcm_s16le)
Press [q] to stop, [?] for help
[null @ 0x215ee20] Encoder did not produce proper pts, making some up.
frame=  800 fps=0.0 q=0.0 Lsize=N/A time=00:00:32.00 bitrate=N/A
video:75kB audio:17892kB subtitle:0 global headers:0kB muxing overhead -100.000120%

comment:2 by Carl Eugen Hoyos, 11 years ago

Keywords: duration added
Note: See TracTickets for help on using tickets.