Closed platonium closed 4 years ago
@platonium What OS platform are you using? That would help greatly in diagnosing what the problem might be.
And, yes, you can edit the batch.rb
file to add your preferred options.
Thanks, Don, this is on Windows 10.
@platonium OK, then I'll skip to the next step in diagnostics...
Please add this line to your batch.rb
script somewhere after the comment header but before the line containing while true
:
puts 'testing'
...and run the script again. I want to find out if your script is actually being called by the Ruby interpreter on Windows. If you execute ./batch.rb
again and don't see testing
printed to your console then something is wrong with your Ruby configuration.
But if you do see that, then we'll move on to the next step.
Thanks, I put the line after queue_path and before the while true.
The command line spit out the same line as before and added the word testing on a separate line underneath, then a full line, and then the cmd prompt>.
The queue.txt file still has the file location of the first (and only) movie on the list.
@platonium OK, now you can remove that "puts 'testing'
" line from your batch.rb
script.
Before I move to the next step, though, I need you to clarify this:
The command line spit out the same line as before
I was under the impression from your previous description of the behavior that nothing happened. So please paste in your complete console spew here so I know what you mean.
Sorry for being imprecise: the command prompt returns nothing after the .\batch.rb, just a space for the command prompt.
Command prompt>.\batch.rb
Command promot>
@platonium Ah! Got it. That makes more sense. Thanks. OK, back to the steps...
With the temporary inclusion of that "puts 'testing'
" line, we know that your Ruby interpreter on Windows 10 is working correctly in that you can definitely execute non-Gem scripts.
That means we've narrowed the scope of the problem to be something wrong with the way you copied the script from the wiki or something wrong with the contents of your queue.txt
file.
Let's assume for now that you copied the script correctly and focus on your queue.txt
file.
Is the first line of your queue.txt
file a full path to your movie? Because if the first line of your queue.txt
file is a blank line then the behaviour you're seeing is what I would expect to happen, i.e. nothing.
Thank you so much, Don. This is what's in queue.txt using copy as path. Have also tried without the quotes. Blank output seems the same. Edit: confirmed that there's no blank line at the beginning. The following are the entire contents of the file with no preceding blank lines.
"C:\Video\SECRET_GARDEN_16X9FF\The Secret Garden (1993).mkv"
or
C:\Video\SECRET_GARDEN_16X9FF\The Secret Garden (1993).mkv
@platonium OK, you should not put quotes around the path names. That definitely won't work.
Next question, does that line end with a carriage return/line feed? If there's no line ending character, then the batch.rb
script won't work correctly.
If you're not sure whether there's a line ending character, just add a blank line after the path and try again.
LOL, that did it. So the "delimited by carriage returns" as noted in the wiki was much more important than I realized. Thank you again for your patience. Is it ok to continue with the options question in this issue?
@platonium I'm so glad we solved that together!
And, sure, go ahead with your next question. Do you want an example of how to do that?
Yes, please, if you could just show me how to add one option, I should be able to add the rest. It all works when I copy-paste manually into the CLI.
@platonium OK, here's how I would modify the batch.rb
script to always use Nvidia HEVC for video and Dolby Digital Plus for surround audio:
#!/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
options = ['--nvenc', '--hevc', '--eac3'] + ARGV
break unless system('other-transcode', *options, input)
end
Do you see which lines I changed there?
I see the last two lines were changed so I have modified the last two lines in the batch file also.
options = ['--x265', '--hevc', '--add-audio eng', '--add-audio zho', '--add-audio kor', '--add-audio jpn', '--add-subtitle eng', '--add-subtitle zho', '--crop auto'] + ARGV
break unless system('other-transcode', *options, input) end
However, I am getting this error using the script, which I don't get when I copy and paste manually to the CLI.
C:/Ruby26-x64/bin/other-transcode: invalid option: --add-audio eng
Try other-transcode --help
for more information.
@platonium You are getting that error because each argument on the command line needs to be defined in the options
array variable as a separate string. Change that line in your code to this and it should work:
options = ['--x265', '--hevc', '--add-audio', 'eng', '--add-audio', 'zho', '--add-audio', 'kor', '--add-audio', 'jpn', '--add-subtitle', 'eng', '--add-subtitle', 'zho', '--crop', 'auto'] + ARGV
Do you see what I mean?
@platonium BTW, that options
variable declaration can be much more readable if defined like this:
options = [
'--x265',
'--hevc',
'--add-audio', 'eng',
'--add-audio', 'zho',
'--add-audio', 'kor',
'--add-audio', 'jpn',
'--add-subtitle', 'eng',
'--add-subtitle', 'zho',
'--crop', 'auto'
] + ARGV
@platonium Also, I don't recommend using the x265
encoder because it will, frankly, be slower that shit to encode. Use a hardware encoder if one is available.
Thank you again, Don, for your generosity and patience. Edit: yes, it's pretty slow especially on this lower end machine, but I've got time these days. :)
@platonium No problem!
As I'm getting used to the new tool, it would be great to be able to batch again. However, I have run into 2 probably very simple issues:
Thank you so much.