
Make sure the movie.mp4, audio.mp3 and php-ffmpeg are available in the path where this file is located. $video->addFilter(new SimpleFilter()) īelow is the complete code of adding audio track to the video. Below is the quick fix of the code: $audioSource = 'audio.mp3' The solution is to add the second input as a filter. How to allow multiple input files in PHP-FFMpegĪfter an extensive search, I found a solution on StackOverflow. I couldn’t find any relevant documentation that explained the procedure to add multiple input files (-i movie.mp4 -i audio.mp3). $ffmpeg -i movie.mp4 -i audio.mp3 -codec:a libmp3lame -b:a 128k movie_output.mp4īut to achieve the same in PHP-FFMpeg code is not straight forward. Let’s look at the below command where -i argument is used to pass multiple input files to the ffmpeg command. In this tutorial, I’ll explain how to allow multiple input files in PHP-FFMpeg library. However, achieving the same using PHP-FFMpeg library was a challenge. So I can simply pass both the audio and video files as an argument and the job is done. The ffmpeg command-line tool allows me to input multiple files using -i argument. One of the requirement in the project was to add an audio track to the selected video. My recent assignment was to develop an online video editing software similar to Biteable, Moovly etc.Well, I knew I could use PHP-FFmpeg library that allows me to write PHP script and that can interact with ffmpeg installed on the system.
