Skip to content

Instantly share code, notes, and snippets.

@kasimte
Last active September 29, 2023 05:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kasimte/d3c708b993816c05599fd1a3d9dc438d to your computer and use it in GitHub Desktop.
Save kasimte/d3c708b993816c05599fd1a3d9dc438d to your computer and use it in GitHub Desktop.
Ruby script to convert MOV files to mp4.
# Usage:
#
# 1) cd <my-directory-with-mov-files>
# 2) ruby convert-mov-to-mp4.rb
#
mov_files = Dir[Dir.pwd() + "/*.MOV"]
mov_files.each do |file|
puts "Processing file: #{ file }"
# extract the basename for renaming
basename = File.basename(file, File.extname(file))
# run the conversion in the shell
command = "ffmpeg -i #{ file } -vcodec copy -acodec copy #{ basename }.mp4"
puts "Run: #{ command }"
wasGood = system( command )
puts wasGood
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment