ffmpeg concat视频不会抛出这样的过滤器错误

czfnxgou  于 2021-06-27  发布在  Java
关注(0)|答案(1)|浏览(387)

我试着用ffmpeg压缩三个视频,
这是我正在使用java运行时执行的命令

String command = "ffmpeg -i url_to_video -i url_to_video -i url_to_video -filter_complex [0:v] [0:a] [1:v] [1:a] [2:v] [2:a] concat=n=3:v=1:a=1 [v] [a] -map [v] -map [a] /home/rohan/output.mp4";

    Process process = Runtime.getRuntime().exec(command.split(" "));

这是抛出我没有这样的过滤器错误,而如果我试图运行这个通过终端,它的工作非常好。我尝试通过删除或添加引号来调整cmd,但是在terminal上运行的这个命令的任何变体都会在java运行时抛出错误。虽然它在终端上运行得很好。
我尝试过绝对路径和amazons3url,但它们在终端中都可以正常工作,命令的s3变体抛出 No Such Filter 错误,绝对路径命令抛出 No Such File Or Directory 运行时出错。
这是错误的堆栈跟踪

Here is the standard error of the command (if any):

ffmpeg version n4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix= --prefix=/usr --disable-debug --disable-doc --disable-static --enable-cuda --enable-cuda-sdk --enable-cuvid --enable-libdrm --enable-ffplay --enable-gnutls --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libmp3lame --enable-libnpp --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopus --enable-libpulse --enable-sdl2 --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxvid --enable-nonfree --enable-nvenc --enable-omx --enable-openal --enable-opencl --enable-runtime-cpudetect --enable-shared --enable-vaapi --enable-vdpau --enable-version3 --enable-xlib
  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
  libpostproc    55.  7.100 / 55.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://openxcell-development-public.s3.ap-south-1.amazonaws.com/bhit/outputForBHit.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:00:10.57, start: 0.000000, bitrate: 2048 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1696 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 347 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'https://openxcell-development-public.s3.ap-south-1.amazonaws.com/bhit/outputForBHit.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:00:10.57, start: 0.000000, bitrate: 2048 kb/s
    Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1696 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 347 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'https://openxcell-development-public.s3.ap-south-1.amazonaws.com/bhit/outputForBHit.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
  Duration: 00:00:10.57, start: 0.000000, bitrate: 2048 kb/s
    Stream #2:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1696 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #2:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 347 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[AVFilterGraph @ 0x564151595680] No such filter: ''
Error initializing complex filters.
Invalid argument
t8e9dugd

t8e9dugd1#

如果要提供不带引号的filtergraph字符串,则它不能有任何空格(不带引号/不带空格)
所以

-filter_complex [0:v] [0:a] [1:v] [1:a] [2:v] [2:a] concat=n=3:v=1:a=1 [v] [a]

可能是的

-filter_complex [0:v][0:a][1:v][1:a][2:v][2:a]concat=n=3:v=1:a=1[v][a]

相关问题