Issue
I try to make video from 2 jpeg (6912x3456 px, files is large it is 360 panoramas) with ffmpeg by
ffmpeg -r 1/4 -pattern_type glob -i "my_dir/*.jpg" -c:v libx264 -profile:v high -crf 18 -vf "fps=30,format=yuv420p" -movflags +faststart output.mp4
And ffmpeg process hang. I get
ffmpeg version 3.2.15-0+deb9u1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --prefix=/usr --extra-version=0+deb9u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
Input #0, image2, from 'b90f8cc38a3ec7f6c4665ae0ba0e2b06/*.jpg':
Duration: 00:00:00.08, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 6912x3456, 25 tbr, 25 tbn, 25 tbc
File 'output.mp4' already exists. Overwrite ? [y/N] y
[swscaler @ 0x564d13ed9ac0] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x564d13ecadc0] frame MB size (432x216) > level limit (36864)
[libx264 @ 0x564d13ecadc0] DPB size (4 frames, 373248 mbs) > level limit (1 frames, 184320 mbs)
[libx264 @ 0x564d13ecadc0] MB rate (2799360) > level limit (2073600)
[libx264 @ 0x564d13ecadc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x564d13ecadc0] profile High, level 5.2
[libx264 @ 0x564d13ecadc0] 264 - core 148 r2748 97eaef2 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=6 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=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':
Metadata:
encoder : Lavf57.56.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 6912x3456, q=-1--1, 30 fps, 15360 tbn, 30 tbc
Metadata:
encoder : Lavc57.64.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[output stream 0:0 @ 0x564d13ec6c60] 100 buffers queued in output stream 0:0, something may be wrong.
And only Ctrl+C helps. But when there is one jpg file in the folder, ffmpeg is work fine. My ffmpeg command works fine on another PC with WSL Debian on Win10. What is problem?
Solution
Your linked x264 is too old and therefore has a max level of 5.2 which 6912x3456@30 is past the level limit (as shown by your ffmpeg process output). While exceeding the limit may or may not be the reason for the hang I expect a newer version of x264 will support level 6.0 and will not hang. You have several options:
- Upgrade your x264 (and your ffmpeg while you're at it as the 3.2 branch is from 2016). See the compile guide or download a recent ffmpeg with modern libx264 included.
- Or add the scale filter and try to stay within the level limits:
-vf "scale=4096:-2,fps=30,format=yuv420p"
- Or try
-c:v libx265
instead of-c:v libx264
(it also has levels to be aware of). - Or you may have just not waited long enough.
Answered By - llogan Answer Checked By - Senaida (WPSolving Volunteer)