ffmpeg 定点音频插入视屏

ffmpeg 库的地址
https://github.com/tanersener/mobile-ffmpeg

在10000的位置插入 test2.mp3  20000毫秒插入test3.mp3  30000毫秒的位置插入test4.mp3    最后生成 /apptend.mp3
ffmpeg -y -i /storage/emulated/0/1/audio/test1.mp3 -i /storage/emulated/0/1/audio/test2.mp3 -i /storage/emulated/0/1/audio/test3.mp3 -i /storage/emulated/0/1/audio/test4.mp3 -filter_complex  "[1]adelay=10000|10000[1_];  [2]adelay=20000|20000[2_];  [3]adelay=30000|30000[3_];  [0][1_][2_][3_]amix=4"  /storage/emulated/0/1/audio/apptend.mp3

//音频和视屏混音
ffmpeg -i /storage/emulated/0/1/video/1.mp4 -i /storage/emulated/0/1/audio/apptend.mp3 -vcodec copy -filter_complex amix=inputs=2:duration=first -strict -2 /storage/emulated/0/1/output/mix.mp4


 /**
     * key  录音音频地址
     * value 配音的截止时长  多少毫秒
     */
    public String getmixAudiocommandLine(LinkedHashMap para, String outputAudioPath){

        String preCommand = "-y";

        String lastCommand=" -filter_complex  \"";

        int index=0;

        String  tip="_";

        for (Map.Entry entry : para.entrySet()) {
            index++;
            String audioAddress = entry.getKey();
            preCommand+=" -i "+audioAddress;

           int audioLength = entry.getValue();


           if (index==para.entrySet().size()){

               for (int j=0;j

你可能感兴趣的:(ffmpeg 定点音频插入视屏)