过滤器描述中的文件索引4无效

2019年11月15日 43点热度 0条评论

我尝试在android中创建视频编辑应用,但无法在此ffmpeg命令中创建视频输出。

-i /storage/emulated/0/MagicVideo_data/44_bhavishyavani/background_video.mp4 -loop 1 -t 7.94 -i /storage/emulated/0/MagicVideo_data/44_bhavishyavani/first.jpg -loop 1 -t 30 -i /storage/emulated/0/MagicVideo_data/44_bhavishyavani/black.jpg -i /storage/emulated/0/MagicVideo_data/watermark.png -filter_complex [1]split=2[color][alpha]; [color]crop=iw/2:ih:0:0[color]; [alpha]crop=iw/2:ih:iw/2:0[alpha]; [color][alpha]alphamerge[ovrly]; [0]scale=335:200[0_scalled]; [0]scale=720:-1[1_scalled]; [0]scale=335:200[3_scalled]; [4]scale=70:70[4_scalled]; [2:v][0_scalled]overlay=enable='between=(t,0,7.06)':x=377:y=110[new_bg1]; [new_bg1][1_scalled]overlay=enable='between=(t,7.06,7.94)':x=0:y=0[new_bg2]; [3:v][3_scalled]overlay=enable='between=(t,0,30)':x=377:y=110[new_bg3]; [new_bg2][new_bg3]concat=n=2:v=1:a=0,format=yuv420p[concatenated_video]; [concatenated_video][ovrly]overlay=0:0[base_video]; [base_video][4_scalled]overlay=enable='between(t,0,30)':x=(main_w-overlay_w-30):y=10 -t 30 -c:a copy -flags +global_header /storage/emulated/0/MagicVideo_data/20191224095135am.mp4 

影片档案

video file



错误:筛选器说明中的文件索引4无效

ffmpeg version n4.0-39-gda39990 Copyright (c) 2000-2018 the FFmpeg developers
      built with gcc 4.9.x (GCC) 20150123 (prerelease)
      configuration: --target-os=linux --cross-prefix=/root/bravobit/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/root/bravobit/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-ffprobe --enable-libopus --enable-libvorbis --enable-libfdk-aac --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-libvpx --enable-libass --enable-yasm --enable-pthreads --disable-debug --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-linux-perf --disable-doc --disable-shared --enable-static --enable-runtime-cpudetect --enable-nonfree --enable-network --enable-avresample --enable-avformat --enable-avcodec --enable-indev=lavfi --enable-hwaccels --enable-ffmpeg --enable-zlib --enable-gpl --enable-small --enable-nonfree --pkg-config=pkg-config --pkg-config-flags=--static --prefix=/root/bravobit/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/root/bravobit/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/root/bravobit/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-cxxflags=
      libavutil      56. 14.100 / 56. 14.100
      libavcodec     58. 18.100 / 58. 18.100
      libavformat    58. 12.100 / 58. 12.100
      libavdevice    58.  3.100 / 58.  3.100
      libavfilter     7. 16.100 /  7. 16.100
      libavresample   4.  0.  0 /  4.  0.  0
      libswscale      5.  1.100 /  5.  1.100
      libswresample   3.  1.100 /  3.  1.100
      libpostproc    55.  1.100 / 55.  1.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/MagicVideo_data/44_bhavishyavani/background_video.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf58.20.100
      Duration: 00:00:30.04, start: 0.000000, bitrate: 708 kb/s
        Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 1440x420, 574 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
        Metadata:
          handler_name    : ?Mainconcept Video Media Handler
        Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
        Metadata:
          handler_name    : #Mainconcept MP4 Sound Media Handler
    Input #1, image2, from '/storage/emulated/0/MagicVideo_data/44_bhavishyavani/first.jpg':
      Duration: 00:00:00.04, start: 0.000000, bitrate: 9715 kb/s
        Stream #1:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 720x420 [SAR 1:1 DAR 12:7], 25 fps, 25 tbr, 25 tbn, 25 tbc
    [mjpeg @ 0xeb66e680] EOI missing, emulating
    Input #2, image2, from '/storage/emulated/0/MagicVideo_data/44_bhavishyavani/black.jpg':
      Duration: 00:00:00.04, start: 0.000000, bitrate: 421 kb/s
        Stream #2:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 720x420 [SAR 1:1 DAR 12:7], 25 fps, 25 tbr, 25 tbn, 25 tbc
    Input #3, png_pipe, from '/storage/emulated/0/MagicVideo_data/watermark.png':
      Duration: N/A, bitrate: N/A
        Stream #3:0: Video: png, rgba(pc), 100x100, 25 tbr, 25 tbn, 25 tbc
    Invalid file index 4 in filtergraph description [1]split=2[color][alpha]; [color]crop=iw/2:ih:0:0[color]; [alpha]crop=iw/2:ih:iw/2:0[alpha]; [color][alpha]alphamerge[ovrly]; [0]scale=335:200[0_scalled]; [0]scale=720:-1[1_scalled]; [0]scale=335:200[3_scalled]; [4]scale=70:70[4_scalled]; [2:v][0_scalled]overlay=enable='between=(t,0,7.06)':x=377:y=110[new_bg1]; [new_bg1][1_scalled]overlay=enable='between=(t,7.06,7.94)':x=0:y=0[new_bg2]; [3:v][3_scalled]overlay=enable='between=(t,0,30)':x=377:y=110[new_bg3]; [new_bg2][new_bg3]concat=n=2:v=1:a=0,format=yuv420p[concatenated_video]; [concatenated_video][ovrly]overlay=0:0[base_video]; [base_video][4_scalled]overlay=enable='between(t,0,30)':x=(main_w-overlay_w-30):y=10.

解决方案如下:

首先删除文件夹中已创建的临时文件,然后存储另一个文件