Log in

View Full Version : How to use Queue with Handbrake?


Blurayhd
15th June 2019, 04:20
Hii guys I have my MKV movies that I need to reduce the size the most possible always trying to keeping the best quality too

Iīm using Handbrake to pass it with CRF and Iīm trying some MKV movie with different CRF numbers so I can wwatch and try the quality on my tv

I so wish to know how to encode with queue so when some movie finish the encode start the next

The thing is, I have for try an MKV almost 25gb with AC3 track audio and for try the quality I need to set up on Handbrake different CRF, as example, I set up CRF 20 and I need to add to queue that, and again set up the CRF to 21 and add to queue that, and the same for different CRF, just the CRF , and star the process same movie different CRF so when all MKV get ready I can watch and try the quality

But like I sayd I need yo know how to do that? only one MKV souurce, set up different CRF for each queue

Thank you in advance!!

Asmodian
15th June 2019, 07:28
I like HandbrakeCLI, it just seems easier than the GUI once you are doing more than one file. If you paste the batch script below in a text file called "handbrake.cmd" or similar and run it in a directory of mkv files it will encode them all to placebo CRF 20 and 21 with AAC audio and burn in the first track of english subtitles. You will need to change the drives and directories, unless you also have a "Y:\encode" directory. :)

for %%a in (*.mkv) do call :HandBrakeCLISUB "%%a"
@GOTO END

:HandBrakeCLISUB
HandBrakeCLI.exe -i %1 --first-subtitle eng -o "Y:\encode\%~n1 (iPad).mp4" -e x264 -q 20 --encoder-preset placebo --encoder-tune film --encoder-level 4.1 -x colorprim=bt709:transfer=bt709:colormatrix=bt709 -a 2 -B 256 -I -O
HandBrakeCLI.exe -i %1 --first-subtitle eng -o "Y:\encode\%~n1 (iPad).mp4" -e x264 -q 21 --encoder-preset placebo --encoder-tune film --encoder-level 4.1 -x colorprim=bt709:transfer=bt709:colormatrix=bt709 -a 2 -B 256 -I -O

:END

Check the HandbrakeCLI docs (https://handbrake.fr/docs/en/latest/cli/cli-options.html) to change the encode parameters.

Blurayhd
15th June 2019, 19:21
I like HandbrakeCLI, it just seems easier than the GUI once you are doing more than one file. If you paste the batch script below in a text file called "handbrake.cmd" or similar and run it in a directory of mkv files it will encode them all to placebo CRF 20 and 21 with AAC audio and burn in the first track of english subtitles. You will need to change the drives and directories, unless you also have a "Y:\encode" directory. :)

for %%a in (*.mkv) do call :HandBrakeCLISUB "%%a"
@GOTO END

:HandBrakeCLISUB
HandBrakeCLI.exe -i %1 --first-subtitle eng -o "Y:\encode\%~n1 (iPad).mp4" -e x264 -q 20 --encoder-preset placebo --encoder-tune film --encoder-level 4.1 -x colorprim=bt709:transfer=bt709:colormatrix=bt709 -a 2 -B 256 -I -O
HandBrakeCLI.exe -i %1 --first-subtitle eng -o "Y:\encode\%~n1 (iPad).mp4" -e x264 -q 21 --encoder-preset placebo --encoder-tune film --encoder-level 4.1 -x colorprim=bt709:transfer=bt709:colormatrix=bt709 -a 2 -B 256 -I -O

:END

Check the HandbrakeCLI docs (https://handbrake.fr/docs/en/latest/cli/cli-options.html) to change the encode parameters.

Thank you Asmodian but I just come here for tell I find the way to add to queue and ad all MKVs videos and start

If I get you well youīre saying thereīs another GUI for Handbrake? where? canīt find it

And about placebo is exactly the reazon that what Iīm here too, I tried placebo the encode was almost 14 hours and when I try on my tv the image just present some errors like lags, I tried with Slower and tried again and was excellent, Iīm trying with Veryslower for see whats happens

So, how about is this? the encoder preset I mean, I did not know thereīs and option to encoder for best quality? So far I let the preset to medium and the image on 55° is excellent, so if I move the preset select to right is more quality?

What do you recommend

Eventually I tried some movies with CRF 21, 20, 19 and for really I donīt notice any difference, I tried like I said with Slower it but still canīt compare

Asmodian
15th June 2019, 21:09
I do not know of another GUI for Handbrake, that script is using the standard DOS/Windows "batch" commands to run the command line version of Handbrake (https://handbrake.fr/downloads2.php). In the Handbrake GUI you cannot configure it once for a collection of mkv files, you need to add each file to the queue individually. If you drag and drop an entire folder when opening the source you can then use the title dropdown to select each file in the directory and add it to the queue with the same settings. This is the fastest way I know to setup a batch encode in Handbrake GUI.

About CRF, simply pick the highest value that still looks good to you. I use 16-18 for normal stuff, 14 for archival, and 20-21 for my iPad but I value quality over size. I don't like x264 over about 23, and by 23 you can easily tell it has been compressed.

And about placebo is exactly the reazon that what Iīm here too, I tried placebo the encode was almost 14 hours and when I try on my tv the image just present some errors like lags, I tried with Slower and tried again and was excellent, Iīm trying with Veryslower for see whats happens

This sounds like an issue with not setting a level. As you increase the preset from medium to placebo the encoder will use more reference frames unless you also specify a level (or limit the number manually). This is why I use --encoder-level 4.1 in the script above, so my iPad can play it properly with full hardware decoding.

Placebo is not a good preset if time is a concern at all, I only use it because my normal encodes are done fast enough anyway. Use veryslow at most, but even slow is a good option. I think medium or faster is too fast unless quality is unimportant, but I have a very overclocked i9-7900X so your opinion on an appropriate quality v.s. time trade off may reasonably be faster. :)

Edit: Actually there is an "add all" command in the "add to queue" dropdown:
https://i1222.photobucket.com/albums/dd496/asmodian3/HandBrake-Add%20All%20to%20queue_zpsobtasl5t.png

Simply select a directory when opening the source, configure the UI, and hit "Add All". :o

Blurayhd
15th June 2019, 23:37
I do not know of another GUI for Handbrake, that script is using the standard DOS/Windows "batch" commands to run the command line version of Handbrake (https://handbrake.fr/downloads2.php). In the Handbrake GUI you cannot configure it once for a collection of mkv files, you need to add each file to the queue individually. If you drag and drop an entire folder when opening the source you can then use the title dropdown to select each file in the directory and add it to the queue with the same settings. This is the fastest way I know to setup a batch encode in Handbrake GUI.

About CRF, simply pick the highest value that still looks good to you. I use 16-18 for normal stuff, 14 for archival, and 20-21 for my iPad but I value quality over size. I don't like x264 over about 23, and by 23 you can easily tell it has been compressed.



This sounds like an issue with not setting a level. As you increase the preset from medium to placebo the encoder will use more reference frames unless you also specify a level (or limit the number manually). This is why I use --encoder-level 4.1 in the script above, so my iPad can play it properly with full hardware decoding.

Placebo is not a good preset if time is a concern at all, I only use it because my normal encodes are done fast enough anyway. Use veryslow at most, but even slow is a good option. I think medium or faster is too fast unless quality is unimportant, but I have a very overclocked i9-7900X so your opinion on an appropriate quality v.s. time trade off may reasonably be faster. :)

Edit: Actually there is an "add all" command in the "add to queue" dropdown:
https://i1222.photobucket.com/albums/dd496/asmodian3/HandBrake-Add%20All%20to%20queue_zpsobtasl5t.png

Simply select a directory when opening the source, configure the UI, and hit "Add All". :o

Thank you Asmodian, I need to ask, I have encode several times for try, but level encoder 4.0 just the default of Handbrake, I need to set up it to 4.1 ? please excuse my ignorance, why?

I need to tell you, the objetive of encode all my MKV is to put all movies on external hard disc an put in on USB on TV an watch the movie from thje external disc is 4.1 what I need?

And another more if you let me ask, if you have the time and just let the encode do hes job but you need the best quality that you can take but reducing the size, what is your number? and about 4.0 I have to encode with 4.1 is (the problems like lag) on placebo maybe could be for 4.0?

Thank you for your pacience with me and I hope you can answer me thank you in advance!!

Blurayhd
16th June 2019, 02:51
I just use Mediainfo to see all information about video MKV source an I notice this

Format profile: High@L4.1


Bit rate mode: Constant

Taking that information I should set up Handbrake to the same? I mean, 4.1 (not 4.0 ) and framertate select constant and not variable?

Or this 4.1 and constant I have to set up for all MKVs movies?

Or I have to see the MKV sourve for each movie and take the information for select?

I really appreciate your time and pacience I so wish if you could answer I do not sure how to continue

Blurayhd
16th June 2019, 03:06
I tried to wach with CRF 17 and Veryslow and I notice on movie lags an some like interlaced video, maybe is for the lag? the quality is amazing but every few seconds is like the movie is slow I donīt know maybe thereīs some option to select?

Asmodian
17th June 2019, 02:44
Hmm.. which TV is it again? You could try turning B frames down too, limit them to 3. I would stick with level 4.0 and limit B-frames to 3.

There is not much else the presets change that should make playback worse, only bitrate.

Blurayhd
17th June 2019, 08:08
Hmm.. which TV is it again? You could try turning B frames down too, limit them to 3. I would stick with level 4.0 and limit B-frames to 3.

There is not much else the presets change that should make playback worse, only bitrate.

Hi Asmodian and thank you again, my TV is 55° Daewoo that I donīt have any kind of trouble with any movie, I get surprise when I tried Very Slower and placebo because that

When you say B frames you mean about Nvidia? because my graphic card doesnīt take that, figures in the list like not support B frames, if not, when I can find that for turning B frames down? excuse me please is my English

And about level, I encode with 4.1 just like the source us that bad?

I really donīt get you when you say B frames, could the tell me where is that?

Thank you so much buddy so what you say?

Sharc
17th June 2019, 09:46
Depending on the source CRF 17 without buffer control could produce bitrate spikes which exceed the capability of the player, causing stutter. So I would add constraints for the buffer size and maxrate. Not sure about the syntax for Handbrake. Someone else could probably tell.
It may also help to add -bluray-compat=1.

sneaker_ger
17th June 2019, 10:04
With --encoder-level HandBrake automatically sets the correct vbv limits (at least for x264).

And about level, I encode with 4.1 just like the source us that bad?
Not "bad" per-se, just high so that some players may choke on bitrate spikes like Sharc said. Level 4.0 is sufficient (great quality, works on almost every player). If this is the cause of your "lag" problems I do not know.

Blurayhd
17th June 2019, 18:27
With --encoder-level HandBrake automatically sets the correct vbv limits (at least for x264).


Not "bad" per-se, just high so that some players may choke on bitrate spikes like Sharc said. Level 4.0 is sufficient (great quality, works on almost every player). If this is the cause of your "lag" problems I do not know.

Thanks to you both now I confused, before I tried encoded with encoder level 4.0 but I notice the source is 4.1, so I set up encoder to 4.1

Selecting 4.1 I mes up the MKV movies? please excuse me my English is not my first language, Iīm trying to undestand, that you generously try to help me

Now I donīt know how level encoded select, 4.0 or 4.1 and yesterday I just encoded four movies in 4.1 I have to encoded all again?

I donīt undestand the difference between select 4.0 and 4.1 ?

Thank you in advance!!

Blurayhd
17th June 2019, 18:30
Depending on the source CRF 17 without buffer control could produce bitrate spikes which exceed the capability of the player, causing stutter. So I would add constraints for the buffer size and maxrate. Not sure about the syntax for Handbrake. Someone else could probably tell.
It may also help to add -bluray-compat=1.

Thank you Shark for helping me if you donīt mind where is that option to change?

Asmodian
17th June 2019, 18:52
No, that will not mess anything up. It does not matter what the source was, 4.0 v.s. 4.1 is just the number of reference frames and VBV limits. 4.0 is lower than 4.1 but it is still high so it is a good choice for something to play with a TV.

B-frames are an encode setting in Handbrake, I am surprised Handbrake doesn't have a GUI control for the number of Bframes. You need to write it in manually:
https://i1222.photobucket.com/albums/dd496/asmodian3/Handbrake%20Bframes%20%203_zpswyaf6bkq.png

Blurayhd
17th June 2019, 20:21
No, that will not mess anything up. It does not matter what the source was, 4.0 v.s. 4.1 is just the number of reference frames and VBV limits. 4.0 is lower than 4.1 but it is still high so it is a good choice for something to play with a TV.

B-frames are an encode setting in Handbrake, I am surprised Handbrake doesn't have a GUI control for the number of Bframes. You need to write it in manually:
https://i1222.photobucket.com/albums/dd496/asmodian3/Handbrake%20Bframes%20%203_zpswyaf6bkq.png

that means no matter what I put there 4.0/4.1 itīs the same?

And about B frames now I see but so far I know (and thanks to people like you and the others Iīm learning, ) B frames is using Nv from Nvidia? because I so a list of graphic cards that support the B frame and that I have doesnīt support is this the same?

Or with CRF no matter I put that the B frame and very slower for try and Itīs should works?

Again thank you I hope you undestand if not, please tell me

Sharc
17th June 2019, 22:07
When your Nvidia GPU does not support B-frames it will probably throw an error when you request B-frames and select H.264 (Nvidia NVEnc) . Just try it.
You could however always select the CPU H.264 (x264) encoder instead which supports B-frames.

Blurayhd
17th June 2019, 22:53
When your Nvidia GPU does not support B-frames it will probably throw an error when you request B-frames and select H.264 (Nvidia NVEnc) . Just try it.
You could however always select the CPU H.264 (x264) encoder instead which supports B-frames.

Thank you, I just tried with x264 and add Bframes=3 veryslow and placebo and still have the "lag" error

I tried too with that you said before add -bluray-compat=1. with veryslow and placebo and still error too

I tried with add both -bluray-compat=1. and Bframes=3 and still error too

Is there some more option that yo could tell me so Iīll can try? I really donīt have any intention to you make be angry with me, you donīt have any idea how much youīre helping me

Blurayhd
17th June 2019, 22:57
When your Nvidia GPU does not support B-frames it will probably throw an error when you request B-frames and select H.264 (Nvidia NVEnc) . Just try it.
You could however always select the CPU H.264 (x264) encoder instead which supports B-frames.

If I get you well youīre saying I l select 264 with NVenc wiith trying veryslow and placebo? I notice when I change x264 to x264 NVenc the RF change to QP, I donīt know what it means?

I notice too the encoder preset is not the same by selecting NVenc, From left to right I have Hight quality on left and Default on right I donīt know what is the best?

I read in some post that some people say the x264 is much beter quality than x264 NVenc (donīt know)

Again I beg your pardon for all any trouble if you wish to continue helping me Iīll appreciate it, if you donīt I understand

Sharc
17th June 2019, 23:27
NVenc and x264 are different encoders. With x264 you have CRF (=RF in Handbrake). NVenc doesn't have CRF (Constant Rate Factor) but only QP (constant quantization parameter) which is different and cannot be compared with CRF.
I suggest you go with X264. It's slower but it's much better documented, and the quality is superior. Forget placebo. Use preset medium or slow to begin with, and experiment with various CRF (= RF in Handbrake).

Blurayhd
18th June 2019, 01:22
NVenc and x264 are different encoders. With x264 you have CRF (=RF in Handbrake). NVenc doesn't have CRF (Constant Rate Factor) but only QP (constant quantization parameter) which is different and cannot be compared with CRF.
I suggest you go with X264. It's slower but it's much better documented, and the quality is superior. Forget placebo. Use preset medium or slow to begin with, and experiment with various CRF (= RF in Handbrake).


Now Iīm getting some things clear, thank you Iīll try and tell you whats happened

Blurayhd
21st June 2019, 08:06
NVenc and x264 are different encoders. With x264 you have CRF (=RF in Handbrake). NVenc doesn't have CRF (Constant Rate Factor) but only QP (constant quantization parameter) which is different and cannot be compared with CRF.
I suggest you go with X264. It's slower but it's much better documented, and the quality is superior. Forget placebo. Use preset medium or slow to begin with, and experiment with various CRF (= RF in Handbrake).

Dear Sharc first I want to thank you for all your paciencie and guide me

I tell you I just encoded finally four MKVs in Slower with 4.1 and CRF 20, 19, 21,2, 23 )I canīt remember because the I tried to see the image quality, and I watched every MKV on my tv and finally the image was just great

Maybe in some scenes where you can see the people faces hes faces looks like not so sharp and I wish to get better that, is there any option to get more sharp the image?

And the second question, buddy is for example I have to encode Rambo movie and I really donīt know what exactly CRF number to set up and I donīt know what will be the final size, I have to make the same movie but different CRf and compare very movie? or how is it?

What do you recommend for knows without spend hours and hours for make a choice?

Thank you and I hope again what you say?

Sharc
21st June 2019, 09:11
Lower CRF give sharper pictures. Higher CRF compress more and blur more.
If you are still undecided on the CRF just use CRF 20 as a good compromise between file size (compression, which is important for you as you said before) and quality.

Blurayhd
21st June 2019, 13:44
Lower CRF give sharper pictures. Higher CRF compress more and blur more.
If you are still undecided on the CRF just use CRF 20 as a good compromise between file size (compression, which is important for you as you said before) and quality.

Thank you very much buddy!!