[FFmpeg-user] FFmpeg hanging on complex filter

Jesse Koegler jessekoegler at gmail.com
Tue Feb 13 01:46:51 EET 2018


Hello all,

Recently I upgraded my FFMPEG version to the latest release. In doing so, a
command I previously used does not work anymore.

Here is the command

ffmpeg.exe -y -i <video name> -filter_complex
"[0:v]trim=start_frame=0:end_frame=100,setpts=PTS-STARTPTS[a0];
[0:v]trim=start_frame=100:end_frame=242,setpts=PTS-STARTPTS[a1];
[a0]fade=in:0:12, fade=out:88:12[b0]; [a1]fade=in:0:12,
fade=out:130:12[b1]; [b0[b1]concat[out0]" -map [out0] -map 0:a -c:a copy  <new
video name>

Previously this would return a video with some fading at the specified
frames, but now the ffmpeg process just hangs. Here is the console output
using latest release version

C:\WINDOWS\system32>ffmpeg.exe -y -i "C:\Users\test2_FADED.mp4"
-filter_complex
"[0:v]trim=start_frame=0:end_frame=100,setpts=PTS-STARTPTS[a0];
[0:v]trim=start_
frame=100:end_frame=242,setpts=PTS-STARTPTS[a1]; [a0]fade=in:0:12,
fade=out:88:1
2[b0]; [a1]fade=in:0:12, fade=out:130:12[b1]; [b0][b1]concat[out0]" -map
[out0]
-map 0:a -c:a copy  "C:\Users\test2.mp4"
ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2
--enable-bzlib --e
nable-fontconfig --enable-gnutls --enable-iconv --enable-libass
--enable-libblur
ay --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg
--enable-libopu
s --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora
--ena
ble-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp
--enable-lib
x264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma
--enable-z
lib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda
--enable-c
uvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth
--enable-l
ibmfx
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\test2_FADED.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.26.101
  Duration: 00:00:09.68, start: 0.000000, bitrate: 147 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
640x480 [
SAR 1:1 DAR 4:3], 143 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono,
fltp,
 95 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 (h264) -> trim
  Stream #0:0 (h264) -> trim
  concat -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 04ad0200] using SAR=1/1
[libx264 @ 04ad0200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
FMA3
 BMI2 AVX2
[libx264 @ 04ad0200] profile High, level 3.0
[libx264 @ 04ad0200] 264 - core 152 r2851 ba24899 - H.264/MPEG-4 AVC codec
- Cop
yleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1
ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1
chro
ma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0
decimate=1 i
nterlaced=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
scenec
ut=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 'C:\Users\Public\Documents\NAC Compressed Video
Recordings\te
st2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p,
640x480 [SA
R 1:1 DAR 4:3], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono,
fltp,
 95 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

It basically just hangs there, chugging along at 30% cpu usage but not ever
completing.

Here is the console output from the older working version

C:\WINDOWS\system32>ffmpeg.exe -y -i "C:\Users\test2_FADED.mp4"
-filter_complex
"[0:v]trim=start_frame=0:end_frame=100,setpts=PTS-STARTPTS[a0];
[0:v]trim=start_
frame=100:end_frame=242,setpts=PTS-STARTPTS[a1]; [a0]fade=in:0:12,
fade=out:88:1
2[b0]; [a1]fade=in:0:12, fade=out:130:12[b1]; [b0][b1]concat[out0]" -map
[out0]
-map 0:a -c:a copy  "C:\Users\test2.mp4"
ffmpeg version N-76704-ge9aea6d Copyright (c) 2000-2015 the FFmpeg
developers
  built with gcc 5.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls
--enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b
--enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm
--enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb
--enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp
--en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora
--ena
ble-libtwolame --enable-libvidstab --enable-libvo-aacenc
--enable-libvo-amrwbenc
 --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp
--enabl
e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid
--enable-libzimg --
enable-lzma --enable-decklink --enable-zlib
  libavutil      55.  6.100 / 55.  6.100
  libavcodec     57. 15.100 / 57. 15.100
  libavformat    57. 14.100 / 57. 14.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
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\test2_FADED.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.26.101
  Duration: 00:00:09.68, start: 0.000000, bitrate: 147 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
640x480 [
SAR 1:1 DAR 4:3], 143 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono,
fltp,
 95 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[libx264 @ 000000c36f64fd80] using SAR=1/1
[libx264 @ 000000c36f64fd80] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2
AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 000000c36f64fd80] profile High, level 3.0
[libx264 @ 000000c36f64fd80] 264 - core 148 r2638 7599210 - H.264/MPEG-4
AVC cod
ec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options:
cabac=1 r
ef=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_pski
p=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0
deci
mate=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=2
5 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0
qcomp=0.6
0 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 000000c36fb5c200] Codec for stream 1 does not use global headers but
cont
ainer format requires global headers
Output #0, mp4, to 'C:\Users\test2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.14.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p,
640x48
0 [SAR 1:1 DAR 4:3], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc57.15.100 libx264
    Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, mono,
95 kb
/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 (h264) -> trim
  Stream #0:0 (h264) -> trim
  concat -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[output stream 0:0 @ 000000c36fb9a540] 100 buffers queued in output stream
0:0,
something may be wrong.
frame=  242 fps=0.0 q=-1.0 Lsize=     158kB time=00:00:09.60 bitrate=
135.0kbits
/s
video:154kB audio:1kB subtitle:0kB other streams:0kB global headers:0kB
muxing o
verhead: 2.685006%
[libx264 @ 000000c36f64fd80] frame I:2     Avg QP: 9.63  size:  3520
[libx264 @ 000000c36f64fd80] frame P:63    Avg QP:16.08  size:  1768
[libx264 @ 000000c36f64fd80] frame B:177   Avg QP:20.28  size:   215
[libx264 @ 000000c36f64fd80] consecutive B-frames:  2.1%  0.8%  1.2% 95.9%
[libx264 @ 000000c36f64fd80] mb I  I16..4: 60.0% 34.3%  5.7%
[libx264 @ 000000c36f64fd80] mb P  I16..4:  0.7%  2.5%  0.3%  P16..4:
13.6%  3.9
%  4.0%  0.0%  0.0%    skip:75.0%
[libx264 @ 000000c36f64fd80] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8:
8.4%  0.2
%  0.1%  direct: 0.5%  skip:90.7%  L0:41.7% L1:56.8% BI: 1.5%
[libx264 @ 000000c36f64fd80] 8x8 transform intra:53.8% inter:74.8%
[libx264 @ 000000c36f64fd80] coded y,uvDC,uvAC intra: 31.4% 18.8% 6.4%
inter: 2.
2% 2.9% 0.1%
[libx264 @ 000000c36f64fd80] i16 v,h,dc,p: 74% 10%  9%  7%
[libx264 @ 000000c36f64fd80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 19% 27%
2%  3%
 4%  3%  3%  2%
[libx264 @ 000000c36f64fd80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 26% 13%
3%  8%
 6%  5%  5%  3%
[libx264 @ 000000c36f64fd80] i8c dc,h,v,p: 75%  9% 15%  1%
[libx264 @ 000000c36f64fd80] Weighted P-Frames: Y:23.8% UV:23.8%
[libx264 @ 000000c36f64fd80] ref P L0: 73.4%  8.5% 13.5%  4.6%
[libx264 @ 000000c36f64fd80] ref B L0: 84.2% 11.9%  3.9%
[libx264 @ 000000c36f64fd80] ref B L1: 94.8%  5.2%
[libx264 @ 000000c36f64fd80] kb/s:129.35

My only guess is it has something to do with this message

 Codec for stream 1 does not use global headers but container format
requires global headers

in the older one that is causing it to hang in the newer version? Any help
is appreciated.

Jesse


More information about the ffmpeg-user mailing list