-
-
Save KrzaQ/7f1a59d3ad246e900c5b to your computer and use it in GitHub Desktop.
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
OutDir = 'out' | |
Scale = '640:-1' | |
AllowedExtenstions = ['avi', 'mp4'] | |
def convert(filename, ext) | |
command = "ffmpeg -i #{filename}.#{ext} -vf scale=#{Scale} -strict -2 #{OutDir}/#{filename}_small.#{ext}" | |
p command | |
`#{command}` | |
end | |
Dir["./*.{#{AllowedExtenstions.join(",")}}"].map{ |f| | |
ext = AllowedExtenstions.find {|ext| f.end_with? ext } | |
base = File.basename(f, ".#{ext}") | |
[base, ext] | |
}.each{ |basename, ext| | |
convert(basename, ext) | |
# p [basename, ext] | |
} | |
# ffmpeg -i VID_20150407_220615_TU3.mp4 -vf scale=640:-1 -strict -2 VID_20150407_220615_TU3_small.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment