Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 15th June 2019, 04:20   #1  |  Link
Blurayhd
Registered User
 
Join Date: Oct 2010
Posts: 220
How to use Queue with Handbrake?

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!!
Blurayhd is offline   Reply With Quote
Old 15th June 2019, 07:28   #2  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 3,530
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.

Code:
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 to change the encode parameters.
__________________
madVR options explained

Last edited by Asmodian; 15th June 2019 at 07:40.
Asmodian is offline   Reply With Quote
Old 15th June 2019, 19:21   #3  |  Link
Blurayhd
Registered User
 
Join Date: Oct 2010
Posts: 220
Quote:
Originally Posted by Asmodian View Post
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.

Code:
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 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

Last edited by Blurayhd; 15th June 2019 at 19:25.
Blurayhd is offline   Reply With Quote
Old 15th June 2019, 21:09   #4  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 3,530
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. 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.

Quote:
Originally Posted by Blurayhd View Post
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:


Simply select a directory when opening the source, configure the UI, and hit "Add All".
__________________
madVR options explained

Last edited by Asmodian; 15th June 2019 at 21:18.
Asmodian is offline   Reply With Quote
Old 15th June 2019, 23:37   #5  |  Link
Blurayhd
Registered User
 
Join Date: Oct 2010
Posts: 220
Quote:
Originally Posted by Asmodian View Post
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. 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:


Simply select a directory when opening the source, configure the UI, and hit "Add All".
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 is offline   Reply With Quote
Old 16th June 2019, 02:51   #6  |  Link
Blurayhd
Registered User
 
Join Date: Oct 2010
Posts: 220
I just use Mediainfo to see all information about video MKV source an I notice this

Quote:
Format profile: High@L4.1

Quote:
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

Last edited by Blurayhd; 16th June 2019 at 02:54.
Blurayhd is offline   Reply With Quote
Old 16th June 2019, 03:06   #7  |  Link
Blurayhd
Registered User
 
Join Date: Oct 2010
Posts: 220
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?
Blurayhd is offline   Reply With Quote
Old 17th June 2019, 02:44   #8  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 3,530
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.
__________________
madVR options explained
Asmodian is offline   Reply With Quote
Old 17th June 2019, 08:08   #9  |  Link
Blurayhd
Registered User
 
Join Date: Oct 2010
Posts: 220
Quote:
Originally Posted by Asmodian View Post
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?
Blurayhd is offline   Reply With Quote
Old 17th June 2019, 09:46   #10  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,459
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.
Sharc is offline   Reply With Quote
Old 17th June 2019, 10:04   #11  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,383
With --encoder-level HandBrake automatically sets the correct vbv limits (at least for x264).

Quote:
Originally Posted by Blurayhd View Post
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.
sneaker_ger is offline   Reply With Quote
Old 17th June 2019, 18:27   #12  |  Link
Blurayhd
Registered User
 
Join Date: Oct 2010
Posts: 220
Quote:
Originally Posted by sneaker_ger View Post
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 is offline   Reply With Quote
Old 17th June 2019, 18:30   #13  |  Link
Blurayhd
Registered User
 
Join Date: Oct 2010
Posts: 220
Quote:
Originally Posted by Sharc View Post
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?

Last edited by Blurayhd; 17th June 2019 at 21:21.
Blurayhd is offline   Reply With Quote
Old 17th June 2019, 18:52   #14  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 3,530
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:
__________________
madVR options explained
Asmodian is offline   Reply With Quote
Old 17th June 2019, 20:21   #15  |  Link
Blurayhd
Registered User
 
Join Date: Oct 2010
Posts: 220
Quote:
Originally Posted by Asmodian View Post
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:
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
Blurayhd is offline   Reply With Quote
Old 17th June 2019, 22:07   #16  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,459
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.
Sharc is offline   Reply With Quote
Old 17th June 2019, 22:53   #17  |  Link
Blurayhd
Registered User
 
Join Date: Oct 2010
Posts: 220
Quote:
Originally Posted by Sharc View Post
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 is offline   Reply With Quote
Old 17th June 2019, 22:57   #18  |  Link
Blurayhd
Registered User
 
Join Date: Oct 2010
Posts: 220
Quote:
Originally Posted by Sharc View Post
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

Last edited by Blurayhd; 17th June 2019 at 23:07.
Blurayhd is offline   Reply With Quote
Old 17th June 2019, 23:27   #19  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,459
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).
Sharc is offline   Reply With Quote
Old 18th June 2019, 01:22   #20  |  Link
Blurayhd
Registered User
 
Join Date: Oct 2010
Posts: 220
Quote:
Originally Posted by Sharc View Post
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 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:53.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.