-
Notifications
You must be signed in to change notification settings - Fork 24
Batching
Although the other-transcode.rb tool can accept multiple inputs, batch processing is still best handled by a separate script because that allows pausing the process or changing those inputs while the script is executing.
The following Ruby script does just that and should work on Windows, Linux and macOS. Just copy the text below and save it to a file named batch.rb:
#!/usr/bin/env ruby
#
# batch.rb
#
QUEUE_PATH = 'queue.txt'
while true
content = File.read(QUEUE_PATH)
input = content.match(/^.*\R/).to_s.chomp
break if input.empty?
queue = File.new(QUEUE_PATH, 'wb')
queue.print content.sub(/^.*\R/, '')
queue.close
break unless system('other-transcode.rb', *ARGV, input)
end
The contents of queue.txt is just a list of videos, full paths without quotes, delimited by carriage returns:
C:\Rips\Movie.mkv
C:\Rips\Another Movie.mkv
C:\Rips\Yet Another Movie.mkv
The path is first deleted from the queue.txt file and then passed as an argument to the other-transcode.rb tool after any other arguments to the script itself.
This means calling the script to transcode each item in the list with custom options, like HEVC video and Dolby Digital Plus (Enhanced AC-3) audio, is as simple as:
.\batch.rb --hevc --eac3
To pause processing of the list, simply insert a blank line at the top of the queue.txt file.