FFmpeg - 无法识别的选项'map [outv]' [英] FFmpeg - Unrecognized option 'map [outv]'

查看:771
本文介绍了FFmpeg - 无法识别的选项'map [outv]'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将一些视频文件与FFmpeg合并,并且与我的自定义构建有问题。我使用以下Java代码来包装ffmpeg命令:

I am merging some video files with FFmpeg and having an issue with my custom build. I'm using the following Java code for wrapping the ffmpeg command:

List<String> cmds = new ArrayList<>();
cmds.add("ffmpeg");
cmds.add("-i");
cmds.add("input1.mp4");
...
cmds.add("-map [outv]");
cmds.add("-map [a]");
...
cmds.add("output.mp4");

ProcessBuilder pb = new ProcessBuilder(cmds);
pb.directory(fileExec);
Process process = pb.start();
int exitVal = process.waitFor();

我使用的命令是(简称 filter_complex ):

The command I am using is (abbreviated filter_complex):

ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex "... [bla1][bla2]overlay=main_w-overlay_w:main_h-overlay_h:format=yuv420[outv]" -c:v libx264 -preset ultrafast -b:v 45000k -aspect 1.7777778 -map [outv] -map [a] -c:a libfdk_aac -ac 2 -b:a 128k -t 24 output.mp4

我收到错误:

Unrecognized option 'map [outv]'.

我是否缺少配置选项以包含地图?在哪里可以找到map命令需要哪些选项的信息?还是我的ffmpeg太老了,很多其他类似的问题? 2015-02-25是最近的!

Am I missing a configuration option to include map? Where would I find this information of what options are required for the map command? Or is my ffmpeg just too old like lots of the other similar questions? 2015-02-25 is pretty recent!

完整的命令:

ffmpeg -y -i VID_20150609_154943_5583.mp4 -i VID_20150609_154943_24253.mp4 -i VID_20150609_154943_16083.mp4 -i stamp.png -f lavfi -i color=black -filter_complex " [0:v]scale=iw*min(1280/iw\,720/ih):ih*min(1280/iw\,720/ih),pad=1280:720:(ow-iw*min(ow/iw\,oh/ih))/2:(oh-ih*min(ow/iw\,oh/ih))/2,format=pix_fmts=yuva420p,fade=t=out:st=7.99:d=2:alpha=1,setpts=expr=PTS-STARTPTS[va0] ; [0:a]afade=t=out:st=7.99:d=2[a0] ; [1:v]scale=iw*min(1280/iw\,720/ih):ih*min(1280/iw\,720/ih),pad=1280:720:(ow-iw*min(ow/iw\,oh/ih))/2:(oh-ih*min(ow/iw\,oh/ih))/2,format=pix_fmts=yuva420p,fade=t=in:st=0:d=2:alpha=1,fade=t=out:st=15.98:d=2:alpha=1,setpts=expr=PTS-STARTPTS+7.99/TB[va1] ; [1:a]afade=t=in:st=0:d=2,afade=t=out:st=15.98:d=2[a1] ; aevalsrc=0:d=7.99[s1] ; [s1][a1]concat=n=2:v=0:a=1[ac1] ; [2:v]scale=iw*min(1280/iw\,720/ih):ih*min(1280/iw\,720/ih),pad=1280:720:(ow-iw*min(ow/iw\,oh/ih))/2:(oh-ih*min(ow/iw\,oh/ih))/2,format=pix_fmts=yuva420p,fade=t=in:st=0:d=2:alpha=1,setpts=expr=PTS-STARTPTS+15.98/TB[va2] ; [2:a]afade=t=in:st=0:d=2[a2] ; aevalsrc=0:d=15.98[s2] ; [s2][a2]concat=n=2:v=0:a=1[ac2] ; [4:v]scale=1280x720,trim=duration=23.97[over0] ; [a0][ac1][ac2]amix=inputs=3[a]; [over0][va0]overlay[over1];[over1][va1]overlay[over2];[over2][va2]overlay[over3] ; [over3][3:v]overlay=main_w-overlay_w:main_h-overlay_h:format=yuv420[outv] " -c:v libx264 -preset ultrafast -b:v 45000k -aspect 1.7777778 -map [outv] -map [a] -c:a libfdk_aac -ac 2 -b:a 128k -t 23.97 VID_20150609_155417.mp4
ffmpeg version git-2015-02-25-b0d3322 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.8 (GCC)
  configuration: --arch=arm --cpu=cortex-a8 --target-os=linux --enable-runtime-cpudetect --enable-pic --disable-shared --enable-static --cross-prefix=/home/jon/Development/android-ndk-r10d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --enable-cross-compile --sysroot=/home/jon/Development/android-ndk-r10d/platforms/android-9/arch-arm/ --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon -fPIE -pie' --extra-ldflags='-L../x264 -fPIE -pie' --enable-version3 --enable-gpl --disable-doc --enable-yasm --disable-decoders --enable-decoder='mpeg4,aac,h264,mpegvideo,mpeg1video,mpeg2video,png,mjpeg' --disable-encoders --enable-encoder='mpeg4,aac,h264,libx264,mpeg1video,mpeg2video,png' --disable-parsers --enable-parser='aac,mpeg4video,ac3,h261,h264,vc1,mpegvideo' --disable-demuxers --enable-demuxer='aac,h264,mpegvideo,m4v,mov,vc1,mp4,concat,image2' --disable-muxers --enable-muxer='h264,mpeg1video,mpeg2video,m4v,mov,vc1,md5,mp4' --enable-protocols --enable-indev='v4l,v4l2' --disable-filters --enable-filter='aresample,scale,movie,overlay' --enable-avfilter --disable-indevs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-symver --enable-network --enable-libx264 --enable-zlib
  libavutil      54. 19.100 / 54. 19.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 23.105 / 56. 23.105
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.101 /  5. 11.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Unrecognized option 'map [outv]'.


推荐答案

这个问题不是真的是ffmpeg的问题,一个错过使用Java功能的ProcessBuilder。当为ProcessBuilder提供一个字符串参数列表时,我给了 ['ffmpeg,...,'-map [outv]',...] 。因为ProcessBuilder将每个列表项视为一个参数,而应该是 ['ffmpeg,...,'-map','[outv]',...] 因此,ffmpeg无法识别参数'map [outv]'

This question is not really a problem with ffmpeg, but a miss usage of the Java function ProcessBuilder. When providing ProcessBuilder with a list of string arguments, I was giving ['ffmpeg, ..., '-map [outv]', ...]. This instead should be ['ffmpeg, ..., '-map', '[outv]', ...] because ProcessBuilder treats each list item as an argument. Hence ffmpeg not recognising the argument 'map [outv]'.

感谢@slhck帮助我出来。

Thanks to @slhck for helping me figure this out.

这篇关于FFmpeg - 无法识别的选项'map [outv]'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆