Concat image and mp3 to video with FFmpeg on macOS
To concatenate an image and an MP3 file to create a video using FFmpeg on macOS, you can use the following command:
ffmpeg -loop 1 -i image.jpg -i audio.mp3 -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest output.mp4
This command uses the -loop 1
option to loop the image for the duration of the audio, the -i
option to specify the input files, the -c:v
option to set the video codec to H.264, the -tune stillimage
option to optimize the encoding for still images, the -c:a
option to set the audio codec to AAC, the -b:a
option to set the audio bitrate to 192 kbps, the -pix_fmt yuv420p
option to set the pixel format, and the -shortest
option to end the output file when the shortest input file ends. The final result is saved as "output.mp4".
It's recommended to use the latest version of FFmpeg, you can install it using a package manager like brew install ffmpeg