我使用以下命令将音频与 webm视频合并。但是c
command = new String[]{"-i", inputvideoFileAbsolutePath, "-i", inputaudioFileAbsolutePath, "-c:v", "copy", "-c:a", "aac", "-map", "0:v:0", "-map", "1:a:0", "-shortest", outputFileAbsolutePath};
其中outputFileAbsolutePath扩展名为mp4。
但是命令失败并出现以下错误。但是命令似乎与其他输入视频格式(mp4,avi,mov,3gp)一起使用。为什么我在使用webm视频时出现此错误以及如何解决它
主要错误 -
无法为输出文件#0写入标头(编解码器参数不正确 ?):参数无效
完成错误 -
FAILED with output : 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, matroska,webm, from '/storage/emulated/0/Download/small.webm':
Metadata:
encoder : Lavf53.17.0
Duration: 00:00:05.57, start: 0.000000, bitrate: 329 kb/s
Stream #0:0: Video: vp8, yuv420p, 560x320, SAR 1:1 DAR 7:4, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
Stream #0:1(eng): Audio: vorbis, 48000 Hz, mono, fltp (default)
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, wav, from '/storage/emulated/0/Download/out.wav':
Metadata:
encoder : Lavf57.76.100
Duration: 00:00:33.88, bitrate: 1411 kb/s
Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
[mp4 @ 0xb61adc00] Could not find tag for codec vp8 in stream #0, codec not currently supported in container
Output #0, mp4, to '/storage/emulated/0/Movies/merge_video2.mp4':
Metadata:
encoder : Lavf57.25.100
Stream #0:0: Video: vp8, yuv420p, 560x320 [SAR 1:1 DAR 7:4], q=2-31, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc57.24.102 aac
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
[aac @ 0xb61fdc00] Qavg: nan