gpt4 book ai didi

FFmpeg 使用所有内存并在 filter_complex 中多次使用输入时崩溃

转载 作者:行者123 更新时间:2023-12-04 23:21:48 25 4
gpt4 key购买 nike

如果我定义一些虚拟 filter_complex 说:

[3:v]split=2[3_1][3_2]
[3_1]format=yuv420p,scale='640:360',setsar='1/1'[1]
[3_2]format=yuv420p,scale='640:360',setsar='1/1'[2]
[4:v]split=2[4_1][4_2]
[4_1]format=yuv420p,scale='640:360',setsar='1/1'[3]
[4_2]format=yuv420p,scale='640:360',setsar='1/1'[4]
[1][2][3][4]concat=n=4:v=1:a=0[video_out]
FFmpeg 使用所有内存并崩溃。可能是什么原因?
同样的情况发生在:
[3:v]format=yuv420p,scale='640:360',setsar='1/1'[1]
[3:v]format=yuv420p,scale='640:360',setsar='1/1'[2]
[4:v]format=yuv420p,scale='640:360',setsar='1/1'[3]
[4:v]format=yuv420p,scale='640:360',setsar='1/1'[4]
[1][2][3][4]concat=n=4:v=1:a=0[video_out]
我知道这些例子很愚蠢,但我在这里问为什么这会使用我所有的 RAM? (以及如何解决这个问题)
顺便说一句,这很好用(输入使用一次):
[3:v]format=yuv420p,scale='640:360',setsar='1/1'[1]
[4:v]format=yuv420p,scale='640:360',setsar='1/1'[2]
[1][2]concat=n=2:v=1:a=0[video_out]
更新:
完整的日志。当它运行时,它在大约 5 秒内达到 2GB 的内存使用量并继续增长。
ffmpeg.exe -y -f lavfi -i nullsrc=s=640x360 -i 1000211803.mp4 -i 220710.mp4 -i 223157.mp4 -i 232365.mp4 -i 1000000046.mp4 -i 1000238585.mp4 -filter_complex_script "c:\Users\wojtek\Desktop\Development\video_grid_ffmpeg_nodejs\filter_complex_param.txt" -vsync 2 -map "[video_out]" out.mp4
ffmpeg version n4.3.1-20-g8a2acdc6da Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3-win32 (GCC) 20200320
configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-version3 --disable-debug --enable-iconv --enable-zlib --enable-libxml2 --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-opencl --enable-libvmaf --disable-vulkan --enable-libvorbis --enable-amf --enable-libaom --disable-avisynth --enable-libdav1d --disable-libdavs2 --enable-ffnvcodec --enable-cuda-llvm --disable-libglslang --enable-libass --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librav1e --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libtwolame --disable-libvidstab --disable-libx264 --disable-libx265 --disable-libxavs2 --disable-libxvid --enable-libzimg --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-libs=-lgomp
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
Input #0, lavfi, from 'nullsrc=s=640x360':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '1000211803.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.33.100
Duration: 00:55:35.33, start: 0.000000, bitrate: 136 kb/s
Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 376x210 [SAR 1:1 DAR 188:105], 134 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '220710.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.33.100
Duration: 00:57:21.43, start: 0.000000, bitrate: 102 kb/s
Stream #2:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 376x210 [SAR 1:1 DAR 188:105], 99 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Input #3, mov,mp4,m4a,3gp,3g2,mj2, from '223157.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.33.100
Duration: 01:01:11.27, start: 0.000000, bitrate: 156 kb/s
Stream #3:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 376x210 [SAR 1:1 DAR 188:105], 153 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Input #4, mov,mp4,m4a,3gp,3g2,mj2, from '232365.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.33.100
Duration: 01:01:07.20, start: 0.000000, bitrate: 127 kb/s
Stream #4:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 376x210 [SAR 1:1 DAR 188:105], 124 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Input #5, mov,mp4,m4a,3gp,3g2,mj2, from '1000000046.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.33.100
Duration: 00:52:17.23, start: 0.000000, bitrate: 190 kb/s
Stream #5:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 376x210 [SAR 1:1 DAR 188:105], 188 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Input #6, mov,mp4,m4a,3gp,3g2,mj2, from '1000238585.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.33.100
Duration: 00:50:58.77, start: 0.000000, bitrate: 106 kb/s
Stream #6:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 376x210 [SAR 1:1 DAR 188:105], 103 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream mapping:
Stream #3:0 (h264) -> format
Stream #3:0 (h264) -> format
Stream #4:0 (h264) -> format
Stream #4:0 (h264) -> format
concat -> Stream #0:0 (mpeg4)
Press [q] to stop, [?] for help
Output #0, mp4, to 'out.mp4':
Metadata:
encoder : Lavf58.45.100
Stream #0:0: Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
encoder : Lavc58.91.100 mpeg4
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
frame= 6130 fps=610 q=20.6 Lsize= 5334kB time=00:03:24.30 bitrate= 213.9kbits/s speed=20.3x
video:5307kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.507003%
以上是使用此 filter_complex 参数值生成的:
[3:v]format=yuv420p,scale='-1:360',crop='640:in_h',setsar='1/1'[i2_640_360]
[3:v]format=yuv420p,scale='-1:360',crop='640:in_h',setsar='1/1'[i2_320_360]
[4:v]format=yuv420p,scale='-1:360',crop='640:in_h',setsar='1/1'[i3_320_360]
[4:v]format=yuv420p,scale='-1:360',crop='640:in_h',setsar='1/1'[i3_640_360]
[i2_640_360][i2_320_360][i3_320_360][i3_640_360]concat=n=4:v=1:a=0[video_out]
我没有等待它给出内存不足的错误。

最佳答案

似乎 split/asplit 的所有输出过滤器需要通过fifo/afifo在进一步处理之前分别过滤。不知 Prop 体为什么。

关于FFmpeg 使用所有内存并在 filter_complex 中多次使用输入时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64504522/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com