添加音频后,FFMpeg将音频混合到视频会创建静音视频,

时间:2018-03-25 11:43:03

标签: android audio video ffmpeg

使用FFMpeg

添加音频后,

将音频混合到视频会创建静音视频

这是我正在使用的命令

"-y","-i",j,"-filter_complex","amovie="+audio+":loop=999,asetpts=N/SR/TB,atrim=0:18,adelay=50000|50000,aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=1.5[a1];[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=2.0[a2];[a1][a2]amerge,pan=stereo:c0<c0+c2:c1<c1+c3[out]","-map","0:v","-map","[out]","-c:v","copy","-c:a","aac","-preset", "ultrafast", out

我有一段2分7秒钟的视频,我希望将音频“混合”到从50秒到68秒的部分

我想要的是保持视频中的原始声音并将音频混合到现有的视频声音(不是过度写入),(保留旧的视频声音和视频中的新音频)

发生了什么事情,直到50秒视频有自己的声音,从50-68音频结束写入视频声音从那时到最后它是沉默的

我想要的是视频通过视频发出声音并将音频混合50-68秒

这张图片可以解释我想要的东西和我得到的东西

我想要什么 enter image description here 我得到了什么 enter image description here 我面临的另一个问题是 如果我在一个静音视频上尝试这个(完全没有声音的视频)这个代码失败这就是我得到的错误

ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8 (GCC)
  configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
  libavutil      55. 17.103 / 55. 17.103
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 31.100 /  6. 31.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/sdcard0/abcd/Videos/20180325_164206.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2018-03-25 16:44:15
  Duration: 00:02:05.21, start: 0.000000, bitrate: 1585 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x1280, 1584 kb/s, SAR 1:1 DAR 9:16, 11.83 fps, 90k tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2018-03-25 16:44:15
      handler_name    : VideoHandle
[mp3 @ 0xaca26b40] Skipping 0 bytes of junk at 417.
[Parsed_pan_9 @ 0xac9b17e0] This syntax is deprecated. Use '|' to separate the list items.
Stream specifier ':a' in filtergraph description amovie=/storage/sdcard0/abcd/Videos/baby.mp3:loop=999,asetpts=N/SR/TB,atrim=0:18,adelay=50000|50000,aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=1.5[a1];[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=2.0[a2]; [a1][a2]amerge,pan=stereo:c0<c0+c2:c1<c1+c3[out] matches no streams.

我们如何将音频添加到无声视频

0 个答案:

没有答案