应用复杂的过滤与失败相关的音频的东西 [英] Applying filter complex fails with something related to audio

查看:259
本文介绍了应用复杂的过滤与失败相关的音频的东西的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我终于成功地将FFMPEG在这里详细: https://enoent.fr/blog/2014/06/20/compile-ffmpeg-for-android/ 并在最后,我有一个接受命令参数的的ffmpeg库。

我想这样吧,我用preparing这个ffmpeg的命令在视频应用水印图片:

 的ffmpeg -i input.avi -i logo.png -filter_complex叠加= 10:main_h-overlay_h-10'output.avi

我第一次尝试它使用ffmpeg.exe窗口和结果符合市场预期。

我已经使用了编译Android和输出如下试图在Android的:

  09-17 22:03:34.455:I / Videokit(18419):在加载22时33分十秒2014年9月15日编译的本地库
09-17 22:03:34.455:I / Videokit(18419):选项:ffmpeg的
09-17 22:03:34.455:I / Videokit(18419):选项:-loglevel
09-17 22:03:34.455:I / Videokit(18419):选项:调试
09-17 22:03:34.455:I / Videokit(18419):选项:-i
09-17 22:03:34.455:I / Videokit(18419):选项:/storage/emulated/0/vid.mp4
09-17 22:03:34.455:I / Videokit(18419):选项:-i
09-17 22:03:34.455:I / Videokit(18419):选项:/storage/emulated/0/logo.png
09-17 22:03:34.455:I / Videokit(18419):选项:-qscale:v
09-17 22:03:34.455:I / Videokit(18419):选项:1
09-17 22:03:34.455:I / Videokit(18419):选项:-filter_complex
09-17 22:03:34.455:I / Videokit(18419):选项:覆盖= 10:main_h-overlay_h-10
09-17 22:03:34.455:I / Videokit(18419):选项:/storage/emulated/0/outVid.mp4
09-17 22:03:34.455:I / Videokit(18419):主要运行
09-17 22:03:34.463:D / Videokit(18419):拆分命令行。
09-17 22:03:34.463:D / Videokit(18419):阅读选项-loglevel......
09-17 22:03:34.463:D / Videokit(18419):作为匹配选项和参数调试日志级别(设置日志记录级别)。
09-17 22:03:34.463:D / Videokit(18419):阅读选项'-i'...
09-17 22:03:34.463:D / Videokit(18419):匹配与参数/storage/emulated/0/vid.mp4'输入文件。
09-17 22:03:34.463:D / Videokit(18419):阅读选项'-i'...
09-17 22:03:34.463:D / Videokit(18419):匹配与参数/storage/emulated/0/logo.png'输入文件。
09-17 22:03:34.463:D / Videokit(18419):阅读选项'-qscale:V'...
09-17 22:03:34.463:D / Videokit(18419):作为匹配选项'qscale(使用固定质量量表(VBR))与参数'1'。
09-17 22:03:34.463:D / Videokit(18419):阅读选项-filter_complex......
09-17 22:03:34.463:D / Videokit(18419):作为匹配选项'filter_complex(创建FilterGraph动态复杂)与参数叠加= 10:main_h-overlay_h-10。
09-17 22:03:34.463:D / Videokit(18419):阅读选项/storage/emulated/0/outVid.mp4......
09-17 22:03:34.463:D / Videokit(18419):作为匹配输出文件。
09-17 22:03:34.463:D / Videokit(18419):已完成拆分命令行。
09-17 22:03:34.463:D / Videokit(18419):分析一组选项:全球。
09-17 22:03:34.463:D / Videokit(18419):与参数调试应用选项日志级别(设置日志记录级别)。
09-17 22:03:34.463:D / Videokit(18419):main_h-overlay_h-10:用争论覆盖= 10应用选项filter_complex(创建FilterGraph动态复杂)。
09-17 22:03:34.463:D / Videokit(18419):成功解析一组选项。
09-17 22:03:34.463:D / Videokit(18419):分析一组选项:输入文件/storage/emulated/0/vid.mp4。
09-17 22:03:34.463:D / Videokit(18419):成功解析一组选项。
09-17 22:03:34.463:D / Videokit(18419):打开输入文件:/storage/emulated/0/vid.mp4。
09-17 22:03:34.612:D / Videokit(18419):已成功打开的文件。
09-17 22:03:34.612:D / Videokit(18419):分析一组选项:输入文件/storage/emulated/0/logo.png。
09-17 22:03:34.612:D / Videokit(18419):成功解析一组选项。
09-17 22:03:34.612:D / Videokit(18419):打开输入文件:/storage/emulated/0/logo.png。
09-17 22:03:34.620:D / Videokit(18419):已成功打开的文件。
09-17 22:03:34.620:D / Videokit(18419):分析一组选项:输出文件/storage/emulated/0/outVid.mp4。
09-17 22:03:34.620:D / Videokit(18419):应用选项qscale:V(采用固定质量量表(VBR))与参数1。
09-17 22:03:34.620:D / Videokit(18419):成功解析一组选项。
09-17 22:03:34.620:D / Videokit(18419):打开一个输出文件:/storage/emulated/0/outVid.mp4。
09-17 22:03:34.627:D / Videokit(18419):已成功打开的文件。
09-17 22:03:34.643:I / Videokit(18419):转换失败!
09-17 22:03:34.643:I / Videokit(18419):流映射:
09-17 22:03:34.643:E / Videokit(18419):错误而开放连接codeR输出流#0:1 - 也许不正确的参数,如BIT_RATE,速度,宽度或高度

问题是错误而开放连接codeR输出流#0:1 - 也许不正确的参数,如BIT_RATE,速度,宽度或高度,这是主题相关的音频文件。我已删除的音频和我没有得到任何错误。

的ffmpeg -i vid.mp4 返回这样的:

 命令行:
ffmpeg的-i vid.mp4 -report
ffmpeg的版本N-66278-g91459bd版权所有(C)2000-2014 FFmpeg的开发者
  建于2014年9月14日22时05分07秒用gcc 4.8.3(GCC)
  配置:--enable-GPL --enable-版本3 --disable-w32threads --enable-AviSynth的--enable-bzlib --enable-fontconfig的--enable-frei0r --enable-GNUTLS --enable---enable的iconv -libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype建立--enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-了libmp3lame --enable -libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable- libtwolame --enable-libvidstab --enable-的libvo-aacenc --enable-的libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-的DeckLink --enable-zlib的
  libavutil 54 7.100 / 7.100 54
  libav codeC 56. 1.100 / 1.100 56
  56. libavformat流4.101 / 56 4.101
  libavdevice 56. 0.100 / 0.100 56
  libavfilter 5. 1.100 / 1.100 5
  libswscale 3. 0.100 / 0.100 3
  libswresample 1. 1.100 / 1.100 1.
  libpostproc 53. 0.100 / 0.100 53
拆分命令行。
阅读选项'-i'...匹配与参数vid.mp4'输入文件。
阅读选项'-report'...匹配的选项'报告'(生成报告)与参数'1'。
成品分裂命令行。
解析一组选项:全球。
与参数1应用选项报告(生成报告)。
成功解析一组选项。
解析一组选项:输入文件vid.mp4。
成功解析一组选项。
打开输入文件:vid.mp4。
[MOV,MP4,M4A,3GP,3G2,MJ2 @ 040e38c0]格式MOV,MP4,M4A,3GP,3G2,MJ2探测与大小= 2048和得分= 100
[MOV,MP4,M4A,3GP,3G2,MJ2 @ 040e38c0] ISO:文件类型主要品牌:ISOM
[MOV,MP4,M4A,3GP,3G2,MJ2 @ 040e38c0]之前avformat_find_stream_info()POS:19279字节读取:32768寻求:0
[MOV,MP4,M4A,3GP,3G2,MJ2 @ 040e38c0]所有资料找到
[MOV,MP4,M4A,3GP,3G2,MJ2 @ 040e38c0] avformat_find_stream_info()POS后:41952字节读取:65536寻求:0帧:2
输入#0,MOV,MP4,M4A,3GP,3G2,MJ2,从'vid.mp4:
  元数据:
    major_brand:ISOM
    minor_version:512
    compatible_brands:isomiso2avc1mp41
    EN codeR:Lavf55.19.104
  时间:00:00:14.58,启动:0.023222,比特率:1250 KB /秒
    流#0:0(UND),1,一万一千九百八十八分之一:视频:H264(约束基线)(AVC1 / 0x31637661),YUV420P,640x640 [SAR 1:1 DAR 1:1] 1099 KB /秒,29.97, 29.97 TBR,11988 TBN,59.94 TBC(默认)
    元数据:
      handler_name:VideoHandler
    流#0:1(UND),1,四万四千一分之一:音频:AAC(MP4A / 0x6134706D),44100赫兹,单声道,fltp,97 KB /秒(默认)
    元数据:
      handler_name:SoundHandler
    流#0:2(ENG),0,九万分之一:数据:无(RTP / 0x20707472),39 kb / s的
    元数据:
      handler_name:HintHandler
    流#0:3(ENG),0,四万四千一分之一:数据:无(RTP / 0x20707472),8 kb / s的
    元数据:
      handler_name:HintHandler
成功打开该文件。
必须指定至少一个输​​出文件
[AVIOContext @ 040e3f40]统计:65536字节读,0寻求


解决方案

的ffmpeg 有一个本地连接AAC codeR( -c:一个AAC ),但它被认为是实验性的,因此需要一个额外的选项: -strict实验(或 -strict -2 ,同一事物的不同名称)。

这是不是最好的连接通过的ffmpeg 支持codeR,但它不是最糟糕的不是。如有疑问,只需要提供它足够的比特率,直到它听起来不够好。欲了解更多信息请参见 FFmpeg的AAC音频编码指南

I finally managed to build ffmpeg as detailed in here: https://enoent.fr/blog/2014/06/20/compile-ffmpeg-for-android/ and in the end, I have a ffmpeg library which accepts command arguments.

I am trying to apply a watermark image over the video so for it I am using preparing this ffmpeg command:

ffmpeg -i input.avi -i logo.png -filter_complex 'overlay=10:main_h-overlay_h-10' output.avi

I have first tried it on windows using ffmpeg.exe and the result was as expected.

I have tried it on android using the compiled android and the output is as follows:

09-17 22:03:34.455: I/Videokit(18419): Loading native library compiled at 22:33:10 Sep 15 2014
09-17 22:03:34.455: I/Videokit(18419): Option: ffmpeg
09-17 22:03:34.455: I/Videokit(18419): Option: -loglevel
09-17 22:03:34.455: I/Videokit(18419): Option: debug
09-17 22:03:34.455: I/Videokit(18419): Option: -i
09-17 22:03:34.455: I/Videokit(18419): Option: /storage/emulated/0/vid.mp4
09-17 22:03:34.455: I/Videokit(18419): Option: -i
09-17 22:03:34.455: I/Videokit(18419): Option: /storage/emulated/0/logo.png
09-17 22:03:34.455: I/Videokit(18419): Option: -qscale:v
09-17 22:03:34.455: I/Videokit(18419): Option: 1
09-17 22:03:34.455: I/Videokit(18419): Option: -filter_complex
09-17 22:03:34.455: I/Videokit(18419): Option: overlay=10:main_h-overlay_h-10
09-17 22:03:34.455: I/Videokit(18419): Option: /storage/emulated/0/outVid.mp4
09-17 22:03:34.455: I/Videokit(18419): Running main
09-17 22:03:34.463: D/Videokit(18419): Splitting the commandline.
09-17 22:03:34.463: D/Videokit(18419): Reading option '-loglevel' ...
09-17 22:03:34.463: D/Videokit(18419):  matched as option 'loglevel' (set logging level) with argument 'debug'.
09-17 22:03:34.463: D/Videokit(18419): Reading option '-i' ...
09-17 22:03:34.463: D/Videokit(18419):  matched as input file with argument '/storage/emulated/0/vid.mp4'.
09-17 22:03:34.463: D/Videokit(18419): Reading option '-i' ...
09-17 22:03:34.463: D/Videokit(18419):  matched as input file with argument '/storage/emulated/0/logo.png'.
09-17 22:03:34.463: D/Videokit(18419): Reading option '-qscale:v' ...
09-17 22:03:34.463: D/Videokit(18419):  matched as option 'qscale' (use fixed quality scale (VBR)) with argument '1'.
09-17 22:03:34.463: D/Videokit(18419): Reading option '-filter_complex' ...
09-17 22:03:34.463: D/Videokit(18419):  matched as option 'filter_complex' (create a complex filtergraph) with argument 'overlay=10:main_h-overlay_h-10'.
09-17 22:03:34.463: D/Videokit(18419): Reading option '/storage/emulated/0/outVid.mp4' ...
09-17 22:03:34.463: D/Videokit(18419):  matched as output file.
09-17 22:03:34.463: D/Videokit(18419): Finished splitting the commandline.
09-17 22:03:34.463: D/Videokit(18419): Parsing a group of options: global .
09-17 22:03:34.463: D/Videokit(18419): Applying option loglevel (set logging level) with argument debug.
09-17 22:03:34.463: D/Videokit(18419): Applying option filter_complex (create a complex filtergraph) with argument overlay=10:main_h-overlay_h-10.
09-17 22:03:34.463: D/Videokit(18419): Successfully parsed a group of options.
09-17 22:03:34.463: D/Videokit(18419): Parsing a group of options: input file /storage/emulated/0/vid.mp4.
09-17 22:03:34.463: D/Videokit(18419): Successfully parsed a group of options.
09-17 22:03:34.463: D/Videokit(18419): Opening an input file: /storage/emulated/0/vid.mp4.
09-17 22:03:34.612: D/Videokit(18419): Successfully opened the file.
09-17 22:03:34.612: D/Videokit(18419): Parsing a group of options: input file /storage/emulated/0/logo.png.
09-17 22:03:34.612: D/Videokit(18419): Successfully parsed a group of options.
09-17 22:03:34.612: D/Videokit(18419): Opening an input file: /storage/emulated/0/logo.png.
09-17 22:03:34.620: D/Videokit(18419): Successfully opened the file.
09-17 22:03:34.620: D/Videokit(18419): Parsing a group of options: output file /storage/emulated/0/outVid.mp4.
09-17 22:03:34.620: D/Videokit(18419): Applying option qscale:v (use fixed quality scale (VBR)) with argument 1.
09-17 22:03:34.620: D/Videokit(18419): Successfully parsed a group of options.
09-17 22:03:34.620: D/Videokit(18419): Opening an output file: /storage/emulated/0/outVid.mp4.
09-17 22:03:34.627: D/Videokit(18419): Successfully opened the file.
09-17 22:03:34.643: I/Videokit(18419): Conversion failed!
09-17 22:03:34.643: I/Videokit(18419): Stream mapping:
09-17 22:03:34.643: E/Videokit(18419): Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height

The problem is Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height and this is somehow related to audio of the file. I have removed the audio and I get no error.

ffmpeg -i vid.mp4 returns this:

Command line:
ffmpeg -i vid.mp4 -report
ffmpeg version N-66278-g91459bd Copyright (c) 2000-2014 the FFmpeg developers
  built on Sep 14 2014 22:05:07 with gcc 4.8.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
Splitting the commandline.
Reading option '-i' ... matched as input file with argument 'vid.mp4'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file vid.mp4.
Successfully parsed a group of options.
Opening an input file: vid.mp4.
[mov,mp4,m4a,3gp,3g2,mj2 @ 040e38c0] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 040e38c0] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 040e38c0] Before avformat_find_stream_info() pos: 19279 bytes read:32768 seeks:0
[mov,mp4,m4a,3gp,3g2,mj2 @ 040e38c0] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 040e38c0] After avformat_find_stream_info() pos: 41952 bytes read:65536 seeks:0 frames:2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'vid.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.19.104
  Duration: 00:00:14.58, start: 0.023222, bitrate: 1250 kb/s
    Stream #0:0(und), 1, 1/11988: Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x640 [SAR 1:1 DAR 1:1], 1099 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und), 1, 1/44100: Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 97 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(eng), 0, 1/90000: Data: none (rtp  / 0x20707472), 39 kb/s
    Metadata:
      handler_name    : HintHandler
    Stream #0:3(eng), 0, 1/44100: Data: none (rtp  / 0x20707472), 8 kb/s
    Metadata:
      handler_name    : HintHandler
Successfully opened the file.
At least one output file must be specified
[AVIOContext @ 040e3f40] Statistics: 65536 bytes read, 0 seeks

解决方案

ffmpeg has a native AAC encoder (-c:a aac), but it is considered experimental, so an additional option is required: -strict experimental (or -strict -2, same thing different name).

This is not the best encoder supported by ffmpeg, but it is not the worst either. If in doubt just provide it enough bitrate until it sounds good enough. For more info see the FFmpeg AAC Audio Encoding Guide.

这篇关于应用复杂的过滤与失败相关的音频的东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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