Opened 11 years ago

Closed 7 years ago

#2674 closed defect (fixed)

fps filter changes video length

Reported by: Carl Eugen Hoyos Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: fps
Cc: anantapalani@gmail.com, rogerdpack@gmail.com, derek.buitenhuis@gmail.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

The fps filter fails for the last frame and changes video length.
$ ffmpeg -f lavfi -i testsrc=r=24 -t 1 -qscale 2 24fps.avi

$ ffmpeg -loglevel verbose -i 24fps.avi -vf fps=48 48fps.avi
ffmpeg version N-54036-g6c4516d Copyright (c) 2000-2013 the FFmpeg developers
  built on Jun 15 2013 18:04:13 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52. 35.101 / 52. 35.101
  libavcodec     55. 16.100 / 55. 16.100
  libavformat    55.  8.102 / 55.  8.102
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 77.101 /  3. 77.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, avi, from '24fps.avi':
  Metadata:
    encoder         : Lavf55.8.102
  Duration: 00:00:01.00, start: 0.000000, bitrate: 363 kb/s
    Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 24 tbr, 24 tbn, 24 tbc
[Parsed_fps_0 @ 0x2c7cfe0] fps=48/1
[graph 0 input from stream 0:0 @ 0x2c7d9c0] w:320 h:240 pixfmt:yuv420p tb:1/24 fr:24/1 sar:1/1 sws_param:flags=2
Output #0, avi, to '48fps.avi':
  Metadata:
    ISFT            : Lavf55.8.102
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 48 tbn, 48 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 -> mpeg4)
Press [q] to stop, [?] for help
No more output streams to write to, finishing.
frame=   47 fps=0.0 q=2.0 Lsize=      66kB time=00:00:00.97 bitrate= 553.6kbits/s
video:59kB audio:0kB subtitle:0 global headers:0kB muxing overhead 11.355420%
[Parsed_fps_0 @ 0x2c7cfe0] 24 frames in, 47 frames out; 0 frames dropped, 23 frames duplicated.
$ ffmpeg -loglevel verbose -i 24fps.avi -vf fps=12 12fps.avi
ffmpeg version N-54036-g6c4516d Copyright (c) 2000-2013 the FFmpeg developers
  built on Jun 15 2013 18:04:13 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52. 35.101 / 52. 35.101
  libavcodec     55. 16.100 / 55. 16.100
  libavformat    55.  8.102 / 55.  8.102
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 77.101 /  3. 77.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, avi, from '24fps.avi':
  Metadata:
    encoder         : Lavf55.8.102
  Duration: 00:00:01.00, start: 0.000000, bitrate: 363 kb/s
    Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 24 tbr, 24 tbn, 24 tbc
[Parsed_fps_0 @ 0x1c24fe0] fps=12/1
[graph 0 input from stream 0:0 @ 0x1c259c0] w:320 h:240 pixfmt:yuv420p tb:1/24 fr:24/1 sar:1/1 sws_param:flags=2
Output #0, avi, to '12fps.avi':
  Metadata:
    ISFT            : Lavf55.8.102
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 12 tbn, 12 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg4 -> mpeg4)
Press [q] to stop, [?] for help
No more output streams to write to, finishing.
frame=   13 fps=0.0 q=1.6 Lsize=      37kB time=00:00:01.08 bitrate= 277.6kbits/s
video:31kB audio:0kB subtitle:0 global headers:0kB muxing overhead 19.286666%
[Parsed_fps_0 @ 0x1c24fe0] 24 frames in, 13 frames out; 11 frames dropped, 0 frames duplicated.

The second case - -vf fps=12 - can be fixed by using -vf fps=12:zero (and -vf fps=12:down) but I wonder why this is necessary when dividing an even frame-rate by two.

Change History (6)

comment:1 by Ananta Palani, 10 years ago

Cc: anantapalani@gmail.com added

comment:2 by Roger Pack, 9 years ago

So you're saying it changes from 1.0s to 1.08s being the problem (is that one extra frame?)

comment:4 by Roger Pack, 8 years ago

Cc: rogerdpack@gmail.com added

comment:5 by dbuitenh, 7 years ago

Cc: derek.buitenhuis@gmail.com added

comment:6 by Carl Eugen Hoyos, 7 years ago

Resolution: fixed
Status: newclosed

Fixed by Thierry Foucu in eea64ef4cfb593cbe28465f45e6bd4c41a79cae1

Note: See TracTickets for help on using tickets.