Opened 2 years ago

Closed 2 years ago

Last modified 22 months ago

#5856 closed defect (needs_more_info)

filter_complex significantly slower than -vf for the same task.

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

Description

To record from webcam and microphone and overlay a resized logo, using complex_filter I achieve about 20fps (on a fast pc with less than 15% cpu load), using the same features but with -vf I get full realtime 30fps...
I know this is normal because the complex filter has more options and it's more flexible, but IMHO this should not happen...

Example:
Record live feed from webcam and microphone, overlay a logo and save to flv..

ffmpeg -f dshow -video_size qpal -rtbufsize 1G -copyts -framerate 30 -i video="BisonCam?, NB Pro" -i "C:\Users\Zibri\Downloads\scdc.png" -filter_complex "[1]scale=80x60,[0]overlay=W-w-5:H-h-5" -f dshow -i audio="Microphone (Realtek High Definition Audio)" -codec:v libx264 -preset fast -b:v 500k -b:a 128k -minrate 500k -maxrate 500k -bufsize 1500k -f flv test7.flv

result:

ffmpeg version N-81696-gd38dff8e Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 57.100 / 57. 57.100
  libavformat    57. 49.100 / 57. 49.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 62.100 /  6. 62.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, dshow, from 'video=BisonCam, NB Pro':
  Duration: N/A, start: 128270.189000, bitrate: N/A
    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 352x288, 30 fps, 30 tbr, 10000k tbn, 10000k tbc
Input #1, png_pipe, from 'C:\Users\Zibri\Downloads\scdc.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 244x224 [SAR 5905:5905 DAR 61:56], 25 tbr, 25 tbn, 25 tbc
Guessed Channel Layout for Input Stream #2.0 : stereo
Input #2, dshow, from 'audio=Microphone (Realtek High Definition Audio)':
  Duration: N/A, start: 128270.631000, bitrate: 1411 kb/s
    Stream #2:0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
File 'test7.flv' already exists. Overwrite ? [y/N] y
[swscaler @ 00000000074504a0] deprecated pixel format used, make sure you did set range correctly
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0000000002627c00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0000000002627c00] profile High, level 1.3
[libx264 @ 0000000002627c00] 264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 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=9 lookahead_threads=1 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=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=30 rc=cbr mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=500 vbv_bufsize=1500 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
[flv @ 00000000026ae8e0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, flv, to 'test7.flv':
  Metadata:
    encoder         : Lavf57.49.100
    Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuvj420p(pc), 352x288, q=-1--1, 500 kb/s, 30 fps, 1k tbn, 30 tbc (default)
    Metadata:
      encoder         : Lavc57.57.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 500000/0/500000 buffer size: 1500000 vbv_delay: -1
    Stream #0:1: Audio: mp3 (libmp3lame) ([2][0][0][0] / 0x0002), 44100 Hz, stereo, s16p, 128 kb/s
    Metadata:
      encoder         : Lavc57.57.100 libmp3lame
Stream mapping:
  Stream #0:0 (mjpeg) -> overlay:main (graph 0)
  Stream #1:0 (png) -> scale (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)
  Stream #2:0 -> #0:1 (pcm_s16le (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[dshow @ 00000000025c2cc0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
frame=   43 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   51 fps= 50 q=22.0 size=      50kB time=35:37:51.02 bitrate=   0.0kbits/frame=   58 fps= 38 q=24.0 size=      84kB time=35:37:51.53 bitrate=   0.0kbits/frame=   66 fps= 33 q=24.0 size=     124kB time=35:37:52.03 bitrate=   0.0kbits/frame=   74 fps= 29 q=23.0 size=     159kB time=35:37:52.52 bitrate=   0.0kbits/frame=   81 fps= 27 q=22.0 size=     188kB time=35:37:53.02 bitrate=   0.0kbits/frame=   89 fps= 25 q=23.0 size=     228kB time=35:37:53.51 bitrate=   0.0kbits/frame=   96 fps= 24 q=23.0 size=     265kB time=35:37:54.01 bitrate=   0.0kbits/frame=  104 fps= 23 q=22.0 size=     304kB time=35:37:54.53 bitrate=   0.0kbits/frame=  111 fps= 22 q=22.0 size=     335kB time=35:37:55.03 bitrate=   0.0kbits/frame=  119 fps= 21 q=21.0 size=     372kB time=35:37:55.52 bitrate=   0.0kbits/frame=  126 fps= 21 q=22.0 size=     407kB time=35:37:56.02 bitrate=   0.0kbits/frame=  134 fps= 20 q=22.0 size=     446kB time=35:37:56.52 bitrate=   0.0kbits/frame=  141 fps= 20 q=22.0 size=     481kB time=35:37:57.01 bitrate=   0.0kbits/frame=  149 fps= 20 q=22.0 size=     521kB time=35:37:57.51 bitrate=   0.0kbits/frame=  157 fps= 19 q=22.0 size=     561kB time=35:37:58.03 bitrate=   0.0kbits/frame=  164 fps= 19 q=22.0 size=     593kB time=35:37:58.53 bitrate=   0.0kbits/frame=  172 fps= 19 q=22.0 size=     633kB time=35:37:59.02 bitrate=   0.0kbits/frame=  179 fps= 19 q=22.0 size=     670kB time=35:37:59.52 bitrate=   0.0kbits/frame=  187 fps= 19 q=22.0 size=     711kB time=35:38:00.02 bitrate=   0.0kbits/frame=  194 fps= 18 q=22.0 size=     746kB time=35:38:00.51 bitrate=   0.0kbits/frame=  202 fps= 18 q=22.0 size=     786kB time=35:38:01.01 bitrate=   0.1kbits/frame=  210 fps= 18 q=22.0 size=     825kB time=35:38:01.53 bitrate=   0.1kbits/frame=  217 fps= 18 q=23.0 size=     862kB time=35:38:02.03 bitrate=   0.1kbits/frame=  225 fps= 18 q=23.0 size=     905kB time=35:38:02.53 bitrate=   0.1kbits/frame=  232 fps= 18 q=20.0 size=     936kB time=35:38:03.02 bitrate=   0.1kbits/frame=  240 fps= 18 q=24.0 size=     980kB time=35:38:03.52 bitrate=   0.1kbits/frame=  247 fps= 17 q=24.0 size=    1024kB time=35:38:04.01 bitrate=   0.1kbits/frame=  255 fps= 17 q=24.0 size=    1067kB time=35:38:04.51 bitrate=   0.1kbits/frame=  263 fps= 17 q=24.0 size=    1111kB time=35:38:05.03 bitrate=   0.1kbits/frame=  270 fps= 17 q=23.0 size=    1152kB time=35:38:05.53 bitrate=   0.1kbits/frame=  278 fps= 17 q=23.0 size=    1195kB time=35:38:06.03 bitrate=   0.1kbits/frame=  285 fps= 17 q=24.0 size=    1231kB time=35:38:06.52 bitrate=   0.1kbits/frame=  293 fps= 17 q=24.0 size=    1267kB time=35:38:07.02 bitrate=   0.1kbits/frame=  301 fps= 17 q=23.0 size=    1320kB time=35:38:07.52 bitrate=   0.1kbits/frame=  308 fps= 17 q=24.0 size=    1358kB time=35:38:08.01 bitrate=   0.1kbits/frame=  316 fps= 17 q=24.0 size=    1396kB time=35:38:08.53 bitrate=   0.1kbits/frame=  323 fps= 17 q=23.0 size=    1427kB time=35:38:09.03 bitrate=   0.1kbits/frame=  331 fps= 17 q=23.0 size=    1462kB time=35:38:09.53 bitrate=   0.1kbits/frame=  338 fps= 17 q=23.0 size=    1494kB time=35:38:10.02 bitrate=   0.1kbits/frame=  346 fps= 17 q=24.0 size=    1536kB time=35:38:10.52 bitrate=   0.1kbits/frame=  353 fps= 17 q=23.0 size=    1572kB time=35:38:11.01 bitrate=   0.1kbits/frame=  361 fps= 17 q=23.0 size=    1617kB time=35:38:11.51 bitrate=   0.1kbits/frame=  369 fps= 17 q=24.0 size=    1663kB time=35:38:12.03 bitrate=   0.1kbits/frame=  376 fps= 17 q=24.0 size=    1701kB time=35:38:12.53 bitrate=   0.1kbits/frame=  384 fps= 17 q=23.0 size=    1743kB time=35:38:13.03 bitrate=   0.1kbits/frame=  391 fps= 16 q=23.0 size=    1772kB time=35:38:13.52 bitrate=   0.1kbits/frame=  399 fps= 16 q=23.0 size=    1810kB time=35:38:14.02 bitrate=   0.1kbits/frame=  406 fps= 16 q=23.0 size=    1842kB time=35:38:14.52 bitrate=   0.1kbits/frame=  414 fps= 16 q=23.0 size=    1885kB time=35:38:15.01 bitrate=   0.1kbits/frame=  422 fps= 16 q=23.0 size=    1926kB time=35:38:15.54 bitrate=   0.1kbits/frame=  429 fps= 16 q=23.0 size=    1972kB time=35:38:16.03 bitrate=   0.1kbits/frame=  437 fps= 16 q=23.0 size=    2015kB time=35:38:16.53 bitrate=   0.1kbits/frame=  444 fps= 16 q=23.0 size=    2053kB time=35:38:17.02 bitrate=   0.1kbits/frame=  452 fps= 16 q=22.0 size=    2090kB time=35:38:17.52 bitrate=   0.1kbits/frame=  460 fps= 16 q=22.0 size=    2125kB time=35:38:18.02 bitrate=   0.1kbits/frame=  467 fps= 16 q=21.0 size=    2157kB time=35:38:18.51 bitrate=   0.1kbits/frame=  475 fps= 16 q=22.0 size=    2197kB time=35:38:19.03 bitrate=   0.1kbits/frame=  482 fps= 16 q=22.0 size=    2229kB time=35:38:19.53 bitrate=   0.1kbits/frame=  490 fps= 16 q=22.0 size=    2268kB time=35:38:20.03 bitrate=   0.1kbits/frame=  497 fps= 16 q=22.0 size=    2304kB time=35:38:20.52 bitrate=   0.1kbits/frame=  505 fps= 16 q=22.0 size=    2344kB time=35:38:21.02 bitrate=   0.1kbits/frame=  513 fps= 16 q=22.0 size=    2383kB time=35:38:21.52 bitrate=   0.2kbits/frame=  520 fps= 16 q=22.0 size=    2417kB time=35:38:22.01 bitrate=   0.2kbits/frame=  528 fps= 16 q=22.0 size=    2456kB time=35:38:22.53 bitrate=   0.2kbits/frame=  535 fps= 16 q=22.0 size=    2490kB time=35:38:23.03 bitrate=   0.2kbits/frame=  543 fps= 16 q=23.0 size=    2526kB time=35:38:23.53 bitrate=   0.2kbits/frame=  550 fps= 16 q=22.0 size=    2579kB time=35:38:24.03 bitrate=   0.2kbits/frame=  558 fps= 16 q=22.0 size=    2618kB time=35:38:24.52 bitrate=   0.2kbits/frame=  566 fps= 16 q=22.0 size=    2657kB time=35:38:25.02 bitrate=   0.2kbits/frame=  573 fps= 16 q=22.0 size=    2691kB time=35:38:25.51 bitrate=   0.2kbits/frame=  581 fps= 16 q=22.0 size=    2730kB time=35:38:26.01 bitrate=   0.2kbits/frame=  588 fps= 16 q=22.0 size=    2762kB time=35:38:26.53 bitrate=   0.2kbits/frame=  596 fps= 16 q=22.0 size=    2801kB time=35:38:27.03 bitrate=   0.2kbits/frame=  604 fps= 16 q=22.0 size=    2840kB time=35:38:27.52 bitrate=   0.2kbits/frame=  611 fps= 16 q=22.0 size=    2875kB time=35:38:28.02 bitrate=   0.2kbits/frame=  619 fps= 16 q=22.0 size=    2915kB time=35:38:28.52 bitrate=   0.2kbits/frame=  626 fps= 16 q=22.0 size=    2952kB time=35:38:29.01 bitrate=   0.2kbits/frame=  634 fps= 16 q=22.0 size=    2991kB time=35:38:29.51 bitrate=   0.2kbits/frame=  641 fps= 16 q=21.0 size=    3025kB time=35:38:30.03 bitrate=   0.2kbits/frame=  649 fps= 16 q=24.0 size=    3066kB time=35:38:30.53 bitrate=   0.2kbits/frame=  650 fps= 16 q=-1.0 Lsize=    3252kB time=35:38:33.37 bitrate=   0.2kbits/s speed=3.08e+003x

Same command using -vf
ffmpeg -f dshow -video_size qpal -rtbufsize 1G -copyts -framerate 30 -i video="BisonCam?, NB Pro" -f dshow -i audio="Microphone (Realtek High Definition Audio)" -vf "movie=scdc.png,scale=80x60 [watermark];[in][watermark] overlay=main_w-overlay_w-5:main_h-overlay_h-5,fps=30 [out]" -codec:v libx264 -preset slow -b:v 500k -b:a 128k -minrate 500k -maxrate 500k -bufsize 1500k -f flv test8.flv

Result:

ffmpeg version N-81696-gd38dff8e Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 57.100 / 57. 57.100
  libavformat    57. 49.100 / 57. 49.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 62.100 /  6. 62.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, dshow, from 'video=BisonCam, NB Pro':
  Duration: N/A, start: 127887.407000, bitrate: N/A
    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 352x288, 30 fps, 30 tbr, 10000k tbn, 10000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, dshow, from 'audio=Microphone (Realtek High Definition Audio)':
  Duration: N/A, start: 127887.822000, bitrate: 1411 kb/s
    Stream #1:0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
[swscaler @ 00000000081166e0] deprecated pixel format used, make sure you did set range correctly
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 00000000024efba0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 00000000024efba0] profile High, level 1.3
[libx264 @ 00000000024efba0] 264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=5 deblock=1:0:0 analyse=0x3:0x113 me=umh subme=8 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=9 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=cbr mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=500 vbv_bufsize=1500 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
[flv @ 00000000080fbae0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, flv, to 'test8.flv':
  Metadata:
    encoder         : Lavf57.49.100
    Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuvj420p(pc), 352x288, q=-1--1, 500 kb/s, 30 fps, 1k tbn, 30 tbc
    Metadata:
      encoder         : Lavc57.57.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 500000/0/500000 buffer size: 1500000 vbv_delay: -1
    Stream #0:1: Audio: mp3 (libmp3lame) ([2][0][0][0] / 0x0002), 44100 Hz, stereo, s16p, 128 kb/s
    Metadata:
      encoder         : Lavc57.57.100 libmp3lame
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[dshow @ 00000000024b2cc0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
frame=   42 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   58 fps= 57 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   frame=   74 fps= 48 q=28.0 size=      35kB time=35:31:28.21 bitrate=   0.0kbits/frame=   88 fps= 43 q=25.0 size=      54kB time=35:31:28.21 bitrate=   0.0kbits/frame=  104 fps= 41 q=25.0 size=      91kB time=35:31:28.72 bitrate=   0.0kbits/frame=  118 fps= 39 q=26.0 size=     130kB time=35:31:29.22 bitrate=   0.0kbits/frame=  134 fps= 38 q=26.0 size=     172kB time=35:31:29.71 bitrate=   0.0kbits/frame=  148 fps= 36 q=23.0 size=     203kB time=35:31:30.21 bitrate=   0.0kbits/frame=  164 fps= 36 q=23.0 size=     242kB time=35:31:30.70 bitrate=   0.0kbits/frame=  180 fps= 35 q=23.0 size=     281kB time=35:31:31.72 bitrate=   0.0kbits/frame=  194 fps= 35 q=23.0 size=     316kB time=35:31:31.72 bitrate=   0.0kbits/frame=  210 fps= 34 q=23.0 size=     358kB time=35:31:32.72 bitrate=   0.0kbits/frame=  226 fps= 34 q=23.0 size=     398kB time=35:31:33.21 bitrate=   0.0kbits/frame=  240 fps= 34 q=25.0 size=     436kB time=35:31:33.71 bitrate=   0.0kbits/frame=  256 fps= 34 q=23.0 size=     476kB time=35:31:34.20 bitrate=   0.0kbits/frame=  272 fps= 33 q=24.0 size=     519kB time=35:31:34.70 bitrate=   0.0kbits/frame=  286 fps= 33 q=24.0 size=     555kB time=35:31:35.22 bitrate=   0.0kbits/frame=  302 fps= 33 q=24.0 size=     596kB time=35:31:35.72 bitrate=   0.0kbits/frame=  316 fps= 33 q=24.0 size=     650kB time=35:31:36.22 bitrate=   0.0kbits/frame=  332 fps= 33 q=25.0 size=     692kB time=35:31:36.71 bitrate=   0.0kbits/frame=  346 fps= 32 q=24.0 size=     725kB time=35:31:37.21 bitrate=   0.0kbits/frame=  362 fps= 32 q=23.0 size=     764kB time=35:31:37.70 bitrate=   0.0kbits/frame=  378 fps= 32 q=23.0 size=     802kB time=35:31:38.20 bitrate=   0.1kbits/frame=  392 fps= 32 q=23.0 size=     836kB time=35:31:38.72 bitrate=   0.1kbits/frame=  408 fps= 32 q=24.0 size=     875kB time=35:31:39.22 bitrate=   0.1kbits/frame=  424 fps= 32 q=25.0 size=     915kB time=35:31:39.72 bitrate=   0.1kbits/frame=  438 fps= 32 q=25.0 size=     951kB time=35:31:40.21 bitrate=   0.1kbits/frame=  455 fps= 32 q=26.0 size=    1001kB time=35:31:40.71 bitrate=   0.1kbits/frame=  468 fps= 32 q=26.0 size=    1040kB time=35:31:41.20 bitrate=   0.1kbits/frame=  484 fps= 32 q=25.0 size=    1090kB time=35:31:41.70 bitrate=   0.1kbits/frame=  498 fps= 32 q=25.0 size=    1130kB time=35:31:42.22 bitrate=   0.1kbits/frame=  515 fps= 32 q=26.0 size=    1181kB time=35:31:42.72 bitrate=   0.1kbits/frame=  530 fps= 32 q=26.0 size=    1218kB time=35:31:43.22 bitrate=   0.1kbits/frame=  544 fps= 32 q=26.0 size=    1253kB time=35:31:43.71 bitrate=   0.1kbits/frame=  559 fps= 32 q=26.0 size=    1289kB time=35:31:44.21 bitrate=   0.1kbits/frame=  575 fps= 32 q=25.0 size=    1343kB time=35:31:44.70 bitrate=   0.1kbits/frame=  590 fps= 31 q=26.0 size=    1379kB time=35:31:45.20 bitrate=   0.1kbits/frame=  605 fps= 31 q=24.0 size=    1415kB time=35:31:45.72 bitrate=   0.1kbits/frame=  621 fps= 31 q=25.0 size=    1451kB time=35:31:46.22 bitrate=   0.1kbits/frame=  635 fps= 31 q=25.0 size=    1485kB time=35:31:46.72 bitrate=   0.1kbits/frame=  651 fps= 31 q=24.0 size=    1520kB time=35:31:47.21 bitrate=   0.1kbits/frame=  665 fps= 31 q=26.0 size=    1555kB time=35:31:47.71 bitrate=   0.1kbits/frame=  681 fps= 31 q=23.0 size=    1589kB time=35:31:48.21 bitrate=   0.1kbits/frame=  696 fps= 31 q=26.0 size=    1624kB time=35:31:48.70 bitrate=   0.1kbits/frame=  711 fps= 31 q=23.0 size=    1664kB time=35:31:49.22 bitrate=   0.1kbits/frame=  727 fps= 31 q=23.0 size=    1706kB time=35:31:49.72 bitrate=   0.1kbits/frame=  741 fps= 31 q=24.0 size=    1747kB time=35:31:50.22 bitrate=   0.1kbits/frame=  757 fps= 31 q=24.0 size=    1788kB time=35:31:50.71 bitrate=   0.1kbits/frame=  771 fps= 31 q=-1.0 Lsize=    1964kB time=35:31:53.00 bitrate=   0.1kbits/s speed=5.08e+003x

The fisrt command settles after a few minutes around 10-15 fps.
The second one stays steady at 30 fps (camera is 30fps).

Note the bitrate is also broken and showing wrong.

Another note: when playing with ffplay I get normal video in both cases... and ffplay says it's 30fps anso "test7" which as you saw goes down to 16 when recording..

ffplay test7.flv
ffplay version N-81696-gd38dff8e Copyright (c) 2003-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 57.100 / 57. 57.100
  libavformat    57. 49.100 / 57. 49.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 62.100 /  6. 62.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
[flv @ 000000000068cf20] video stream discovered after head already parsed
[flv @ 000000000068cf20] audio stream discovered after head already parsed
Input #0, flv, from 'test7.flv':
  Metadata:
    encoder         : Lavf57.49.100
  Duration: 00:00:43.47, start: 128270.205000, bitrate: 612 kb/s
    Stream #0:0: Video: h264 (High), yuvj420p(pc), 352x288, 30.30 fps, 15 tbr, 1k tbn, 60 tbc
    Stream #0:1: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
[swscaler @ 0000000003697f80] deprecated pixel format used, make sure you did set range correctly
128310.59 A-V:-27.441 fd=   4 aq=    0KB vq=    0KB sq=    0B f=0/0

and this is ffplay output for test8.flv (which encoded at 30fps)

ffplay test8.flv
ffplay version N-81696-gd38dff8e Copyright (c) 2003-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 57.100 / 57. 57.100
  libavformat    57. 49.100 / 57. 49.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 62.100 /  6. 62.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
[flv @ 000000000002cf20] video stream discovered after head already parsed
[flv @ 000000000002cf20] audio stream discovered after head already parsed
Input #0, flv, from 'test8.flv':
  Metadata:
    encoder         : Lavf57.49.100
  Duration: 00:00:25.77, start: 127887.400000, bitrate: 624 kb/s
    Stream #0:0: Video: h264 (High), yuvj420p(pc), 352x288, 30.30 fps, 30 tbr, 1k tbn, 60 tbc
    Stream #0:1: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
[swscaler @ 00000000032eec40] deprecated pixel format used, make sure you did set range correctly
127911.28 A-V: -7.358 fd=  10 aq=    0KB vq=    0KB sq=    0B f=0/0

And here is ffprobe output:

C:\>ffprobe -v error -select_streams v:0 -show_entries stream=avg_frame_rate -of default=noprint_wrappers=1:nokey=1 test7.flv
1000/33

C:\>ffprobe -v error -select_streams v:0 -show_entries stream=avg_frame_rate -of default=noprint_wrappers=1:nokey=1 test8.flv
1000/33

Can you explain this behaviour and why the fps is so different while recording?

Change History (6)

comment:1 in reply to: ↑ description Changed 2 years ago by cehoyos

  • Keywords vf filter_complex speed bitrate removed
  • Priority changed from important to normal
  • Version changed from unspecified to git-master

Replying to Zibri:

Can you explain this behaviour and why the fps is so different while recording?

Do you need support or do you want to report an issue?

comment:2 Changed 2 years ago by Zibri

if you read my ticket, you will understand if it is an issue or not. In my opinion it is an issue (multiple ones).

comment:3 Changed 2 years ago by richardpl

One command uses preset slow and another one uses preset fast.
I failed to reproduce using just overlay and movie filter.

comment:4 Changed 2 years ago by richardpl

Could you try with same encoding parameters, same preset?

comment:5 Changed 2 years ago by richardpl

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

Feel free to reopen once you provide proper commands.

comment:6 Changed 22 months ago by Misaki

The command that uses the slow preset has the highest fps during recording. The fast preset command is slow.

Some complications: a live source, the minor changes made to change from complex filtergraph to a 'simple' one. What happens if you use a video file as the input and change the '-vf' in the second command back to '-lavfi' or '-filter_complex'?

In my experience, filter_complex uses bilinear filter for scaling by default instead of bicubic, and sometimes has varied output between runs instead of always the same for vf, but haven't noticed it to be slower.

I did once find that having an extra filter (showinfo) seemed to result in better performance, but I think this might actually have been due to keeping CPU or GPU at a high frequency.

Note: See TracTickets for help on using tickets.