Skip to content

Instantly share code, notes, and snippets.

@justinledwards
Created June 9, 2017 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinledwards/27d6f89c615177bd6133f31363c3ca49 to your computer and use it in GitHub Desktop.
Save justinledwards/27d6f89c615177bd6133f31363c3ca49 to your computer and use it in GitHub Desktop.
Advice required for first crystal app
# Recorded OTA Conversion App
files = [] of String
Dir.cd "/mnt/MediaArchive/TV-Optimized/"
directory = Dir.glob("**/*")
directory.each do |file|
# TODO, filter files listed to a new array for things that need converting
files << file if /\.ts$/ =~ file
end
# TODO make each file convert using ffmpeg, but plan for killing ffmpeg if it's been running for over an hour \
# TODO possibly spawn this into a new thread
files.each do |file|
io = IO::Memory.new
args = [] of String
args << "-n -i #{file} -metadata title=\"\" -vf scale=-1:720 -c:v libx264 -preset fast -c:a:0 libfaac -b:a:1 128k -c:a:1 copy -movflags +faststart #{file}.mp4"
test = Process.run "ffmpeg", args, output: io
puts io
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment