sábado, 4 de marzo de 2023

convert mp3 to video

 

Using an image

ffmpeg -loop 1 -i input.jpg -i input.mp3 -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:-1:-1:color=black,setsar=1,format=yuv420p" -shortest -fflags +shortest output.mp4

This command uses the scale + pad filters to make image fit into 1920x1080, setsar filter to set a normal Sample Aspect Ratio, then the format filter sets the chroma subsampling to YUV 4:2:0 for playback compatibility.

See Resizing videos with ffmpeg to fit into specific size for more info and examples.

Generating a color background

If you want a plain color background use the color filter:

ffmpeg -f lavfi -i color=c=blue:s=1280x720 -i input.mp3 -shortest -fflags +shortest output.mp4

Adding text

You can add text with the drawtext filter:

ffmpeg -f lavfi -i color=c=blue:s=1280x720 -i input.mp3 -vf "drawtext=fontfile=/path/to/font.ttf:text='Your Text':fontcolor=white:fontsize=24:box=1:boxcolor=black@

No hay comentarios:

Publicar un comentario