4

Now I am trying to bring multiple effects to 2 videos only. I have removed other videos for now to test.

I am getting error "Error while filtering: Cannot allocate memory"

Command below:

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

Offset calculation below: Offset calculation here

Error details below:

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!
    

Please advise.

Kind Regards,

Commad giving Invalid file index error:

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

Complete logs as requested:

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].
5
  • Where are the error details? Looks like you have posted the same thing (command) twice. How large (file size) are the 7 input video files? Commented May 21, 2021 at 21:42
  • Sorry, I have updated the error details in main question. I have edited the question. Please advise. Kind Regards, Commented May 22, 2021 at 4:09
  • Share full log. Commented May 22, 2021 at 6:45
  • HIi, I have re-ran the code which has generated new set of files. Updated command and full logs. I have edited the orignal question. Please advise. Many thanks for your time. Commented May 22, 2021 at 7:45
  • Hi, I have now removed multiple videos to test and even 2 videos are also giving same error. I have updated my main question and added offset calculation. Please advise. Commented May 22, 2021 at 16:58

1 Answer 1

2

You're using the same input file for the first xfade filter. Instead of using [0][0]xfade, add the same file as another input and use [0][1]xfade. It may require less memory.

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
5
  • Many thanks @llogan, I tried this before and tried again. I am getting the Invalid file index error as explained in question: superuser.com/questions/1650697/… . I tried again then I am getting the same error even with 3 files. Please advise. Many thanks again for your help. Commented May 25, 2021 at 19:56
  • @D.B. Show your command and complete log. Commented May 25, 2021 at 20:05
  • Many thanks @llogan, My script and logs edited in this question. Please advise. Kind Regards. Commented May 26, 2021 at 17:08
  • @D.B. This is a completely different issue unrelated to the this particular question and answer regarding Cannot allocate memory. Your command is now different and no longer refer to the same input multiple times. This new issue is the same as your other question Invalid file index 14 in filtergraph description - FFMPEG. You have 3 inputs. ffmpeg starts counting from 0. So [3] would refer to input 4, but you don't have 4 inputs. You are trying to do 3 xfade and 3 acrossfade, but 3 files only need 2 xfade/acrossfade: input 0<xfade>input1<xfade>input2. Commented May 26, 2021 at 17:18
  • Not sure how to thank you. You solved my problem I am very grateful to you. Many Many thanks Commented May 26, 2021 at 19:32

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.