Skip to content

Instantly share code, notes, and snippets.

@georgismitev
Created June 12, 2014 09:53
Show Gist options
  • Save georgismitev/7125bb850dc2146639be to your computer and use it in GitHub Desktop.
Save georgismitev/7125bb850dc2146639be to your computer and use it in GitHub Desktop.
require 'pry'
umgi_dir = "/Volumes/OS/interlaced"
files = Dir.glob("#{umgi_dir}/**/*.mp4")
files.each do |f|
result = [f]
ffmpeg_command = "ffmpeg -filter:v idet -frames:v 500 -an -f rawvideo -y /dev/null -i #{f} 2>&1 | awk -F 'detection: ' '/detection/ { print $2 }'"
ffmpeg_result = `#{ffmpeg_command}`
if ffmpeg_result
result_lines = ffmpeg_result.split("\n")
result_lines.each do |l|
result.concat(l.split(" ").map { |r| r.split(":").last })
end
interlaced = 0
interlaced = 1 if result[1].to_i + result[2].to_i + result[5].to_i + result[6].to_i > 60
result.concat([interlaced])
puts result.join("\t")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment