.png)
Ich verwende die Konfiguration: Windows 10 IoT, Intel Celeron N3350E (mit Intel HD Graphics).
Ausführen dieser Zeile:
ffmpeg -f dshow -i video="USB Video":audio="USB Digital Audio" -c:v libx264 -crf 30 -preset ultrafast out.mp4
CPU-Auslastung (durch FFmpeg): 60–80 %, GPU-Auslastung: 0
Der Fehler „Echtzeitpuffer zu voll“ tritt nur auf, wenn die gesamte CPU-Auslastung (zusammen mit anderen Anwendungen) fast 100 % erreicht.
Ausführen dieser Zeile (Beispiel von trac.ffmpeg.org):
ffmpeg -init_hw_device qsv=hw -filter_hw_device hw -f dshow -i video="USB Video":audio="USB Digital Audio" -vf hwupload=extra_hw_frames=64,format=qsv -c:v h264_qsv -preset veryfast out.mp4
CPU-Auslastung (durch FFmpeg): fast 50 %, GPU-Auslastung: fast 50 %
Der Fehler „Echtzeitpuffer zu voll“ tritt jedoch auch dann auf, wenn die gesamte CPU-Auslastung (durch alle Anwendungen) unter 100 % (beinahe 80 %) liegt.
Warum hat FFmpeg mit QSV keine Zeit, das Video zu kodieren, obwohl noch Prozessorressourcen frei sind?
Log level: 48
Command line:
ffmpeg -init_hw_device "qsv=hw" -filter_hw_device hw -f dshow -i "video=USB Video:audio=USB Digital Audio" -vf "hwupload=extra_hw_frames=64,format=qsv" -c:v h264_qsv -preset veryfast "out.mp4" -report
ffmpeg version 5.0-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11.2.0 (Rev5, 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-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --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-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
Splitting the commandline.
Reading option '-init_hw_device' ... matched as option 'init_hw_device' (initialise hardware device) with argument 'qsv=hw'.
Reading option '-filter_hw_device' ... matched as option 'filter_hw_device' (set hardware device used when filtering) with argument 'hw'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'dshow'.
Reading option '-i' ... matched as input url with argument 'video=USB Video:audio=USB Digital Audio'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'hwupload=extra_hw_frames=64,format=qsv'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'h264_qsv'.
Reading option '-preset' ... matched as AVOption 'preset' with argument 'veryfast'.
Reading option 'out.mp4' ... matched as output url.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option init_hw_device (initialise hardware device) with argument qsv=hw.
WARNING: defaulting child_device_type to AV_HWDEVICE_TYPE_DXVA2 for compatibility with old commandlines. This behaviour will be removed in the future. Please explicitly set device type via "-init_hw_device" option.
[AVHWDeviceContext @ 0000021f51ffe280] Using D3D9Ex device.
[AVHWDeviceContext @ 0000021f51ffdf80] Initialize MFX session: API version is 1.35, implementation version is 1.35
Applying option filter_hw_device (set hardware device used when filtering) with argument hw.
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url video=USB Video:audio=USB Digital Audio.
Applying option f (force format) with argument dshow.
Successfully parsed a group of options.
Opening an input file: video=USB Video:audio=USB Digital Audio.
[dshow @ 0000021f52001a40] Selecting pin Record on video
[dshow @ 0000021f52001a40] not reusing previous graph capture filter @device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{27F9D9B9-5F34-4AAE-9F7D-0F4573844D9E} != @device_pnp_\\?\usb#vid_534d&pid_2109&mi_00#6&3443966d&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global
[dshow @ 0000021f52001a40] Selecting pin Capture on audio only
[dshow @ 0000021f52001a40] passing through packet of type video size 147499 timestamp 2766116729774 orig timestamp 2766116729774 graph timestamp 2766116730000 diff 226 USB Video
[mjpeg @ 0000021f5200d400] marker=d8 avail_size_in_buf=147497
[mjpeg @ 0000021f5200d400] marker parser used 0 bytes (0 bits)
[mjpeg @ 0000021f5200d400] marker=db avail_size_in_buf=147495
[mjpeg @ 0000021f5200d400] index=0
[mjpeg @ 0000021f5200d400] qscale[0]: 3
[mjpeg @ 0000021f5200d400] marker parser used 67 bytes (536 bits)
[mjpeg @ 0000021f5200d400] marker=db avail_size_in_buf=147426
[mjpeg @ 0000021f5200d400] index=1
[mjpeg @ 0000021f5200d400] qscale[1]: 6
[mjpeg @ 0000021f5200d400] marker parser used 67 bytes (536 bits)
[mjpeg @ 0000021f5200d400] marker=c0 avail_size_in_buf=147357
[mjpeg @ 0000021f5200d400] Changing bps from 0 to 8
[mjpeg @ 0000021f5200d400] sof0: picture: 1920x1080
[mjpeg @ 0000021f5200d400] component 0 2:1 id: 0 quant:0
[mjpeg @ 0000021f5200d400] component 1 1:1 id: 1 quant:1
[mjpeg @ 0000021f5200d400] component 2 1:1 id: 2 quant:1
[mjpeg @ 0000021f5200d400] pix fmt id 21111100
[mjpeg @ 0000021f5200d400] Format yuvj422p chosen by get_format().
[mjpeg @ 0000021f5200d400] marker parser used 17 bytes (136 bits)
[mjpeg @ 0000021f5200d400] marker=c4 avail_size_in_buf=147338
[mjpeg @ 0000021f5200d400] marker parser used 0 bytes (0 bits)
[mjpeg @ 0000021f5200d400] marker=c4 avail_size_in_buf=147305
[mjpeg @ 0000021f5200d400] marker parser used 0 bytes (0 bits)
[mjpeg @ 0000021f5200d400] marker=c4 avail_size_in_buf=147122
[mjpeg @ 0000021f5200d400] marker parser used 0 bytes (0 bits)
[mjpeg @ 0000021f5200d400] marker=c4 avail_size_in_buf=147089
[mjpeg @ 0000021f5200d400] marker parser used 0 bytes (0 bits)
[mjpeg @ 0000021f5200d400] escaping removed 2575 bytes
[mjpeg @ 0000021f5200d400] marker=da avail_size_in_buf=146906
[mjpeg @ 0000021f5200d400] marker parser used 144331 bytes (1154648 bits)
[mjpeg @ 0000021f5200d400] marker=d9 avail_size_in_buf=0
[mjpeg @ 0000021f5200d400] decode frame unused 0 bytes
[dshow @ 0000021f52001a40] passing through packet of type video size 146001 timestamp 2766117063107 orig timestamp 2766117063107 graph timestamp 2766117210000 diff 146893 USB Video
...
[dshow @ 0000021f52001a40] passing through packet of type video size 145557 timestamp 2766120729770 orig timestamp 2766120729770 graph timestamp 2766120730000 diff 230 USB Video
[dshow @ 0000021f52001a40] passing through packet of type audio size 88200 timestamp 2766115720000 orig timestamp 2766115720000 graph timestamp 2766120880000 diff 5160000 USB Digital Audio
[dshow @ 0000021f52001a40] All info found
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, dshow, from 'video=USB Video:audio=USB Digital Audio':
Duration: N/A, start: 276611.572000, bitrate: N/A
Stream #0:0, 13, 1/10000000: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/bt709/unknown), 1920x1080, 30 fps, 30 tbr, 10000k tbn
Stream #0:1, 1, 1/10000000: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Successfully opened the file.
Parsing a group of options: output url out.mp4.
Applying option vf (set video filters) with argument hwupload=extra_hw_frames=64,format=qsv.
Applying option c:v (codec name) with argument h264_qsv.
Successfully parsed a group of options.
Opening an output file: out.mp4.
[file @ 0000021f5b636ac0] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (h264_qsv))
Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[mjpeg @ 0000021f520c43c0] marker=d8 avail_size_in_buf=147497
...
[dshow @ 0000021f52001a40] real-time buffer [USB Video] [video input] too full or near too full (85% of size: 3041280 [rtbufsize parameter])! frame dropped!
[mjpeg @ 0000021f520c43c0] marker parser used 142451 bytes (1139601 bits)
[mjpeg @ 0000021f520c43c0] marker=d9 avail_size_in_buf=0
[mjpeg @ 0000021f520c43c0] decode frame unused 0 bytes
[dshow @ 0000021f52001a40] passing through packet of type video size 144436 timestamp 2766128063096 orig timestamp 2766128063096 graph timestamp 2766128090000 diff 26904 USB Video
[dshow @ 0000021f52001a40] real-time buffer [USB Video] [video input] too full or near too full (85% of size: 3041280 [rtbufsize parameter])! frame dropped!
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:1 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[graph_1_in_0_1 @ 0000021f520704c0] Setting 'time_base' to value '1/44100'
[graph_1_in_0_1 @ 0000021f520704c0] Setting 'sample_rate' to value '44100'
[graph_1_in_0_1 @ 0000021f520704c0] Setting 'sample_fmt' to value 's16'
[graph_1_in_0_1 @ 0000021f520704c0] Setting 'channel_layout' to value '0x3'
[graph_1_in_0_1 @ 0000021f520704c0] tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x3
[format_out_0_1 @ 0000021f5b66ee00] Setting 'sample_fmts' to value 'fltp'
[format_out_0_1 @ 0000021f5b66ee00] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[format_out_0_1 @ 0000021f5b66ee00] auto-inserting filter 'auto_aresample_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_1'
[AVFilterGraph @ 0000021f5b7ce080] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
[auto_aresample_0 @ 0000021f5b784b00] [SWR @ 0000021f5b57fb80] Using s16p internally between filters
[auto_aresample_0 @ 0000021f5b784b00] ch:2 chl:stereo fmt:s16 r:44100Hz -> ch:2 chl:stereo fmt:fltp r:44100Hz
Output #0, mp4, to 'C:\Users\FFmpeg\Desktop\out.mp4':
Metadata:
encoder : Lavf59.16.100
Stream #0:0, 0, 1/10000000: Video: h264 (avc1 / 0x31637661), qsv(pc, gbr/bt709/unknown, progressive), 1920x1080, q=2-31, 1000 kb/s, 30 fps, 10000k tbn
Metadata:
encoder : Lavc59.18.100 h264_qsv
Side data:
cpb: bitrate max/min/avg: 0/0/1000000 buffer size: 0 vbv_delay: N/A
Stream #0:1, 0, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc59.18.100 aac
[dshow @ 0000021f52001a40] passing through packet of type video size 143852 timestamp 2766128396429 orig timestamp 2766128396429 graph timestamp 2766128410000 diff 13571 USB Video
[dshow @ 0000021f52001a40] passing through packet of type video size 144527 timestamp 2766128729762 orig timestamp 2766128729762 graph timestamp 2766128760000 diff 30238 USB Video
frame= 16 fps=0.0 q=45.0 size= 0kB time=00:00:00.44 bitrate= 0.9kbits/s dup=3 drop=0 speed=0.613x
...
[q] command received. Exiting.
Antwort1
Bitte erhöhen Sie die Werte der Parameter -rtbufsize
und -thread_queue_size
(pro Eingabe) und testen Sie erneut.
Passen Sie Ihren Befehl mit den empfohlenen Werten wie folgt an:
ffmpeg -y -rtbufsize 2048M -init_hw_device qsv=hw
-filter_hw_device hw -f dshow -thread_queue_size 4096
-i video="USB Video":audio="USB Digital Audio"
-vf "hwupload=extra_hw_frames=64,format=qsv"
-c:v h264_qsv -preset veryfast out.mp4
Fehlerbehebung:
Wenn Sie dazu in der Lage sind, testen Sie die Gerätemodi des USB-Videoaufnahmegeräts mit ffmpeg:
ffmpeg -f dshow -list_options true -i video="USB Video"
Und ordnen Sie dann gültige Optionen, die aus der obigen Ausgabe abgeleitet wurden, manuell ffmpeg zu. Um beispielsweise 1080p-Videos mit 30 fps von einer Beispielkamera aufzunehmen, können Sie Folgendes verwenden:
ffmpeg -y -rtbufsize 2048M -init_hw_device qsv=hw
-filter_hw_device hw -f dshow -thread_queue_size 4096
-video_size 1920x1080 -framerate 30 -vcodec mjpeg
-i video="USB Video":audio="USB Digital Audio"
-vf "hwupload=extra_hw_frames=64,format=qsv"
-c:v h264_qsv -preset veryfast out.mp4
Dies kann dazu beitragen, den Verarbeitungsaufwand zu verringern, indem Sie manuell Auflösungen und Codecs auswählen, die vom Aufnahmegerät direkt unterstützt werden. SieheDasAntworten Sie für weitere Hinweise dazu.
Dann erneut testen und Bericht erstatten.