gpt4 book ai didi

video - FFmpeg 内存使用情况

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

我正在使用最新的 FFmpeg 库将 4 个不同的输入视频混合在一起。
为了完成它,我对视频进行了一些基本的“filter_complex”操作,对音频进行了“混合”。
在处理数据大约 1 分钟后,进程将被信号“SIGKILL”杀死。可能内存不足会导致此错误。为了检查当前的内存使用情况,我运行“top”工具,该工具在崩溃时显示所有可用内存的 90% 已分配。

我的 kubernetes 池有可用的 30GB RAM 和 8CPU。这看起来很奇怪,因为 FullHd 进程在 1 分钟的工作中消耗了 30GB 内存。

我想知道有什么方法可以优化或限制内存使用。

FFmpeg 版本:4.0.2
系统:Linux
编码器:h.264
格式:1920x1080

FFmpeg 输出
https://gist.github.com/mbutan/51f832a99d0edf0b09af934d1934971e

代码片段:

          ffmpeg \
-i /tmp/a3ddcc11-9819-4bef-8e8d-156342aa68df.mp4 \
-itsoffset 3 -i /tmp/c87d7e8f-c9e7-4fbe-b845-e6cd6d6ac7bb.mp4 \
-itsoffset 3.199 -i /tmp/250cb6e8-8daf-4c5b-88b3-4b6cfb02834b.mp4 \
-itsoffset 37.52 -i /tmp/24e466e1-c1e0-4797-b88a-09e2a9f5f673.mp4 \
-itsoffset 68.04 -i /tmp/3e0e0e62-82e4-4d6a-881a-119d7c72cf9f.mp4 \
-itsoffset 415.188 -i /tmp/02ca91d5-f0c1-4140-ba12-fa445f09ddf6.mp4 \
-i /tmp/1.png -i /tmp/2.png -i /tmp/3.png \
-y -filter_complex pad=1920:1080:color=black [base];[6] scale=1920:1080 [background];\
[0:v] scale=1740:980,pad=1740:980:(ow-iw)/2:(oh-ih)/2 [main_0];[base][main_0] overlay=90:50:enable=between'(t,0,3)' [tmp_4];\
[1:v] scale=1740:980,pad=1740:980:(ow-iw)/2:(oh-ih)/2 [main_1];[tmp_4][main_1] overlay=90:50:enable=between'(t,3,29.5)' [tmp_6];\
[2:v] scale=1740:980,pad=1740:980:(ow-iw)/2:(oh-ih)/2 [main_2];[tmp_6][main_2] overlay=90:50:enable=between'(t,29.5,37.5)' [tmp_8];\
[3:v] scale=1740:980,pad=1740:980:(ow-iw)/2:(oh-ih)/2 [main_3];[tmp_8][main_3] overlay=90:50:enable=between'(t,37.5,58)' [tmp_10];\
[2:v] scale=1740:980,pad=1740:980:(ow-iw)/2:(oh-ih)/2 [main_4];[tmp_10][main_4] overlay=90:50:enable=between'(t,58,68)' [tmp_12];\
[4:v] scale=1740:980,pad=1740:980:(ow-iw)/2:(oh-ih)/2 [main_5];[tmp_12][main_5] overlay=90:50:enable=between'(t,68,414.5)' [tmp_14];\
[2:v] scale=1740:980,pad=1740:980:(ow-iw)/2:(oh-ih)/2 [main_6];[tmp_14][main_6] overlay=90:50:enable=between'(t,414.5,415.5)' [tmp_16];\
[5:v] scale=1740:980,pad=1740:980:(ow-iw)/2:(oh-ih)/2 [main_7];[tmp_16][main_7] overlay=90:50:enable=between'(t,415.5,416.248)' [tmp_18];\
[tmp_18][background] overlay=0:0 [tmp_19];[7] scale=306.66666666666663:190[user_shadow_0];\
[tmp_19][user_shadow_0] overlay=807:842:enable=between'(t,3.199,30.833)' [shadow_output_0_0];\
[2:v] scale=266.66666666666663:150:force_original_aspect_ratio=decrease, pad=266.66666666666663:150:(ow-iw)/2:(oh-ih)/2:black [user_0_3199];\
[shadow_output_0_0][user_0_3199] overlay=827:862:enable=between'(t,3.199,30.833)' [tmp_23];[7] scale=306.66666666666663:190[user_shadow_0];\
[tmp_23][user_shadow_0] overlay=807:842:enable=between'(t,37.52,57.965)' [shadow_output_0_0];\
[2:v] scale=266.66666666666663:150:force_original_aspect_ratio=decrease, pad=266.66666666666663:150:(ow-iw)/2:(oh-ih)/2:black [user_0_37520];\
[shadow_output_0_0][user_0_37520] overlay=827:862:enable=between'(t,37.52,57.965)' [tmp_27];[7] scale=306.66666666666663:190[user_shadow_0];\
[tmp_27][user_shadow_0] overlay=807:842:enable=between'(t,68.04,414.648)' [shadow_output_0_0];\
[2:v] scale=266.66666666666663:150:force_original_aspect_ratio=decrease, pad=266.66666666666663:150:(ow-iw)/2:(oh-ih)/2:black [user_0_68040];\
[shadow_output_0_0][user_0_68040] overlay=827:862:enable=between'(t,68.04,414.648)' [tmp_31];\
[0:v] scale=1920:1080 [intro];[tmp_31][intro] overlay=0:0:enable=between'(t,0,3.25)' [tmp_32];\
[tmp_32][0:v] overlay='if(lte((t-3.25)*18432,w),(t-3.25)*18432,w)':0:enable=between'(t,3.25,4.45)' [tmp_33];[5:v] scale=1920:1080 [end];\
[tmp_33][end] overlay=0:0:enable=between'(t,414.75,418)' [tmp_34];\
[tmp_34][5:v] overlay='if(lte((t-418)*18432,w),(t-418)*18432,w)':0:enable=between'(t,418,419.2)' [outVideo];\
[0:a]adelay=1|1 [audio_0];\
[1:a]adelay=3001|3001 [audio_1];\
[2:a]adelay=3200|3200 [audio_2];\
[3:a]adelay=37521|37521 [audio_3];\
[4:a]adelay=68041|68041 [audio_4];\
[5:a]adelay=415189|415189 [audio_5];\
[audio_0][audio_1][audio_2][audio_3][audio_4][audio_5] amix=inputs=6:duration=longest \
[outAudio] -map [outVideo] -map [outAudio] -framerate 30 -g 60 -video_size 1920x1080 -vcodec libx264 -acodec libfdk_aac -profile:a aac_he -b:a 192k -ac 2 -ar 44100 -max_muxing_queue_size 9999 -threads 0 -strict experimental -preset fast /tmp/53a89b44-fd56-4c5b-adb9-a5695d52e5d2_output.mp4

最佳答案

最新的 Master 分支已经解决了内存泄漏问题,非常感谢 Paul B. Mahol 的 promise 。
此提交修复了提到的问题:commit

关于video - FFmpeg 内存使用情况,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52838425/

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