docker-handbrake icon indicating copy to clipboard operation
docker-handbrake copied to clipboard

Automatic Video Converter does not work with 2-Pass Encoding

Open luizfeliperc opened this issue 3 years ago • 11 comments

When using the same preset for manual conversion and automatic conversion, 2-pass encoding does not work for files that are in the /watch folder.

Below are the container settings.

environment: - TZ=America/Sao_Paulo - AUTOMATED_CONVERSION_PRESET=mkv-1080p - AUTOMATED_CONVERSION_FORMAT=mkv - AUTOMATED_CONVERSION_NON_VIDEO_FILE_ACTION=copy - AUTOMATED_CONVERSION_OUTPUT_SUBDIR=SAME_AS_SRC - SECURE_CONNECTION=1 - VNC_PASSWORD

Manual conversions work without errors, but leaving the system to work alone it just does the conversion using pass 1.

Manual conversion, notice it below that it is respecting my choice of 2-Pass Encoding.

image

Automatic conversion, using the same configured preset and the conversion window only shows pass 1 of 1.

image

luizfeliperc avatar Oct 16 '21 21:10 luizfeliperc

Look at log/hb/conversion.log under the directory you mapped to /config. This file gives details about what happened during the automatic conversion. You may have not defined the preset correctly (it's usually using the format category/name).

jlesage avatar Oct 18 '21 12:10 jlesage

Look at log/hb/conversion.log under the directory you mapped to /config. This file gives details about what happened during the automatic conversion. You may have not defined the preset correctly (it's usually using the format category/name).

I put another test video here and I was following the logs for verification. It is using my chosen preset "mkv-1080p" correctly. Follow the logs below.

conversion.log logs_container.log preset_json.log

image

image

The preset is saved here, and defined inside the container.

As I said, in the automatic conversion it uses all the settings from my preset, like audio in EAC-3 with 320Kbps and video Bitrate in 3000 and saving in .mkv, but it seems that it doesn't use the 2-pass.

What catches my attention is precisely here, TwoPass is set to false, but in preset.json logs it is set to true.

"Video": { "Bitrate": 3000, "ColorInputFormat": 0, "ColorMatrix": 1, "ColorOutputFormat": 0, "ColorPrimaries": 1, "ColorRange": 0, "ColorTransfer": 1, "Encoder": "x264", "Level": "4.1", "Options": "", "Preset": "superfast", "Profile": "high", "QSV": { "AdapterIndex": 1, "AsyncDepth": 0, "Decode": true }, "Tune": "film", "Turbo": true, "TwoPass": false } }

luizfeliperc avatar Oct 18 '21 14:10 luizfeliperc

Do you have the full presets.json file ? Looks like mkv-1080p could be defined twice. To use the same preset as the UI, I would expect AUTOMATED_CONVERSION_PRESET to be set to My General/mkv-1080p.

jlesage avatar Oct 18 '21 15:10 jlesage

Do you have the full presets.json file ? Looks like mkv-1080p could be defined twice. To use the same preset as the UI, I would expect AUTOMATED_CONVERSION_PRESET to be set to My General/mkv-1080p.

presets.log

luizfeliperc avatar Oct 18 '21 15:10 luizfeliperc

Yes so you have the same preset defined twice. One at the "root" (with 2-pass disabled) and another one under General (with 2-pass enabled, used by the UI).

Try to set AUTOMATED_CONVERSION_PRESET to General/mkv-1080p.

jlesage avatar Oct 18 '21 15:10 jlesage

Yes so you have the same preset defined twice. One at the "root" (with 2-pass disabled) and another one under General (with 2-pass enabled, used by the UI).

Try to set AUTOMATED_CONVERSION_PRESET to General/mkv-1080p.

But why does he use the same preset with different options? I couldn't understand. The original preset is saved in the /Storage folder, and it initially did not have 2-pass active. I imported, marked and saved the same preset, but shouldn't it be the same?

luizfeliperc avatar Oct 18 '21 15:10 luizfeliperc

I changed the preset path to General/mkv-1080p and the behavior was the same

[autovideoconverter] Starting conversion of '/watch/Tae Guk Gi The Brotherhood of War (2004)/Tae Guk Gi The Brotherhood of War (2004).mkv' (f0ae4824cc878f98fcc6f4578670fb2d) using preset 'mkv-1080p'... [autovideoconverter] 1 title(s) to process. 18/10/2021 12:43:32 Got connection from client 127.0.0.1 18/10/2021 12:43:32 other clients: 18/10/2021 12:43:32 Got 'ws' WebSockets handshake 18/10/2021 12:43:32 Got protocol: binary 18/10/2021 12:43:32 - webSocketsHandshake: using binary/raw encoding 18/10/2021 12:43:32 - WebSockets client version hybi-13 18/10/2021 12:43:32 check_access: client 127.0.0.1 matches host 127.0.0.1 18/10/2021 12:43:32 Disabled X server key autorepeat. 18/10/2021 12:43:32 to force back on run: 'xset r on' (3 times) 18/10/2021 12:43:32 incr accepted_client=1 for 127.0.0.1:36996 sock=10 18/10/2021 12:43:32 Client Protocol Version 3.8 18/10/2021 12:43:32 Protocol version sent 3.8, using 3.8 Encoding /watch/Tae Guk Gi The Brotherhood of War (2004)/Tae Guk Gi The Brotherhood of War (2004).mkv: task 1 of 1, 0.02 % 18/10/2021 12:43:32 rfbProcessClientSecurityType: executing handler for type 218/10/2021 12:43:32 created xdamage object: 0x20002c 18/10/2021 12:43:32 copy_tiles: allocating first_line at size 41 Encoding /watch/Tae Guk Gi The Brotherhood of War (2004)/Tae Guk Gi The Brotherhood of War (2004).mkv: task 1 of 1, 0.06 % 18/10/2021 12:43:36 client_set_net: 127.0.0.1 0.0001 18/10/2021 12:43:36 Pixel format for client 127.0.0.1: 18/10/2021 12:43:36 32 bpp, depth 24, little endian 18/10/2021 12:43:36 true colour: max r 255 g 255 b 255, shift r 16 g 8 b 0 18/10/2021 12:43:36 no translation needed 18/10/2021 12:43:36 Enabling NewFBSize protocol extension for client 127.0.0.118/10/2021 12:43:36 Enabling full-color cursor updates for client 127.0.0.1 18/10/2021 12:43:36 Using image quality level 6 for client 127.0.0.1 18/10/2021 12:43:36 Using JPEG subsampling 0, Q79 for client 127.0.0.1 18/10/2021 12:43:36 Using compression level 9 for client 127.0.0.1 18/10/2021 12:43:36 Enabling LastRect protocol extension for client 127.0.0.1 18/10/2021 12:43:36 rfbProcessClientNormalMessage: ignoring unsupported encoding type Enc(0xFFFFFECC) 18/10/2021 12:43:36 Using tight encoding for client 127.0.0.1 Encoding /watch/Tae Guk Gi The Brotherhood of War (2004)/Tae Guk Gi The Brotherhood of War (2004).mkv: task 1 of 1, 0.09 % (30.39 fps, avg 33.74 fps, ETA 01h45m17s) 18/10/2021 12:43:38 client 1 network rate 87.2 KB/sec (5267.3 eff KB/sec) 18/10/2021 12:43:38 client 1 latency: 210.3 ms 18/10/2021 12:43:38 dt1: 0.0101, dt2: 0.8419 dt3: 0.2103 bytes: 65120 18/10/2021 12:43:38 link_rate: LR_DIALUP - 210 ms, 87 KB/s Encoding /watch/Tae Guk Gi The Brotherhood of War (2004)/Tae Guk Gi The Brotherhood of War (2004).mkv: task 1 of 1, 0.13 % (33.23 fps, avg 33.53 fps, ETA 01h45m53s) 18/10/2021 12:43:42 created selwin: 0x20002d 18/10/2021 12:43:42 called initialize_xfixes() Encoding /watch/Tae Guk Gi The Brotherhood of War (2004)/Tae Guk Gi The Brotherhood of War (2004).mkv: task 1 of 1, 0.16 % (31.64 fps, avg 33.22 fps, ETA 01h46m49s) Encoding /watch/Tae Guk Gi The Brotherhood of War (2004)/Tae Guk Gi The Brotherhood of War (2004).mkv: task 1 of 1, 0.20 % (32.55 fps, avg 33.15 fps, ETA 01h47m02s)

services: handbrake: image: jlesage/handbrake container_name: handbrake environment: - TZ=America/Sao_Paulo - AUTOMATED_CONVERSION_PRESET=General/mkv-1080p - AUTOMATED_CONVERSION_FORMAT=mkv - AUTOMATED_CONVERSION_NON_VIDEO_FILE_ACTION=copy - AUTOMATED_CONVERSION_OUTPUT_SUBDIR=SAME_AS_SRC

luizfeliperc avatar Oct 18 '21 15:10 luizfeliperc

But why does he use the same preset with different options? I couldn't understand. The original preset is saved in the /Storage folder, and it initially did not have 2-pass active. I imported, marked and saved the same preset, but shouldn't it be the same?

I don't know what happened. The preset "folder" has been added to HandBrake at some point. Maybe the imported preset was from a version without it ?

I changed the preset path to General/mkv-1080p and the behavior was the same

According to the following log, the old preset is still being used. Did you re-created the container ?

[autovideoconverter] Starting conversion of '/watch/Tae Guk Gi The Brotherhood of War (2004)/Tae Guk Gi The Brotherhood of War (2004).mkv' (f0ae4824cc878f98fcc6f4578670fb2d) using preset 'mkv-1080p'...

You can also use docker inspect handbrake to see the value of the environment variable.

jlesage avatar Oct 18 '21 16:10 jlesage

image

I have good news.

I redid the preset, already with the 2-pass active and imported and saved in the /storage folder. I did a docker-compose down, deleted the /config folder and recreated everything from scratch. After the container went up, I clicked on Presets, Import and then I clicked on Save As and chose the General category. In compose, I just left the mkv-1080p and it looks like it's using the same preset in both places.

services: handbreak: image: jlesage/handbrake container_name: handbrake environment: - TZ=America/Sao_Paulo - AUTOMATED_CONVERSION_PRESET=mkv-1080p - AUTOMATED_CONVERSION_FORMAT=mkv - AUTOMATED_CONVERSION_NON_VIDEO_FILE_ACTION=copy - AUTOMATED_CONVERSION_OUTPUT_SUBDIR=SAME_AS_SRC

My question is because it didn't obey my choice when I put it in General/mkv-1080p.

The message was that he couldn't find the preset.

Let's suppose I create a new category and name it Holtz and save this mkv-1080p.json file in it.

In the compose I would have to put it as below? AUTOMATED_CONVERSION_PRESET=Holtz/mkv-1080p

luizfeliperc avatar Oct 18 '21 17:10 luizfeliperc

Normally you don't need to play with the preset files directly, nor need to import one.

In the UI, you just need to adjust the settings you want, then click the Save New Preset button. At this point you will have the ability to set the preset category and name.

Using this method, you preset is identified by category/name in AUTOMATED_CONVERSION_PRESET.

jlesage avatar Oct 18 '21 18:10 jlesage

Nothing like us doing things with patience.

I tested the method you said and it worked, but as I already have a preset that I used in windows, I wanted to use the same in the docker.

I imported my .json file and saved it to a created category called Holtz, In compose, I set its name and path to - AUTOMATED_CONVERSION_PRESET=Holtz/mkv-2pass-eac3-3000k and saved as default. When copying something to the watch folder, I saw in the logs that he is using my preset, and in 2-pass without errors as shown in the image.

image image

Now I will wait for the completion of the encode and check with mediainfo if everything is correct.

Thank you very much!

luizfeliperc avatar Oct 18 '21 19:10 luizfeliperc