Opened 9 years ago

Closed 3 years ago

Last modified 3 years ago

#4076 closed defect (fixed)

Poor performance when using unsharp filter on multiple outputs

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

Description

Summary of the bug: When using FFmpeg to encode two seperate video outputs from a single video source, performance drops significantly when using the "unsharp" video filter on BOTH outputs. If only used on one of the two outputs, performance appears normal.

This is a problem particularly when using a DirectShow source, since the real-time buffer will almost immediately fill and cause dropped frames/out of sync audio making it impossible to stream from a live video source.

First sample, showing the issue, notice the poor fps (input framerate is 59.94 fps) and real-time buffer errors causing frame drops, CPU usage is 40% or lower.

cmd> ffmpeg -rtbufsize 902000k -f dshow -r 60000/1001 -video_size 1280x720 -pixel_format uyvy422 -i video="Decklink Video Capture":audio="Decklink Audio Capture" -vcodec libx264 -vf "unsharp=5:5:0.2:5:5:0.0" -preset medium -profile main -maxrate 1600k -bufsize 2000k -s 960x540 -pix_fmt yuv420p -acodec aac -strict -2 -ab 96k -ar 44100 -af "volume=3" -f flv -y "hd.flv" -vcodec libx264 -vf "unsharp=5:5:0.2:5:5:0.0,fps=fps=30" -preset medium -profile main -maxrate 900k -bufsize 2000k -s 854x480 -pix_fmt yuv420p -acodec aac -strict -2 -ab 96k -ar 44100 -af "volume=3" -f flv -y "sd.flv"



ffmpeg version N-66809-g20df026 Copyright (c) 2000-2014 the FFmpeg developers
  built on Oct 11 2014 23:42:02 with gcc 4.9.1 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-li
bass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-lib
opencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --en
able-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      54. 10.100 / 54. 10.100
  libavcodec     56.  4.101 / 56.  4.101
  libavformat    56.  9.100 / 56.  9.100
  libavdevice    56.  1.100 / 56.  1.100
  libavfilter     5.  1.103 /  5.  1.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  1.100 / 53.  1.100
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, dshow, from 'video=Decklink Video Capture:audio=Decklink Audio Capture':
  Duration: N/A, start: 1799667.924000, bitrate: 1536 kb/s
    Stream #0:0: Video: rawvideo (HDYC / 0x43594448), uyvy422(tv), 1280x720, 59.94 tbr, 10000k tbn, 59.94 tbc
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Please use -profile:a or -profile:v, -profile is ambiguous
    Last message repeated 1 times
[libx264 @ 0000000002b451c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000000002b451c0] profile Main, level 3.2
[libx264 @ 0000000002b451c0] 264 - core 142 r2479 dd79a61 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 a
nalyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 looka
head_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 ke
yint=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 vbv_maxrate=1600 vbv_bufsize=2000 crf_max=0.0 nal_h
rd=none filler=0 ip_ratio=1.40 aq=1:1.00
[libx264 @ 0000000002b510c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000000002b510c0] profile Main, level 3.1
[libx264 @ 0000000002b510c0] 264 - core 142 r2479 dd79a61 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 a
nalyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 looka
head_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 ke
yint=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 vbv_maxrate=900 vbv_bufsize=2000 crf_max=0.0 nal_hr
d=none filler=0 ip_ratio=1.40 aq=1:1.00
Output #0, flv, to 'hd.flv':
  Metadata:
    encoder         : Lavf56.9.100
    Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 960x540, q=-1--1, max. 1600 kb/s, 59.94 fps, 1k tbn, 59.94 tbc
    Metadata:
      encoder         : Lavc56.4.101 libx264
    Stream #0:1: Audio: aac ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 96 kb/s
    Metadata:
      encoder         : Lavc56.4.101 aac
Output #1, flv, to 'sd.flv':
  Metadata:
    encoder         : Lavf56.9.100
    Stream #1:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 854x480, q=-1--1, max. 900 kb/s, 30 fps, 1k tbn, 30 tbc
    Metadata:
      encoder         : Lavc56.4.101 libx264
    Stream #1:1: Audio: aac ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 96 kb/s
    Metadata:
      encoder         : Lavc56.4.101 aac
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))
  Stream #0:0 -> #1:0 (rawvideo (native) -> h264 (libx264))
  Stream #0:1 -> #1:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 3 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 1 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 2 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 4 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 4 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 3 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 3 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 2 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 4 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 4 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 2 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 3 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 1 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 4 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 3 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 2 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 1 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 5 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 4 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 2 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (63% of size: 902000000)! frame dropped!
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 1 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 4 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (63% of size: 902000000)! frame dropped!
    Last message repeated 3 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (63% of size: 902000000)! frame dropped!
    Last message repeated 2 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
    Last message repeated 2 times
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (62% of size: 902000000)! frame dropped!
frame= 3421 fps= 54 q=-1.0 Lq=-1.0 size=    4735kB time=00:00:57.84 bitrate= 670.6kbits/s
video:6905kB audio:1361kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0000000002b451c0] frame I:14    Avg QP:23.09  size: 64400
[libx264 @ 0000000002b451c0] frame P:867   Avg QP:25.62  size:  2697
[libx264 @ 0000000002b451c0] frame B:2540  Avg QP:33.32  size:   315
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (66% of size: 902000000)! frame dropped!
[libx264 @ 0000000002b451c0] consecutive B-frames:  0.8%  0.2%  1.1% 97.9%
[libx264 @ 0000000002b451c0] mb I  I16..4: 17.0%  0.0% 83.0%
[libx264 @ 0000000002b451c0] mb P  I16..4:  0.3%  0.0%  0.3%  P16..4: 17.2%  5.8%  4.0%  0.0%  0.0%    skip:72.4%
[libx264 @ 0000000002b451c0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 12.1%  0.3%  0.1%  direct: 0.1%  skip:87.4%  L0:28.8% L1:69.4% BI: 1.8%
[libx264 @ 0000000002b451c0] coded y,uvDC,uvAC intra: 68.4% 68.0% 47.3% inter: 1.6% 2.3% 0.1%
[libx264 @ 0000000002b451c0] i16 v,h,dc,p: 12% 75%  2% 11%
[libx264 @ 0000000002b451c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 31%  9%  5%  6%  7%  7%  6%  6%
[libx264 @ 0000000002b451c0] i8c dc,h,v,p: 39% 36% 19%  6%
[libx264 @ 0000000002b451c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000002b451c0] ref P L0: 71.7% 14.5% 11.0%  2.8%
[libx264 @ 0000000002b451c0] ref B L0: 91.3%  7.9%  0.8%
[libx264 @ 0000000002b451c0] ref B L1: 94.5%  5.5%
[libx264 @ 0000000002b451c0] kb/s:566.24
[libx264 @ 0000000002b510c0] frame I:7     Avg QP:21.65  size: 62974
[libx264 @ 0000000002b510c0] frame P:527   Avg QP:23.57  size:  3940
[libx264 @ 0000000002b510c0] frame B:1178  Avg QP:30.14  size:   435
[libx264 @ 0000000002b510c0] consecutive B-frames:  6.9%  1.3%  8.4% 83.4%
[libx264 @ 0000000002b510c0] mb I  I16..4: 12.8%  0.0% 87.2%
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (67% of size: 902000000)! frame dropped!
[libx264 @ 0000000002b510c0] mb P  I16..4:  0.3%  0.0%  0.5%  P16..4: 22.9%  9.1%  6.6%  0.0%  0.0%    skip:60.6%
[libx264 @ 0000000002b510c0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 15.3%  1.1%  0.2%  direct: 0.3%  skip:83.1%  L0:27.4% L1:68.4% BI: 4.2%
[libx264 @ 0000000002b510c0] coded y,uvDC,uvAC intra: 72.0% 71.9% 53.0% inter: 3.6% 5.2% 0.4%
[libx264 @ 0000000002b510c0] i16 v,h,dc,p: 14% 73%  2% 11%
[libx264 @ 0000000002b510c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 33%  9%  5%  6%  7%  7%  6%  7%
[libx264 @ 0000000002b510c0] i8c dc,h,v,p: 36% 36% 20%  7%
[libx264 @ 0000000002b510c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000002b510c0] ref P L0: 72.2% 13.4% 11.1%  3.3%
[libx264 @ 0000000002b510c0] ref B L0: 92.7%  5.7%  1.5%
[libx264 @ 0000000002b510c0] ref B L1: 94.4%  5.6%
[libx264 @ 0000000002b510c0] kb/s:424.71
[dshow @ 0000000002b42600] real-time buffer[Decklink Video Capture] too full (68% of size: 902000000)! frame dropped!
Received signal 2: terminating.

When using the "unsharp" filter on only one of the single outputs, performance is as expected, encoding in real-time at the input framerate without any real-time buffer errors:

cmd>ffmpeg -rtbufsize 902000k -f dshow -r 60000/1001 -video_size 1280x720 -pixel_format uyvy422 -i video="Decklink Video Capture":audio="Decklink Audio Capture" -vcodec libx264 -vf "unsharp=5:5:0.2:5:5:0.0" -preset medium -profile main -maxrate 1600k -bufsize 2000k -s 960x540 -pix_fmt yuv420p -acodec aac -strict -2 -ab 96k -ar 44100 -af "volume=3" -f flv -y "hd.flv" -vcodec libx264 -vf "fps=fps=30" -preset medium -profile main -maxrate 900k -bufsize 2000k -s 854x480 -pix_fmt yuv420p -acodec aac -strict -2 -ab 96k -ar 44100 -af "volume=3" -f flv -y "sd.flv"


ffmpeg version N-66809-g20df026 Copyright (c) 2000-2014 the FFmpeg developers
  built on Oct 11 2014 23:42:02 with gcc 4.9.1 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-li
bass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-lib
opencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --en
able-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      54. 10.100 / 54. 10.100
  libavcodec     56.  4.101 / 56.  4.101
  libavformat    56.  9.100 / 56.  9.100
  libavdevice    56.  1.100 / 56.  1.100
  libavfilter     5.  1.103 /  5.  1.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  1.100 / 53.  1.100
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, dshow, from 'video=Decklink Video Capture:audio=Decklink Audio Capture':
  Duration: N/A, start: 1799894.202000, bitrate: 1536 kb/s
    Stream #0:0: Video: rawvideo (HDYC / 0x43594448), uyvy422(tv), 1280x720, 59.94 tbr, 10000k tbn, 59.94 tbc
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Please use -profile:a or -profile:v, -profile is ambiguous
    Last message repeated 1 times
[libx264 @ 0000000002b441c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000000002b441c0] profile Main, level 3.2
[libx264 @ 0000000002b441c0] 264 - core 142 r2479 dd79a61 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 a
nalyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 looka
head_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 ke
yint=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 vbv_maxrate=1600 vbv_bufsize=2000 crf_max=0.0 nal_h
rd=none filler=0 ip_ratio=1.40 aq=1:1.00
[libx264 @ 0000000002b4ff00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000000002b4ff00] profile Main, level 3.1
[libx264 @ 0000000002b4ff00] 264 - core 142 r2479 dd79a61 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 a
nalyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 looka
head_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 ke
yint=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 vbv_maxrate=900 vbv_bufsize=2000 crf_max=0.0 nal_hr
d=none filler=0 ip_ratio=1.40 aq=1:1.00
Output #0, flv, to 'hd.flv':
  Metadata:
    encoder         : Lavf56.9.100
    Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 960x540, q=-1--1, max. 1600 kb/s, 59.94 fps, 1k tbn, 59.94 tbc
    Metadata:
      encoder         : Lavc56.4.101 libx264
    Stream #0:1: Audio: aac ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 96 kb/s
    Metadata:
      encoder         : Lavc56.4.101 aac
Output #1, flv, to 'sd.flv':
  Metadata:
    encoder         : Lavf56.9.100
    Stream #1:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 854x480, q=-1--1, max. 900 kb/s, 30 fps, 1k tbn, 30 tbc
    Metadata:
      encoder         : Lavc56.4.101 libx264
    Stream #1:1: Audio: aac ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 96 kb/s
    Metadata:
      encoder         : Lavc56.4.101 aac
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))
  Stream #0:0 -> #1:0 (rawvideo (native) -> h264 (libx264))
  Stream #0:1 -> #1:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 1036 fps= 60 q=-1.0 Lq=-1.0 size=    1582kB time=00:00:17.27 bitrate= 750.1kbits/s
video:2322kB audio:408kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0000000002b441c0] frame I:5     Avg QP:24.63  size: 59927
[libx264 @ 0000000002b441c0] frame P:264   Avg QP:25.97  size:  3013
[libx264 @ 0000000002b441c0] frame B:767   Avg QP:33.48  size:   367
[libx264 @ 0000000002b441c0] consecutive B-frames:  1.1%  0.0%  2.0% 96.9%
[libx264 @ 0000000002b441c0] mb I  I16..4: 18.8%  0.0% 81.2%
[libx264 @ 0000000002b441c0] mb P  I16..4:  0.4%  0.0%  0.7%  P16..4: 20.6%  6.3%  4.0%  0.0%  0.0%    skip:68.0%
[libx264 @ 0000000002b441c0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 15.4%  0.4%  0.1%  direct: 0.1%  skip:84.1%  L0:32.1% L1:66.6% BI: 1.3%
[libx264 @ 0000000002b441c0] coded y,uvDC,uvAC intra: 67.4% 66.8% 42.3% inter: 1.9% 2.6% 0.1%
[libx264 @ 0000000002b441c0] i16 v,h,dc,p: 20% 63%  4% 12%
[libx264 @ 0000000002b441c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 30% 10%  5%  6%  7%  6%  5%  6%
[libx264 @ 0000000002b441c0] i8c dc,h,v,p: 42% 33% 20%  5%
[libx264 @ 0000000002b441c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000002b441c0] ref P L0: 69.8% 14.7% 12.7%  2.8%
[libx264 @ 0000000002b441c0] ref B L0: 92.8%  6.1%  1.0%
[libx264 @ 0000000002b441c0] ref B L1: 94.1%  5.9%
[libx264 @ 0000000002b441c0] kb/s:637.10
[libx264 @ 0000000002b4ff00] frame I:3     Avg QP:23.69  size: 55129
[libx264 @ 0000000002b4ff00] frame P:169   Avg QP:24.13  size:  3987
[libx264 @ 0000000002b4ff00] frame B:346   Avg QP:29.59  size:   465
[libx264 @ 0000000002b4ff00] consecutive B-frames: 10.2%  0.8%  4.1% 84.9%
[libx264 @ 0000000002b4ff00] mb I  I16..4: 15.9%  0.0% 84.1%
[libx264 @ 0000000002b4ff00] mb P  I16..4:  0.5%  0.0%  1.2%  P16..4: 25.3%  9.0%  6.0%  0.0%  0.0%    skip:58.0%
[libx264 @ 0000000002b4ff00] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 18.4%  1.0%  0.2%  direct: 0.2%  skip:80.2%  L0:28.6% L1:67.8% BI: 3.6%
[libx264 @ 0000000002b4ff00] coded y,uvDC,uvAC intra: 71.2% 71.6% 49.1% inter: 3.9% 5.6% 0.4%
[libx264 @ 0000000002b4ff00] i16 v,h,dc,p: 21% 62%  4% 13%
[libx264 @ 0000000002b4ff00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 30% 10%  5%  6%  7%  6%  5%  6%
[libx264 @ 0000000002b4ff00] i8c dc,h,v,p: 38% 34% 21%  7%
[libx264 @ 0000000002b4ff00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000002b4ff00] ref P L0: 71.2% 13.8% 11.8%  3.2%
[libx264 @ 0000000002b4ff00] ref B L0: 91.3%  6.9%  1.9%
[libx264 @ 0000000002b4ff00] ref B L1: 93.9%  6.1%
[libx264 @ 0000000002b4ff00] kb/s:463.26

I tested the issue using file input (instead of a DirectShow source) and the same issue seems to be present. As expected, there are no "real-time buffer errors" - but performance is still drastically reduced.

Change History (6)

comment:1 by Carl Eugen Hoyos, 9 years ago

Keywords: unsharp added
Version: unspecifiedgit-master

Can you reproduce the issue with file input, without audio and using -vcodec mpeg4?
If yes, please provide such a command line so I can try to reproduce.

comment:2 by speaker219, 9 years ago

Yep, same issue when using a file as input with -vcodec mpeg4, notice the poor performance on the first run (using unsharp filter on both outputs):

~60 fps when using unsharp filter on both outputs, ~94 fps when only using on one. CPU usage is well below 50% on both runs.

Using unsharp on both:

cmd>ffmpeg -t 60 -i "testfile.mkv" -vcodec mpeg4 -vf "unsharp=5:5:0.2:5:5:0.0" -maxrate 1600k -bufsize 2000k -s 960x540 -pix_fmt yuv420p -an sd.mp4 -vcodec mpeg4 -vf "unsharp=5:5:0.2:5:5:0.0,fps=fps=30" -maxrate 900k -bufsize 2000k -s 854x480 -pix_fmt yuv420p -an sd.mp4


ffmpeg version N-66809-g20df026 Copyright (c) 2000-2014 the FFmpeg developers
  built on Oct 11 2014 23:42:02 with gcc 4.9.1 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-li
bass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-lib
opencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --en
able-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      54. 10.100 / 54. 10.100
  libavcodec     56.  4.101 / 56.  4.101
  libavformat    56.  9.100 / 56.  9.100
  libavdevice    56.  1.100 / 56.  1.100
  libavfilter     5.  1.103 /  5.  1.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  1.100 / 53.  1.100
Input #0, matroska,webm, from 'J:\NewDL\Jeopardy.2014.09.26.720p.HDTV.AAC2.0.x264-NTb.mkv':
  Metadata:
    encoder         : libebml v1.2.3 + libmatroska v1.3.0
    creation_time   : 2014-09-26 02:23:22
  Duration: 00:19:56.47, start: 0.000000, bitrate: 2305 kb/s
    Stream #0:0: Video: h264 (High), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
    Stream #0:1: Audio: aac, 48000 Hz, stereo, fltp (default)
File 'sd.mp4' already exists. Overwrite ? [y/N] y
File 'sd.mp4' already exists. Overwrite ? [y/N] y
[mpeg4 @ 000000000034cb00] Invalid pixel aspect ratio 1280/1281, limit is 255/255 reducing
Output #0, mp4, to 'sd.mp4':
  Metadata:
    encoder         : Lavf56.9.100
    Stream #0:0: Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 960x540 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 30k tbn, 29.97 tbc (default)
    Metadata:
      encoder         : Lavc56.4.101 mpeg4
Output #1, mp4, to 'sd.mp4':
  Metadata:
    encoder         : Lavf56.9.100
    Stream #1:0: Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 854x480 [SAR 1:1 DAR 427:240], q=2-31, 200 kb/s, SAR 1280:1281 DAR 16:9, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      encoder         : Lavc56.4.101 mpeg4
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mpeg4 (native))
  Stream #0:0 -> #1:0 (h264 (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
frame= 1799 fps= 60 q=24.8 Lq=24.8 size=    4421kB time=00:01:00.03 bitrate= 603.3kbits/s
video:8003kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Using unsharp on one:

cmd>ffmpeg -t 60 -i "J:\NewDL\Jeopardy.2014.09.26.720p.HDTV.AAC2.0.x264-NTb.mkv" -vcodec mpeg4 -vf "unsharp=5:5:0.2:5:5:0.0" -maxrate 1600k -bufsize 2000k -s 960x540 -pix_fmt yuv420p -an sd.mp4 -vcodec mpeg4 -vf "fps=fps=30" -maxrate 900k -bufsize 2000k -s 854x480 -pix_fmt yuv420p -an sd.mp4


ffmpeg version N-66809-g20df026 Copyright (c) 2000-2014 the FFmpeg developers
  built on Oct 11 2014 23:42:02 with gcc 4.9.1 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-li
bass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-lib
opencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --en
able-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      54. 10.100 / 54. 10.100
  libavcodec     56.  4.101 / 56.  4.101
  libavformat    56.  9.100 / 56.  9.100
  libavdevice    56.  1.100 / 56.  1.100
  libavfilter     5.  1.103 /  5.  1.103
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  1.100 / 53.  1.100
Input #0, matroska,webm, from 'testfile.mkv':
  Metadata:
    encoder         : libebml v1.2.3 + libmatroska v1.3.0
    creation_time   : 2014-09-26 02:23:22
  Duration: 00:19:56.47, start: 0.000000, bitrate: 2305 kb/s
    Stream #0:0: Video: h264 (High), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
    Stream #0:1: Audio: aac, 48000 Hz, stereo, fltp (default)
File 'sd.mp4' already exists. Overwrite ? [y/N] y
File 'sd.mp4' already exists. Overwrite ? [y/N] y
[mpeg4 @ 000000000527c1e0] Invalid pixel aspect ratio 1280/1281, limit is 255/255 reducing
Output #0, mp4, to 'sd.mp4':
  Metadata:
    encoder         : Lavf56.9.100
    Stream #0:0: Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 960x540 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 30k tbn, 29.97 tbc (default)
    Metadata:
      encoder         : Lavc56.4.101 mpeg4
Output #1, mp4, to 'sd.mp4':
  Metadata:
    encoder         : Lavf56.9.100
    Stream #1:0: Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p, 854x480 [SAR 1:1 DAR 427:240], q=2-31, 200 kb/s, SAR 1280:1281 DAR 16:9, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      encoder         : Lavc56.4.101 mpeg4
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mpeg4 (native))
  Stream #0:0 -> #1:0 (h264 (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
frame= 1799 fps= 94 q=24.8 Lq=24.8 size=    4421kB time=00:01:00.03 bitrate= 603.3kbits/s
video:7957kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

comment:3 by Roger Pack, 9 years ago

as a side note, high cpu shouldn't cause things to get out of sync since it's dropping frames but then passing laster frames through with the appropriate (later) timestamps...should it? Does it get more and more out of sync over time?

comment:4 by Elon Musk, 3 years ago

Resolution: fixed
Status: newclosed

Probably fixed with slice threading support.

comment:5 by Carl Eugen Hoyos, 3 years ago

Component: undeterminedavformat

comment:6 by Carl Eugen Hoyos, 3 years ago

Component: avformatavfilter
Note: See TracTickets for help on using tickets.