[FFmpeg-user] ffmpeg does nothing but using CPU

Cecil Westerhof Cecil at decebal.nl
Tue Oct 20 21:38:03 EEST 2020


Carl Zwanzig <cpz at tuunq.com> writes:

> On 10/20/2020 10:33 AM, Cecil Westerhof wrote:
>> What could be happening here?
>
> Please post some more info, at the least the complete command and the
> output of the last invocation in by the script.

The command I use in the bash script is:
    nice -n 10 ionice -c3                           \
         ffmpeg -y                                  \
                -i          "${inputfile}"          \
                -vf         scale=${xDimension}:-2  \
                -crf        28                      \
                -acodec     libmp3lame              \
                -qscale:a   9                       \
                -preset     veryfast                \
                "${outputfile}" 2>"${logfile}"

The value of xDimension was in this case 720.

I am using ffmpeg version 4.1.6 on Debian 10.

The log-file starts with:
    ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers
      built with gcc 8 (Debian 8.3.0-6)
      configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
      libavutil      56. 22.100 / 56. 22.100
      libavcodec     58. 35.100 / 58. 35.100
      libavformat    58. 20.100 / 58. 20.100
      libavdevice    58.  5.100 / 58.  5.100
      libavfilter     7. 40.101 /  7. 40.101
      libavresample   4.  0.  0 /  4.  0.  0
      libswscale      5.  3.100 /  5.  3.100
      libswresample   3.  3.100 /  3.  3.100
      libpostproc    55.  3.100 / 55.  3.100

Everything looks fine to me until the following:
    frame=28999 fps= 26 q=34.0 size=   33024kB time=00:16:06.40 bitrate= 279.9kbits/s speed=0.855x
    frame=29003 fps= 26 q=34.0 size=   33024kB time=00:16:06.40 bitrate= 279.9kbits/s speed=0.854x
    frame=29010 fps= 26 q=34.0 size=   33024kB time=00:16:06.40 bitrate= 279.9kbits/s speed=0.853x
    frame=29016 fps= 26 q=34.0 size=   33024kB time=00:16:06.87 bitrate= 279.8kbits/s speed=0.853x
    frame=29022 fps= 26 q=34.0 size=   33024kB time=00:16:06.87 bitrate= 279.8kbits/s speed=0.853x


Then there is quit a lot like this:
    stream #0:
      keyframe=0
      duration=0.033
      dts=968.033  pts=968.067
      size=3318
    [h264 @ 0x562755f52ac0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2
    [libx264 @ 0x562755f46600] frame=29022 QP=29.87 NAL=0 Slice:B Poc:12  I:0    P:91   SKIP:1079 size=160 bytes
    stream #1:
      keyframe=1
      duration=0.023
      dts=967.599  pts=967.599
      size=347
    stream #1:
      keyframe=1
      duration=0.023
      dts=967.622  pts=967.622
      size=359

And it ends with this:
    [h264 @ 0x562755f487c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2
    [libx264 @ 0x562755f46600] frame=29131 QP=34.84 NAL=2 Slice:B Poc:4   I:29   P:345  SKIP:782  size=1179 bytes
    stream #0:
      keyframe=0
      duration=0.033
      dts=971.700  pts=971.700
      size=197
    [h264 @ 0x562755f5c3c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0
    [libx264 @ 0x562755f46600] frame=29132 QP=35.33 NAL=0 Slice:B Poc:6   I:8    P:264  SKIP:892  size=722 bytes

    Enter command: <target>|all <time>|-1 <command>[ <argument>]

>From this moment on ffmpeg does nothing but using CPU cycles.


One interesting part: I had earlier the same problem with another
file. After cancelling and starting again, it was processed without a
problem.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


More information about the ffmpeg-user mailing list