Skip to content

Instantly share code, notes, and snippets.

@vitaliel
Created December 23, 2009 19:05
Show Gist options
  • Select an option

  • Save vitaliel/262711 to your computer and use it in GitHub Desktop.

Select an option

Save vitaliel/262711 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
# Convert videos to mp4 for my TV
def convert(ext)
# ext = "ogv"
files = Dir["*.#{ext}"]
files.each do |file|
out = "#{file.gsub(/#{ext}$/, '')}mp4"
next if test ?f, out
# cmd = "ffmpeg -i #{file} -f mp4 -vcodec copy -acodec copy #{out}"
cmd = "ffmpeg -i #{file} -threads 4 -f mp4 #{out}"
puts cmd
system cmd
end
end
%w{mov flv f4v ogv ogg}.each do |ext|
convert(ext)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment