Skip to content

Instantly share code, notes, and snippets.

@kasimte
Last active September 29, 2023 05:02
Show Gist options
  • Select an option

  • Save kasimte/d3c708b993816c05599fd1a3d9dc438d to your computer and use it in GitHub Desktop.

Select an option

Save kasimte/d3c708b993816c05599fd1a3d9dc438d to your computer and use it in GitHub Desktop.

Revisions

  1. kasimte revised this gist Nov 21, 2019. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions convert-mov-to-mp4.rb
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,8 @@
    # 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|
  2. kasimte created this gist Nov 21, 2019.
    12 changes: 12 additions & 0 deletions convert-mov-to-mp4.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    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