[Ffmpeg-devel] FPS in AVI/mpeg4 wrongly detected

Frank Loemker floemker
Tue Oct 3 19:18:55 CEST 2006


Hello,

It seems that the FFmpeg avi-demuxer has a problem if the file contains
an mpeg4 encoded video with a frame rate which is not a natural number
(e.g. 12.5). In this case the frame rate is not detected correctly. For
example if I create the video with the following command

--------------------------------------------------------------------------------
ffmpeg -i input.avi -vcodec mpeg4 -r 12.5 t125.avi
    Output #0, avi, to 't125.avi':
      Stream #0.0, 1/90000: Video: mpeg4, yuv420p, 384x288, 2/25, q=2-31, 200 kb/s, 12.50 fps(c)
--------------------------------------------------------------------------------

mplayer with its native demuxer identifies it correctly as a video with 12.5 FPS:

--------------------------------------------------------------------------------
mplayer t125.avi 
    VIDEO:  [FMP4]  384x288  24bpp  12.500 fps  352.5 kbps (43.0 kbyte/s)
    Clip info:
     Software: Lavf50.5.0
    ==========================================================================
    Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
    Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
    ==========================================================================
--------------------------------------------------------------------------------

But if mplayer is used with the lavf demuxer, it is identified with 25 FPS:

--------------------------------------------------------------------------------
mplayer -demuxer lavf t125.avi 
    VIDEO:  [FMP4]  384x288  24bpp  25.000 fps    0.0 kbps ( 0.0 kbyte/s)
    ==========================================================================
    Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
    Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
    ==========================================================================
--------------------------------------------------------------------------------

The same happens if I use ffplay:

--------------------------------------------------------------------------------
ffplay -stats t125.avi 
    Input #0, avi, from 't125.avi':
      Duration: 00:00:03.0, start: 0.000000, bitrate: 369 kb/s
      Stream #0.0: Video: mpeg4, yuv420p, 384x288, 25.00 fps(r)
       4.39 A-V:  0.000 aq=    0KB vq=    0KB sq=    0B    
--------------------------------------------------------------------------------

If the video is created with a frame rate of 12, the mplayer demuxer as well
as the FFmpeg demuxer work correctly:

--------------------------------------------------------------------------------
ffmpeg -i input.avi -vcodec mpeg4 -r 12 t12.avi
    Output #0, avi, to 't12.avi':
      Stream #0.0, 1/90000: Video: mpeg4, yuv420p, 384x288, 1/12, q=2-31, 200 kb/s, 12.00 fps(c)

mplayer t12.avi 
    VIDEO:  [FMP4]  384x288  24bpp  12.000 fps  353.6 kbps (43.2 kbyte/s)
    Clip info:
     Software: Lavf50.5.0
    ==========================================================================
    Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
    Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
    ==========================================================================

mplayer -demuxer lavf t12.avi 
    VIDEO:  [FMP4]  384x288  24bpp  12.000 fps    0.0 kbps ( 0.0 kbyte/s)
    ==========================================================================
    Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
    Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
    ==========================================================================

ffplay -stats t12.avi 
    Input #0, avi, from 't12.avi':
      Duration: 00:00:03.0, start: 0.000000, bitrate: 370 kb/s
      Stream #0.0: Video: mpeg4, yuv420p, 384x288, 12.00 fps(r)
       1.17 A-V:  0.000 aq=    0KB vq=   57KB sq=    0B    
--------------------------------------------------------------------------------

This is with the following program versions:
    mplayer:
        MPlayer dev-SVN-r20018-3.3.5 (C) 2000-2006 MPlayer Team
    ffplay:
        ffplay version SVN-r6522, Copyright (c) 2003-2006 Fabrice Bellard, et al.
    ffmpeg:
        ffmpeg      SVN-r6522
        libavutil   3211265
        libavcodec  3346432
        libavformat 3278080
i.e. SVN checkouts from today.

The two test videos can be found at (138k and 140k):
    http://www.techfak.uni-bielefeld.de/~floemker/t125.avi
    http://www.techfak.uni-bielefeld.de/~floemker/t12.avi

Regards,

Frank




More information about the ffmpeg-devel mailing list