Created
December 7, 2013 23:06
-
-
Save mzdravkov/7851061 to your computer and use it in GitHub Desktop.
A small script that takes source_dir, image, destination_dir. All it do is to get all mp3s from the dir and convert them to music videos with one image for the whole song. Like the most youtube videos are. It's really handy if you need to upload a lot of songs to youtube.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ARGV.member? 'help' | |
print <<-help | |
first argument is directory with all the songs you convert to videos | |
second argument is the image you want to put on the videos | |
third argument is directory where videos will be saved | |
help | |
else | |
dir_with_songs = ARGV[0] | |
image = ARGV[1] | |
output_dir = ARGV[2] | |
Dir[File.join(dir_with_songs, '*.mp3')].each do |s| | |
song_name = File.basename s, '.mp3' | |
`avconv -i "#{s}" -loop 1 -shortest -i "#{image}" -r 24 -acodec copy "#{File.join(output_dir, song_name)}.mkv"` | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment