Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#5035 closed defect (worksforme)

fps filter does not duplicate input frame #0

Reported by: ryanwilliams Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: fps
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
fps filter only outputs desired the frame rate after the second input frame is encountered. In the following example the output video does not achieve the desired frame rate until 00:05.

ffmpeg -threads 0 -y -i Slideshow.MOV -filter_complex "[0:v] fps='fps=25', drawtext='fontfile=calibri.ttf:fontsize=32:text=%{n}:x=20:y=20:fontcolor=white:box=1:boxcolor=0x00000099'" -an -r 25 Slideshow.mp4

Attachments (3)

Slideshow.MOV (1.4 MB) - added by ryanwilliams 3 years ago.
calibri.ttf (792.8 KB) - added by ryanwilliams 3 years ago.
Slideshow (Output).mp4 (1.7 MB) - added by ryanwilliams 3 years ago.

Change History (9)

Changed 3 years ago by ryanwilliams

Changed 3 years ago by ryanwilliams

comment:1 Changed 3 years ago by ryanwilliams

  • Component changed from undetermined to avfilter
  • Keywords fps added
  • Version changed from unspecified to git-master

comment:2 Changed 3 years ago by cehoyos

Why are you using both the fps filter and the output option -r? Typically, only one of them is used.
Please provide the command line that allows to reproduce the issue together with the complete, uncut console output to make this a valid ticket.

comment:3 Changed 3 years ago by ryanwilliams

Console commands are below. The issue appears when you watch the output movie.
The frame counter which is drawn on by 'drawtext' does not increment beyond 0 until 5 seconds into the movie.

[root@ryan tmp]# wget http://tempsend.com/D6FFD35AE4/0B5B/calibri.ttf
[root@ryan tmp]# wget http://tempsend.com/05AAEDE44D/FFB2/Slideshow.MOV

[root@ryan tmp]# ffmpeg -threads 0 -y -i Slideshow.MOV -filter_complex "[0:v] fps='fps=25', drawtext='fontfile=calibri.ttf:fontsize=32:text=%{n}:x=20:y=20:fontcolor=white:box=1:boxcolor=0x00000099'" -an -r 25 Slideshow.mp4

ffmpeg version 2.8.2-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2015 the FFmpeg developers

built with gcc 5.2.1 (Debian 5.2.1-23) 20151028
configuration: --enable-gpl --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --enable-libass --enable-gnutls --enable-libvidstab --enable-libsoxr --enable-frei0r --enable-libfribidi --disable-indev=sndio --disable-outdev=sndio --cc=gcc
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Slideshow.MOV':

Metadata:

major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2013-01-13 08:26:52

Duration: 00:00:55.00, start: 0.000000, bitrate: 206 kb/s

Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 126 kb/s (default)
Metadata:

creation_time : 2013-01-13 08:26:52
handler_name : Core Media Data Handler

Stream #0:1(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 320x460, 78 kb/s, 0.20 fps, 0.20 tbr, 600 tbn, 1200 tbc (default)
Metadata:

creation_time : 2013-01-13 08:26:52
handler_name : Core Media Data Handler
encoder : H.264

[libx264 @ 0x55fac80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x55fac80] profile High, level 2.1
[libx264 @ 0x55fac80] 264 - core 148 r209 7599210 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=14 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'Slideshow.mp4':

Metadata:

major_brand : qt
minor_version : 0
compatible_brands: qt
encoder : Lavf56.40.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 320x460, q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
Metadata:

encoder : Lavc56.60.100 libx264

Stream mapping:

Stream #0:1 (h264) -> fps
drawtext -> Stream #0:0 (libx264)

Press [q] to stop, ? for help
[output stream 0:0 @ 0x563cf80] 100 buffers queued in output stream 0:0, something may be wrong.
Past duration 123.999992 too large

Last message repeated 623 times

Past duration 123.999992 too large 207kB time=00:00:27.56 bitrate= 61.4kbits/s dup=124 drop=0

Last message repeated 624 times

Past duration 123.999992 too large 432kB time=00:00:52.56 bitrate= 67.4kbits/s dup=124 drop=0
frame= 1375 fps=1085 q=-1.0 Lsize= 464kB time=00:00:54.92 bitrate= 69.2kbits/s dup=124 drop=0
video:447kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.793817%
[libx264 @ 0x55fac80] frame I:10 Avg QP:15.34 size: 28673
[libx264 @ 0x55fac80] frame P:343 Avg QP:20.96 size: 206
[libx264 @ 0x55fac80] frame B:1022 Avg QP:30.35 size: 98
[libx264 @ 0x55fac80] consecutive B-frames: 0.9% 0.0% 0.2% 98.9%
[libx264 @ 0x55fac80] mb I I16..4: 8.1% 45.3% 46.6%
[libx264 @ 0x55fac80] mb P I16..4: 0.0% 0.2% 0.3% P16..4: 0.8% 0.3% 0.3% 0.0% 0.0% skip:98.2%
[libx264 @ 0x55fac80] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.4% 0.2% 0.2% direct: 0.1% skip:99.1% L0:53.9% L1:39.8% BI: 6.3%
[libx264 @ 0x55fac80] 8x8 transform intra:42.7% inter:10.8%
[libx264 @ 0x55fac80] coded y,uvDC,uvAC intra: 88.2% 83.0% 73.4% inter: 0.3% 0.1% 0.0%
[libx264 @ 0x55fac80] i16 v,h,dc,p: 27% 15% 13% 45%
[libx264 @ 0x55fac80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 18% 16% 5% 5% 7% 7% 8% 9%
[libx264 @ 0x55fac80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 21% 11% 6% 6% 7% 7% 9% 8%
[libx264 @ 0x55fac80] i8c dc,h,v,p: 44% 24% 23% 9%
[libx264 @ 0x55fac80] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x55fac80] ref P L0: 59.0% 3.7% 17.9% 19.3%
[libx264 @ 0x55fac80] ref B L0: 61.0% 30.2% 8.8%
[libx264 @ 0x55fac80] ref B L1: 91.0% 9.0%
[libx264 @ 0x55fac80] kb/s:66.50
[root@ryan tmp]#

comment:4 Changed 3 years ago by cehoyos

Please test current FFmpeg git head and please remove -r 25 from the command line or explain why you are using it together with the fps filter.
If the issue is reproducible without using an external library (libx264) please use -vcodec mpeg4.

comment:5 Changed 3 years ago by ryanwilliams

I have no explanation for the -r parameter it is an error on my part.
I have tested using latest head, vcodec mpeg4 and without the -r 25 parameter and the problem persists.

[root@ryan ffmpeg]# pwd
/root/ffmpeg

[root@ryan ffmpeg]# git remote --verbose
origin git://source.ffmpeg.org/ffmpeg.git (fetch)
origin git://source.ffmpeg.org/ffmpeg.git (push)

[root@ryan ffmpeg]# git pull
Already up-to-date.

[root@ryan ffmpeg]# make -j 20

[root@ryan ffmpeg]# cd /root/tmp/

[root@ryan tmp]# ls
calibri.ttf Slideshow.MOV

[root@ryan tmp]# /root/ffmpeg/ffmpeg -threads 0 -y -i Slideshow.MOV -filter_complex "[0:v] fps='fps=25', drawtext='fontfile=calibri.ttf:fontsize=32:text=%{n}:x=20:y=20:fontcolor=white:box=1:boxcolor=0x00000099'" -an -vcodec mpeg4 Slideshow.mp4

ffmpeg version N-76829-g839eb1c Copyright (c) 2000-2015 the FFmpeg developers

built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-9)
configuration: --enable-libfreetype
libavutil 55. 9.100 / 55. 9.100
libavcodec 57. 16.100 / 57. 16.100
libavformat 57. 19.100 / 57. 19.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 15.100 / 6. 15.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Slideshow.MOV':

Metadata:

major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2013-01-13 08:26:52

Duration: 00:00:55.00, start: 0.000000, bitrate: 206 kb/s

Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 126 kb/s (default)
Metadata:

creation_time : 2013-01-13 08:26:52
handler_name : Core Media Data Handler

Stream #0:1(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 320x460, 78 kb/s, 0.20 fps, 0.20 tbr, 600 tbn, 1200 tbc (default)
Metadata:

creation_time : 2013-01-13 08:26:52
handler_name : Core Media Data Handler
encoder : H.264

Output #0, mp4, to 'Slideshow.mp4':

Metadata:

major_brand : qt
minor_version : 0
compatible_brands: qt
encoder : Lavf57.19.100
Stream #0:0: Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 320x460, q=2-31, 200 kb/s, 25 fps, 12800 tbn, 25 tbc (default)
Metadata:

encoder : Lavc57.16.100 mpeg4

Stream mapping:

Stream #0:1 (h264) -> fps
drawtext -> Stream #0:0 (mpeg4)

Press [q] to stop, ? for help
[output stream 0:0 @ 0x20ba060] 100 buffers queued in output stream 0:0, something may be wrong.
Past duration 123.999992 too large

Last message repeated 623 times

Past duration 123.999992 too large 1077kB time=00:00:29.96 bitrate= 294.6kbits/s dup=124 drop=0

Last message repeated 624 times

Past duration 123.999992 too large 1683kB time=00:00:54.96 bitrate= 250.9kbits/s dup=124 drop=0
frame= 1375 fps=1163 q=10.5 Lsize= 1697kB time=00:00:55.00 bitrate= 252.8kbits/s dup=124 drop=0
video:1691kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.395626%
[root@ryan tmp]#

Changed 3 years ago by ryanwilliams

comment:6 Changed 3 years ago by ryanwilliams

  • Resolution set to worksforme
  • Status changed from new to closed

My problem occurred because video frame 1 in the output file was located after the 220,000th (5 seconds) audio frame. The problem observed during playback can be eliminated with a 5 second decoding buffer.

Last edited 3 years ago by ryanwilliams (previous) (diff)
Note: See TracTickets for help on using tickets.