Skip to content

Instantly share code, notes, and snippets.

@TheRusskiy
Created January 6, 2015 14:09
Show Gist options
  • Save TheRusskiy/aa314f6548da41945a07 to your computer and use it in GitHub Desktop.
Save TheRusskiy/aa314f6548da41945a07 to your computer and use it in GitHub Desktop.
Embed subtitles for all videos in a folder
require 'awesome_print'
folder = "/media/media_nas_drive/Train/Video/Biology/Consumer Neuroscience/"
folder_for_cd = folder.gsub(' ', '\ ')
files = Dir[folder+'*.mp4'].map{|f| f.gsub(folder, '').gsub('.mp4', '')}
files.each_with_index do |f, i|
ap "!!!!!!!!!"
ap "#{i+1}/#{files.length}"
ap "!!!!!!!!!"
system "cd #{folder_for_cd} && ffmpeg -i \"#{f}.mp4\" -f srt -i \"#{f}.srt\" -c:v copy -c:a copy \
-c:s mov_text \"new_video/#{f}.mp4\""
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment