3
3
I have a folder filled with mp3 files. I would like to render them as mp4 video files with music visualisations - is there a way to do this though command line?
3
3
I have a folder filled with mp3 files. I would like to render them as mp4 video files with music visualisations - is there a way to do this though command line?
6
Use a program created for video editing:
for example, you may want to check AVIdemux, a free video editor designed for simple cutting, filtering and encoding tasks. that you can download from here for Linux, Windows, Mac...
There's even a tutorial on Create video from still image and from audio file.
By command line:
you can download ffmpeg
and use it from command line. It exists for Linux, Mac and Windows.
If we suppose that you are under Linux and you have all the needed packages and codec installed you can try something like:
ffmpeg -loop_input -i image.jpg -i sound.mp3 -shortest -b 1000k -acodec copy out.mp4
or
ffmpeg -loop_input -i image.jpg -i sound.mp3 -shortest -vcodec libx264 -vpre default -acodec copy out.mp4
To convert your sound.mp3
file in out.mp4
with the image image.jpg
.
When you find the right combination of codec/options that you want, then you can do a script to read each file in the directory, strip the extension (.mp3)from the name and add the new extension (.mp4, NewName=$(basename $MyFile .mp3).mp4
), select the image you want to put inside and execute the command that you have just found...
How to do the script is another question :-) and you can have some hint looking at Filename Expansion, or to this question or to this one. Please try to avoid to = parse the output of ls
, use solution with find
instead...
It's possible to create a script too, or you can use some freeware or shareware software, among all AVIdemux or Video Editor... or whatever the net will offer you.
References
2First linux command worked fine for me, however I needed to change -loop_input
to -loop 1
. I'm running Linux Mint 17. Thanks. – a coder – 2016-01-13T20:46:32.773
On Fedora 25, ffmpeg works without -loop_input -i image.jpg. – firo – 2017-02-23T13:01:48.563
MP3 files are music files without pictures. Where do you figure the video part will come from. And forget the command line for such a conversion. – whs – 2015-05-09T10:42:37.187