FFMPEG:覆盖video_audio NOT连接或合并android

时间:2016-07-07 11:50:36

标签: android ffmpeg overlay android-video-player android-ffmpeg

我正在尝试覆盖两个视频+音频并制作单个视频,但我只获得第一个视频语音而不是第二个视频语音。这是我的代码:

String[] complexCommandv = {"ffmpeg", "-y", "-i", "/sdcard/videokit/in.mp4", "-i", "/sdcard/videokit/tttt.mp4", "-strict", "experimental", "-filter_complex", "[0:v:0]pad=iw*2:ih[bg];" + "[bg][1:v:1]overlay=w", "-s", "320x240", "-r", "30", "-b", "15496k", "-vcodec", "mpeg4", "-ab", "48000", "-ac", "2", "-ar", "22050", "/sdcard/videokit/partik.mp4"};

2 个答案:

答案 0 :(得分:0)

你应该使用这样的命令:

ffmpeg -i“videostream.mp4”-i“audiostream.aac”-acodec copy -vcodec copy“output.mp4”

答案 1 :(得分:0)

<强>呀!我自己用自定义代码制作了它。

        String[] complexCommand = {"ffmpeg", "-y", "-i", "/sdcard/videokit/g1.mp4",
                                    "-i", "/sdcard/videokit/t4.mp4",
                                    "-strict", "experimental", "-filter_complex",
                                    "[0:v:0]pad=iw*2:ih[bg];" + "[bg][1:v:1]overlay=w,scale=320x240; [0:1]pan=stereo|c0=2*c0|c1=3*c0[a0];[1:a]pan=stereo|c0=1*c0|c1=4*c0[a1];[a0][a1]amix=inputs=2:duration=first:dropout_transition=2",
                                    "-r", "30", "-b", "15496k", "-vcodec", "mpeg4", "-ab", "48000", "-ac", "2", "-ar", "22050", "-shortest", "/sdcard/videokit/parik.mp4"};