I am extracting part of a large video using the following ffmpeg command and it works fine as long as the -ss X position is few seconds:
ffmpeg -i "test.mov" -ss 2 -t 3 -vf "scale=512x288,setdar=16/9" -r 30 -b:v 500k -b:a 96k -ar 44100 -preset slower "out.mp4"
The problem is, that the larger the X value is in -ss X, the longer it takes ffmpeg to start showing progress and processing the file, and the CPU usage spikes. So for example if the above command produces a video file in about a second, changing the -ss value to 3000 makes the system hang for good 2 minutes and the CPU is getting extremely hot.
While the process is stuck, here is the output:
ffmpeg version 2021-02-10-git-e0fd35d867-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 56. 64.100 / 56. 64.100
libavcodec 58.122.100 / 58.122.100
libavformat 58. 67.100 / 58. 67.100
libavdevice 58. 11.103 / 58. 11.103
libavfilter 7.103.100 / 7.103.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mov':
Metadata:
major_brand : qt
minor_version : 85984000
compatible_brands: qt
creation_time : 2021-09-14T12:19:57.000000Z
timecode : 08:19:57:28
Duration: 01:50:36.53, start: 0.000000, bitrate: 3715 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 3535 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
Metadata:
handler_name : Media Handler
vendor_id : appl
encoder : H264
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 129 kb/s (default)
Metadata:
handler_name : Media Handler
vendor_id : [0][0][0][0]
Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 1 kb/s (default)
Metadata:
handler_name : Media Handler
reel_name : 1_2nd Floor
timecode : 08:19:57:28
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
While it seems that "Stream mapping:" is the culprit I had no luck finding a solution. Any help in this matter would be greatly appreciated.