Skip to content

Instantly share code, notes, and snippets.

@cdesch
Created September 16, 2015 19:20
Show Gist options
  • Save cdesch/c2bef6becc696034c290 to your computer and use it in GitHub Desktop.
Save cdesch/c2bef6becc696034c290 to your computer and use it in GitHub Desktop.
Shorten all videos in a directory to a specified time using ffmpeg
puts 'Converting FLV files'
basedir = '.'
Dir.glob("*.mp4") do |my_text_file|
puts ' --> converting: ' + my_text_file
puts "ffmpeg -i #{my_text_file.gsub(/ /, '\ ')} -ss 00:00:00.0 -c copy -t 00:00:10.0 new.#{my_text_file.gsub(/ /, '\ ')}"
`ffmpeg -i #{my_text_file.gsub(/ /, '\ ')} -ss 00:00:00.0 -c copy -t 00:00:10.0 new.#{my_text_file.gsub(/ /, '\ ')}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment