


audio from one video runs over into the next video etc. In the final output, the audio is slightly out of sync, i.e. "concat", "-i", Constants.TEMP_DIR_PATH + listFile.getName(), Using this Java below ProcessBuilder pb = new ProcessBuilder( c:v copy -c:a aac -strict experimental output.mp4 I then add all of the video files into a textfile, and concat that text file using ffmpeg -f concat -i list.txt -safe 0 With this code below in the Java application if(getVideoAttribute(video, "a:0", "duration") != null) map 0:v -map 1:a -c:v copy -shortest output.mp4 Or if there is no existing audio ffmpeg -y -i video.mp4 -i audio.mp3 -af apad filter_complex "aresample=async=1,volume=1.0 Īmix=inputs=2 -map 0:v -map "" -c:v copy I'm processing a load of videos to concat together using Java on a Linux server.įirst, I mix in an audio track with this process, depending on if the video already has audio or not.
