FFmpeg audio and video integration

Java applet for the development of useful FFmpeg to integrate audio and video, the following are a few methods package, use can be called directly.

1: remove the original audio video

2: The removal of the audio video recording integrated into the

In fact, FFmpeg can directly record sound directly overwrite the original video, but found some video recording and can not be integrated in the development process, it may FFmpeg is not enough to understand, so prudent approach is to split it into two command. (above)

3: MP4 format video into a format Ts

4: a plurality of integrated video ts and MP4 format transcoding

But if you are using a local, then you can modify the following two lines of code in linux this method can be used normally

String shellCommand = "/usr/bin/ffmpeg -i " + allTs +" -c copy -bsf:a aac_adtstoasc -movflags +faststart " + videoOutputPath;
String[] cmd = {"/bin/sh", "-c", shellCommand};

5: Merge Multi-audio

Modifications: 1: The first line of code in the "/ usr / bin" removal, use ffmpeg directly spliced.

                 (Using ffmpeg command in linux, because it is equivalent to a shell script, linux need to be performed as the local cmd) 

               2: a second line removed

Because development is the integration of multiple videos, if you are a single video, two methods 3, 4 is not required. For reference, can be adjusted according to their needs.

The second scheme is the first multi-audio were merged, which is 5 to call this method, and then merge the whole video.

Guess you like

Origin blog.csdn.net/weixin_43683726/article/details/91360672