jlesage / docker-handbrake

Docker container for HandBrake
MIT License
847 stars 97 forks source link

Issue with Automate Conversion Preset Docker Run Command #105

Open Lipora opened 4 years ago

Lipora commented 4 years ago

Trying to set the Environment Variable for: AUTOMATED_CONVERSION_PRESET

I've tried several options and none of the "Device Based Presets" seem to work. -e AUTOMATED_CONVERSION_PRESET="Apple 2160p60 4K HEVC Surround"

It seems to be Docker.exe related as it won't create the container indicating that 2160p60:latest is not an image but I don't see any extra spaces or anything. Am I listing the command wrong with the quotes? All the other environment variables seem to only be one word so I'm thinking I'm just using the command incorrectly based on your documentation of:

Variable Default

AUTOMATED_CONVERSION_PRESET "Very Fast 1080p30" AUTOMATED_CONVERSION_FORMAT "mp4"

jlesage commented 4 years ago

Not sure about the differences under Windows, but did you try to use single quote instead?

CaptFrankSolo commented 3 years ago

I am having the same problem. This is what i see in the container after starting a shell and inspecting the env vars via set |grep AUTO:

AUTOMATED_CONVERSION_PRESET='General/HQ 1080p30 Surround'

but the handbrake gui still always defaults to 'Fast 1080p30'. When I try other quotes the container doesn't start because the presets are malformed. So the quoting looks correct to me. What else is needed to debug and fix this issue since the container env seems to be getting set correctly?

A simpler solution (and what i'm doing instead) is just to edit the presets.json which will get created by handbrake on first run. No need to plumb anything through env vars at all.

jlesage commented 3 years ago

Can you provide the full output of the docker inspect command ?

To see the full log of the conversion, you can look at log/hb/conversion.log, under the folder you mapped to /config. We should see at the beginning why the wrong preset Is used.

CaptFrankSolo commented 3 years ago

really full docker inspect? there's a lot of identifying information in there, that I won't post to the general internet. Is the config block enough?, like what are you looking for besides the env block? (i also don't have a test box so i have to wait until the encode queue drains and i can restart some clean testing --- might mean i have to wait until my weekend again)

jlesage commented 3 years ago

There is normally no sensitive information (unless you configure password through environment variable or something like that), but yes you can provide only the config block if you prefer. I want to compare the output of the variable compared o others.

CaptFrankSolo commented 3 years ago

Sorry my day job takes security and privacy pretty seriously so I have maybe a more paranoid view about revealing IP, hostnames and directory layouts.

Actually looking more closely I think I see whats going on. The web UX is not picking up the setting configured in env, it's prepopulating from the presets.json default, but indeed the batch tasks are using the env var setting. But if we change the web UX the batch tasks picks up that change on the next transcode. I haven't tried to itemize what things in the UX will trigger re-reading the combobox into batch settings, but it looks easy to accidentally change something and not trust that batch is happening correctly. So unless you scour the conversion.log its easy to be confused.

I would say from the docker-handbrake perspective this is working correctly.

For completeness here's the excerpts

Here's the config block. "Config": { "Hostname": "cb0c1ec64f23", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "ExposedPorts": { "5800/tcp": {}, "5900/tcp": {} }, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "AUTOMATED_CONVERSION_KEEP_SOURCE=0", "AUTOMATED_CONVERSION_OUTPUT_SUBDIR=SAME_AS_SRC", "AUTOMATED_CONVERSION_PRESET=Devices/Roku 1080p30 Surround", "AUTOMATED_CONVERSION_SOURCE_STABLE_TIME=60", "KEEP_APP_RUNNING=1", "TZ=America/Los_Angeles", "APP_NICENESS=19", "AUTOMATED_CONVERSION_CHECK_INTERVAL=180", "AUTOMATED_CONVERSION_NON_VIDEO_FILE_EXTENSIONS=jpg jpeg png gif nfo xml", "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "LANG=en_US.UTF-8", "S6_BEHAVIOUR_IF_STAGE2_FAILS=3", "S6_SERVICE_DEPS=1", "USER_ID=1000", "GROUP_ID=1000", "APP_NAME=HandBrake", "APP_USER=app", "XDG_DATA_HOME=/config/xdg/data", "XDG_CONFIG_HOME=/config/xdg/config", "XDG_CACHE_HOME=/config/xdg/cache", "XDG_RUNTIME_DIR=/tmp/run/user/app", "DISPLAY=:0", "DISPLAY_WIDTH=1280", "DISPLAY_HEIGHT=768", "AUTOMATED_CONVERSION_FORMAT=mp4" ], "Cmd": [ "/init" ], "Image": "jlesage/handbrake:latest", "Volumes": { "/config": {}, "/output": {}, "/storage": {}, "/watch": {} }, "WorkingDir": "/tmp", "Entrypoint": null, "OnBuild": null, "Labels": { "org.label-schema.build-date": "2021-01-01T16:52:55Z", "org.label-schema.description": "Docker container for HandBrake", "org.label-schema.name": "handbrake", "org.label-schema.schema-version": "1.0", "org.label-schema.vcs-ref": "98d6a9c312a2535a1e94978111efc9734720755c", "org.label-schema.vcs-url": "https://github.com/jlesage/docker-handbrake.git", "org.label-schema.version": "1.23.0" } },

Here's the top of the conversion log

------- CONVERSION OUTPUT Wed Jan 13 19:01:15 PST 2021 ------- Cannot load libnvidia-encode.so.1 [19:01:15] hb_init: starting libhb thread [19:01:15] thread 7ffa04a7fb20 started ("libhb") HandBrake 1.3.3 (2021010100) - Linux x86_64 - https://handbrake.fr 4 CPUs detected Opening /watch/smallish2.ts... [19:01:15] CPU: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz [19:01:15] - Intel microarchitecture Skylake [19:01:15] - logical processor count: 4 [19:01:15] Intel Quick Sync Video support: no [19:01:15] hb_scan: path=/watch/smallish2.ts, title_index=1 udfread ERROR: ECMA 167 Volume Recognition failed disc.c:323: failed opening UDF image /watch/smallish2.ts disc.c:424: error opening file BDMV/index.bdmv disc.c:424: error opening file BDMV/BACKUP/index.bdmv bluray.c:2585: nav_get_title_list(/watch/smallish2.ts/) failed [19:01:15] bd: not a bd - trying as a stream/file instead libdvdnav: Using dvdnav version 6.0.1 libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed libdvdread: Can't open file VIDEO_TS.IFO. libdvdnav: vm: failed to read VIDEO_TS.IFO [19:01:15] dvd: not a dvd - trying as a stream/file instead [19:01:15] file is MPEG Transport Stream with 188 byte packets offset 0 bytes [19:01:15] Found the following PIDS [19:01:15] Video PIDS : [19:01:15] 0x61 type MPEG2 (0x2) (PCR) [19:01:15] Audio PIDS : [19:01:15] 0x64 type AC3 (0x81) [19:01:15] Subtitle PIDS : [19:01:15] Other PIDS : [19:01:15] stream id 0x64 (type 0x81 substream 0x0) audio 0x64

Scanning title 1 of 1, 0.00 %[19:01:15] scan: decoding previews for title 1 [19:01:15] file is MPEG Transport Stream with 188 byte packets offset 0 bytes [19:01:15] scan: audio 0x64: ac3, rate=48000Hz, bitrate=192000 English (AC3) (2.0 ch) (192 kbps)

Scanning title 1 of 1, preview 3, 30.00 % Scanning title 1 of 1, preview 8, 80.00 %[19:01:15] stream: 21 good frames, 0 errors (0%) [19:01:15] scan: 10 previews, 720x480, 29.970 fps, autocrop = 0/0/46/46, aspect 16:9, PAR 32:27 [19:01:15] libhb: scan thread found 1 valid title(s)

And for reference here's what I use in windows to configure the container with multi-line continuation and quoting in a batch file. (.bat)

docker run -d ^ --name %name% ^ --restart unless-stopped ^ --volume %HOMEDRIVE%%HOMEPATH%\Docker\transcoder\config:/config:rw ^ --volume %HOMEDRIVE%%HOMEPATH%\Docker\transcoder\storage:/storage:ro ^ --volume %HOMEDRIVE%%HOMEPATH%\Docker\transcoder\watch:/watch:rw ^ --volume %HOMEDRIVE%%HOMEPATH%\Docker\Transcoder\output:/output:rw ^ --publish 5800:5800 ^ --env APP_NICENESS=19 ^ --env AUTOMATED_CONVERSION_CHECK_INTERVAL=180 ^ --env AUTOMATED_CONVERSION_KEEP_SOURCE=0 ^ --env AUTOMATED_CONVERSION_NON_VIDEO_FILE_EXTENSIONS="jpg jpeg png gif nfo xml" ^ --env AUTOMATED_CONVERSION_OUTPUT_SUBDIR=SAME_AS_SRC ^ --env AUTOMATED_CONVERSION_PRESET="Devices/Roku 1080p30 Surround" ^ --env AUTOMATED_CONVERSION_SOURCE_STABLE_TIME=60 ^ --env KEEP_APP_RUNNING=1 ^ --env TZ=America/Los_Angeles ^ jlesage/handbrake:latest