Opened 5 years ago

Last modified 5 years ago

#3683 new defect

ffmpeg misdetects duration for mpeg file generated using ffmpeg (one frame short)

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

Description (last modified by cehoyos)

The following sequence of commands shows the problem:

ffmpeg -f lavfi -i nullsrc=s=256x256:d=1.0 -c:v mpeg2video out.mpg

ffmpeg version N-63519-g61917a1 Copyright (c) 2000-2014 the FFmpeg developers
  built on May 28 2014 14:40:18 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
  configuration: 
  libavutil      52. 87.100 / 52. 87.100
  libavcodec     55. 65.100 / 55. 65.100
  libavformat    55. 41.100 / 55. 41.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
Input #0, lavfi, from 'nullsrc=s=256x256:d=1.0':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 256x256 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
[mpeg @ 0x7fedba801600] VBV buffer size not set, using default size of 130KB
If you want the mpeg file to be compliant to some specification
Like DVD, VCD or others, make sure you set the correct buffer size
Output #0, mpeg, to 'out.mpg':
  Metadata:
    encoder         : Lavf55.41.100
    Stream #0:0: Video: mpeg2video, yuv420p, 256x256 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 25 fps, 90k tbn, 25 tbc
    Metadata:
      encoder         : Lavc55.65.100 mpeg2video
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> mpeg2video)
Press [q] to stop, [?] for help
frame=   25 fps=0.0 q=1.6 Lsize=     130kB time=00:00:00.96 bitrate=1109.3kbits/s    
video:127kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.983437%
ffmpeg -i out.mpg 

ffmpeg version N-63519-g61917a1 Copyright (c) 2000-2014 the FFmpeg developers
  built on May 28 2014 14:40:18 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
  configuration: 
  libavutil      52. 87.100 / 52. 87.100
  libavcodec     55. 65.100 / 55. 65.100
  libavformat    55. 41.100 / 55. 41.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
Input #0, mpeg, from 'out.mpg':
  Duration: 00:00:00.96, start: 0.540000, bitrate: 1109 kb/s
    Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 256x256 [SAR 1:1 DAR 1:1], max. 104857 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
At least one output file must be specified

The duration is misdetected as 0.96 instead of 1.0, i.e. one frame short. Note that this is not a problem of the nullsrc filter. I have run into this problem with files generated via transcoding but have used the source example so no upload is required.

Change History (2)

comment:1 Changed 5 years ago by rmk

Also note that all 25 frames are in the file. Checked that by decoding it in a libavformat/libavcodec-based application.

comment:2 Changed 5 years ago by cehoyos

  • Component changed from avformat to undetermined
  • Description modified (diff)
  • Keywords duration added
  • Version changed from unspecified to git-master
Note: See TracTickets for help on using tickets.