See Text on video using ffmpeg for many more examples. Reportedly, scipy can import 48+ kHz files. 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 -shortest -fflags +shortest output.mp4 The MP3 intermediation route works because ffmpeg, in this case, automatically downsamples inputs to 48 kHz. 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 But if you don’t need pydub for anything else, you can just use the built-in subprocess module to. So you do have to install ffmpeg to make this work. The pydub module uses either ffmpeg or avconf programs to do the actual conversion. See Resizing videos with ffmpeg to fit into specific size for more info and examples. Output: Here you can see there is a python script And hello.mp3 file which converts it into a result.wav file. 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. 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
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |