现在我尝试只为 2 个视频添加多种效果。我暂时删除了其他视频进行测试。
我收到错误“过滤时出错:无法分配内存”
命令如下:
ffmpeg -i D:/ffmpeg_output/Library/2020/11/21/SSLK006998_RmvAdVi_UntilLastSplit_1_6178.mp4
-i D:/ffmpeg_output/Library/2020/11/21/SSLK006998_RmvAdVi_UntilLastSplit_2_3675.mp4
-filter_complex
" [0][0]xfade=transition=fade:duration=0.5:offset=712.06[V00];
[V00][1]xfade=transition=fade:duration=0.5:offset=1522.67,format=yuv420p[video];
[0:a][0:a]acrossfade=d=0.5:c1=tri:c2=tri[A00];
[A00][1:a]acrossfade=d=0.5:c1=tri:c2=tri[audio]"
-map "[video]" -map "[audio]" -movflags +faststart
D:/ffmpeg_output/Library/2020/11/21/SSLK006998_FinalMergedFile_NotFromAction_4882.mp4
错误详细信息如下:
ffmpeg -i D:/ffmpeg_output/Library/2020/11/21/SSLK006998_RmvAdVi_UntilLastSplit_1_6178.mp4 -i D:/ffmpeg_output/Library/2020/11/21/SSLK006998_RmvAdVi_UntilLastSplit_2_3675.mp4 -filter_complex " [0][0]xfade=transition=fade:duration=0.5:offset=712.06[V00];[V00][1]xfade=transition=fade:duration=0.5:offset=1522.67,format=yuv420p[video]; [0:a][0:a]acrossfade=d=0.5:c1=tri:c2=tri[A00];[A00][1:a]acrossfade=d=0.5:c1=tri:c2=tri[audio]" -map "[video]" -map "[audio]" -movflags +faststart D:/ffmpeg_output/Library/2020/11/21/SSLK006998_FinalMergedFile_NotFromAction_4882.mp4
ffmpeg version 2021-05-09-git-8649f5dca6-essentials_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-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --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-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil 57. 0.100 / 57. 0.100
libavcodec 59. 1.100 / 59. 1.100
libavformat 59. 0.101 / 59. 0.101
libavdevice 59. 0.100 / 59. 0.100
libavfilter 8. 0.101 / 8. 0.101
libswscale 6. 0.100 / 6. 0.100
libswresample 4. 0.100 / 4. 0.100
libpostproc 56. 0.100 / 56. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:/ffmpeg_output/Library/2020/11/21/SSLK006998_RmvAdVi_UntilLastSplit_1_6178.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf59.0.101
Duration: 00:11:52.64, start: 0.000000, bitrate: 3468 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 3272 kb/s, 25 fps, 25 tbr, 25k tbn (default)
Metadata:
handler_name : ?Mainconcept Video Media Handler
vendor_id : [0][0][0][0]
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
handler_name : #Mainconcept MP4 Sound Media Handler
vendor_id : [0][0][0][0]
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'D:/ffmpeg_output/Library/2020/11/21/SSLK006998_RmvAdVi_UntilLastSplit_2_3675.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf59.0.101
Duration: 00:13:31.19, start: 0.000000, bitrate: 3588 kb/s
Stream #1:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 3393 kb/s, 25 fps, 25 tbr, 25k tbn (default)
Metadata:
handler_name : ?Mainconcept Video Media Handler
vendor_id : [0][0][0][0]
Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
handler_name : #Mainconcept MP4 Sound Media Handler
vendor_id : [0][0][0][0]
Stream mapping:
Stream #0:0 (h264) -> xfade:main
Stream #0:0 (h264) -> xfade:xfade
Stream #0:1 (aac) -> acrossfade:crossfade0
Stream #0:1 (aac) -> acrossfade:crossfade1
Stream #1:0 (h264) -> xfade:xfade
Stream #1:1 (aac) -> acrossfade:crossfade1
format -> Stream #0:0 (libx264)
acrossfade -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[libx264 @ 0000024251c40480] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0000024251c40480] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0000024251c40480] 264 - core 163 r3059 b684ebe - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'D:/ffmpeg_output/Library/2020/11/21/SSLK006998_FinalMergedFile_NotFromAction_4882.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf59.0.101
Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709, top coded first (swapped)), 1920x1080, q=2-31, 25 fps, 12800 tbn (default)
Metadata:
encoder : Lavc59.1.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
encoder : Lavc59.1.100 aac
Error while filtering: Cannot allocate memoryme=00:02:54.37 bitrate=5435.9kbits/s speed=1.55x
Failed to inject frame into filter network: Cannot allocate memory
Error while processing the decoded data for stream #0:0
[libx264 @ 0000024251c40480] frame I:24 Avg QP:19.38 size:211131
[libx264 @ 0000024251c40480] frame P:1108 Avg QP:22.51 size: 65649
[libx264 @ 0000024251c40480] frame B:3195 Avg QP:26.66 size: 11943
[libx264 @ 0000024251c40480] consecutive B-frames: 1.0% 1.0% 2.1% 95.9%
[libx264 @ 0000024251c40480] mb I I16..4: 14.1% 70.4% 15.5%
[libx264 @ 0000024251c40480] mb P I16..4: 3.1% 9.1% 1.2% P16..4: 39.2% 15.0% 9.1% 0.0% 0.0% skip:23.4%
[libx264 @ 0000024251c40480] mb B I16..4: 0.2% 0.5% 0.0% B16..8: 36.3% 3.2% 0.7% direct: 2.0% skip:57.1% L0:41.9% L1:50.4% BI: 7.7%
[libx264 @ 0000024251c40480] 8x8 transform intra:68.2% inter:73.3%
[libx264 @ 0000024251c40480] coded y,uvDC,uvAC intra: 53.6% 53.3% 18.0% inter: 13.8% 12.3% 0.6%
[libx264 @ 0000024251c40480] i16 v,h,dc,p: 36% 30% 9% 24%
[libx264 @ 0000024251c40480] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 16% 28% 3% 4% 5% 4% 5% 5%
[libx264 @ 0000024251c40480] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 46% 11% 3% 4% 4% 4% 4% 4%
[libx264 @ 0000024251c40480] i8c dc,h,v,p: 50% 19% 25% 6%
[libx264 @ 0000024251c40480] Weighted P-Frames: Y:2.1% UV:1.4%
[libx264 @ 0000024251c40480] ref P L0: 58.3% 14.1% 21.4% 6.1% 0.0%
[libx264 @ 0000024251c40480] ref B L0: 88.6% 9.5% 1.9%
[libx264 @ 0000024251c40480] ref B L1: 94.5% 5.5%
[libx264 @ 0000024251c40480] kb/s:5360.09
[aac @ 00000242510a3500] Qavg: 482.511
[aac @ 00000242510a3500] 2 frames left in the queue on closing
Conversion failed!
请指教。
亲切的问候,
命令给出无效文件索引错误:
ffmpeg -i D:/ffmpeg_output/Library/2020/11/21/SSLK006998_RmvAdVi_UntilLastSplit_1_7435.mp4
-i D:/ffmpeg_output/Library/2020/11/21/SSLK006998_RmvAdVi_UntilLastSplit_2_7575.mp4
-i D:/ffmpeg_output/Library/2020/11/21/SSLK006998_VideoAudioUntilMarked_InsrtSameVideo_3_3142.mp4
-filter_complex " [0][1]xfade=transition=fade:duration=0.5:offset=712.06[V01];
[V01][2]xfade=transition=fade:duration=0.5:offset=1522.67[V02];
[V02][3]xfade=transition=fade:duration=0.5:offset=2583.43,format=yuv420p[video];
[0:a][1:a]acrossfade=d=0.5:c1=tri:c2=tri[A01];
[A01][2:a]acrossfade=d=0.5:c1=tri:c2=tri[A02];
[A02][3:a]acrossfade=d=0.5:c1=tri:c2=tri[audio]"
-map "[video]" -map "[audio]" -movflags +faststart D:/ffmpeg_output/Library/2020/11/21/SSLK006998_FinalMergedFile_NotFromAction_8821.mp4
按要求完成日志:
ffmpeg -i D:/ffmpeg_output/Library/2020/11/21/SSLK006998_RmvAdVi_UntilLastSplit_1_7435.mp4 -i D:/ffmpeg_output/Library/2020/11/21/SSLK006998_RmvAdVi_UntilLastSplit_2_7575.mp4 -i D:/ffmpeg_output/Library/2020/11/21/SSLK006998_VideoAudioUntilMarked_InsrtSameVideo_3_3142.mp4 -filter_complex " [0][1]xfade=transition=fade:duration=0.5:offset=712.06[V01];[V01][2]xfade=transition=fade:duration=0.5:offset=1522.67[V02];[V02][3]xfade=transition=fade:duration=0.5:offset=2583.43,format=yuv420p[video]; [0:a][1:a]acrossfade=d=0.5:c1=tri:c2=tri[A01];[A01][2:a]acrossfade=d=0.5:c1=tri:c2=tri[A02];[A02][3:a]acrossfade=d=0.5:c1=tri:c2=tri[audio]" -map "[video]" -map "[audio]" -movflags +faststart D:/ffmpeg_output/Library/2020/11/21/SSLK006998_FinalMergedFile_NotFromAction_8821.mp4
ffmpeg version 2021-05-09-git-8649f5dca6-essentials_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-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --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-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil 57. 0.100 / 57. 0.100
libavcodec 59. 1.100 / 59. 1.100
libavformat 59. 0.101 / 59. 0.101
libavdevice 59. 0.100 / 59. 0.100
libavfilter 8. 0.101 / 8. 0.101
libswscale 6. 0.100 / 6. 0.100
libswresample 4. 0.100 / 4. 0.100
libpostproc 56. 0.100 / 56. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:/ffmpeg_output/Library/2020/11/21/SSLK006998_RmvAdVi_UntilLastSplit_1_7435.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf59.0.101
Duration: 00:11:52.64, start: 0.000000, bitrate: 3468 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 3272 kb/s, 25 fps, 25 tbr, 25k tbn (default)
Metadata:
handler_name : ?Mainconcept Video Media Handler
vendor_id : [0][0][0][0]
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
handler_name : #Mainconcept MP4 Sound Media Handler
vendor_id : [0][0][0][0]
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'D:/ffmpeg_output/Library/2020/11/21/SSLK006998_RmvAdVi_UntilLastSplit_2_7575.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf59.0.101
Duration: 00:13:31.19, start: 0.000000, bitrate: 3588 kb/s
Stream #1:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 3393 kb/s, 25 fps, 25 tbr, 25k tbn (default)
Metadata:
handler_name : ?Mainconcept Video Media Handler
vendor_id : [0][0][0][0]
Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
handler_name : #Mainconcept MP4 Sound Media Handler
vendor_id : [0][0][0][0]
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'D:/ffmpeg_output/Library/2020/11/21/SSLK006998_VideoAudioUntilMarked_InsrtSameVideo_3_3142.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf59.0.101
Duration: 00:17:41.36, start: 0.000000, bitrate: 3679 kb/s
Stream #2:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 3483 kb/s, 25 fps, 25 tbr, 25k tbn (default)
Metadata:
handler_name : ?Mainconcept Video Media Handler
vendor_id : [0][0][0][0]
Stream #2:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
handler_name : #Mainconcept MP4 Sound Media Handler
vendor_id : [0][0][0][0]
Invalid file index 3 in filtergraph description [0][1]xfade=transition=fade:duration=0.5:offset=712.06[V01];[V01][2]xfade=transition=fade:duration=0.5:offset=1522.67[V02];[V02][3]xfade=transition=fade:duration=0.5:offset=2583.43,format=yuv420p[video]; [0:a][1:a]acrossfade=d=0.5:c1=tri:c2=tri[A01];[A01][2:a]acrossfade=d=0.5:c1=tri:c2=tri[A02];[A02][3:a]acrossfade=d=0.5:c1=tri:c2=tri[audio].
答案1
您对第一个 xfade 滤镜使用了相同的输入文件。不要使用[0][0]xfade
,而是添加相同的文件作为另一个输入并使用[0][1]xfade
。它可能需要更少的内存。
ffmpeg -i D:/ffmpeg_output/Library/2020/11/21/SSLK006998_RmvAdVi_UntilLastSplit_1_6178.mp4
-i D:/ffmpeg_output/Library/2020/11/21/SSLK006998_RmvAdVi_UntilLastSplit_1_6178.mp4
-i D:/ffmpeg_output/Library/2020/11/21/SSLK006998_RmvAdVi_UntilLastSplit_2_3675.mp4
-filter_complex
" [0][1]xfade=transition=fade:duration=0.5:offset=712.06[V00];
[V00][2]xfade=transition=fade:duration=0.5:offset=1522.67,format=yuv420p[video];
[0:a][1:a]acrossfade=d=0.5:c1=tri:c2=tri[A00];
[A00][2:a]acrossfade=d=0.5:c1=tri:c2=tri[audio]"
-map "[video]" -map "[audio]" -movflags +faststart
D:/ffmpeg_output/Library/2020/11/21/SSLK006998_FinalMergedFile_NotFromAction_4882.mp4