I want to use the job function (queue) to run the batch on Windows

Asked 2 years ago, Updated 2 years ago, 96 views

I'm trying to encode a large number of video files on my Windows 7 desktop using Handbrake.
Although the GUI version provides queue-based batch processing, encoding many videos with the same configuration takes a lot of effort even if you use.(Specifically, the voice track designation and chapter will not be taken over, and if hung, the queue will be reset, so it will be reset again.)
Therefore, I am thinking of using the CUI version of Handbrake to encode it in batches.

However, the CUI version does not have a queue implemented, so you need to start encoding manually as soon as the encoding is complete.
I thought about processing them in batches, but there are the following problems:

·There are hundreds of files, so if you try to fill in the batch file or use drag-and-drop to deal with it, you may not notice that there.
·Because only a part of the files in the folder are encoded, it is impossible to process all the files directly under the folder using for. (It is environmentally difficult to temporarily move only the files to the working folder.)
·If you start from a batch and hang in the middle of processing, you won't know how many files have been processed immediately.

So I wanted to do a job queue execution.
The expected flow is as follows:

·Describe the command to be encoded as batch 1.(Completed)
·Batch 2 for registering a file name given as an argument to a batch 1 in a queue as a job is created.
·Drag and drop files into batch 2 and add batch 1+ filename to the queue.
·Encode until the queue is empty.One Handbrake is executed at the same time, and when one file is encoded, the next file is encoded.
·You can check, add, and cancel jobs in the queue later.

However, I don't know how to achieve the most important queue, so I'm at a loss how to implement it.
How do I encode using the job queue functionality to complete on Windows and make it as easy as possible?

batch-file

2022-09-30 18:44

2 Answers

In terms of completion on Windows, why not use the Microsoft Message Queue (MSMQ) that Windows itself has as a feature?Windows 7 is a standard feature.However, since it is not normally enabled, you must enable the message queue server from the Control Panel - Programs - Enable or Disable Windows Features menu.

Because you need to queue and retrieve information via COM-based and .NET-based interfaces, programming is necessary, so it may not be easy or appropriate.


2022-09-30 18:44

Text files are also batch files and can be used as a simple queue.
It's easy to edit.

Add File Name to Text File
ex) Batch 2.bat [File Name]

echo%1>>q.txt

Obtain the file name line by line from the text file and pass it to the subroutine. ex)run.bat

for/F"usebackq tokens=*delims=, "%%i in(`typeq.txt`)docall:SUB"%%~i"
exit /b

—SUB
set FILE_NAME=% to 1
echo%FILE_NAME%>Processing .log

rem treatment
call batch 1.bat%FILE_NAME%
if errorlevel1EXIT/b1

echo%FILE_NAME%>>End of process.log
echo type null > in progress.log
goto —EOF

After that, if you make a difference around fc, you can get a list of unexecuted files

fc/C/Lq.txt Process End.log


2022-09-30 18:44

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.