Friday, November 3, 2017

create video from one audio file and one image file, single command

1- use ffmpeg with x264

$ ffmpeg -loop 1 -i image1.jpg -i audio1.mp3 -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest out.mp4

(about 8Mb)

2- we want to use x265, we need more steps, follow the link below to create only the video file from the image

then run
$ ffmpeg -i myvideo.avi -i audio1.mp3 -c:v libx265   output.mp4

(about 5Mb)

for smaller size
 $  ffmpeg -i myvideo.avi -i audio1.mp3 -c:v libx265  -c:a aac -b:a 64k  output.mp4

 $ ffmpeg -i myvideo.avi -i audio1.mp3 -c:v libx265  -c:a aac -b:a 64k -pix_fmt yuv420p -shortest output.mp4

 (about 3Mb)

ffmpeg also support other formats, below:

ffmpeg -i <input> -c:v huffyuv output.avi
ffmpeg -i <input> -c:v ffv1 output.avi
ffmpeg -i <input> -c:v libx264 -crf 0 output.mp4
ffmpeg -i <input> -c:v libx265 -crf 0 output.mp4
ffmpeg -i <input> -c:v libvpx-vp9 -lossless 1 output.webm

No comments:

Post a Comment