Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Support] Djoss - HandBrake

Featured Replies

14 hours ago, Djoss said:
On ‎3‎/‎12‎/‎2019 at 4:36 PM, chris_netsmart said:

I also like to know how I can monitor the progress of a converting file which I have place in the watch folder, as when I go to handbrake and click on queue or activity, it is not clear on want file it is doing.

You can see the progress in the container's log.  On the Docker page, click the icon in the last column.

 

are we talking about the Activity Icon ?

 

Quote

Ok, so what you would like to do exactly? You don't want to re-encode all downloaded files?

yes some of the files that I am download are MKV files which when Handbrake try's to convert are failing, and I would like to excluded them, also any NFO, Jpegs, Gifs, Txt, Thumbnails etc.   only files like AVI, Mp4,

  • Replies 1.4k
  • Views 294.2k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • Try the latest version, which have Quick Sync support. See https://github.com/jlesage/docker-handbrake#intel-quick-sync-video for more details on how to use it.

  • Ok I found the issue.  A new image with the fix is on its way.

  • @nuhll, try the latest update, the issue should be fixed.

Posted Images

  • Author
9 hours ago, chris_netsmart said:

are we talking about the Activity Icon ?

On the Docker page, where all the containers are listed, there is a column "Log".  It contains an icon you can click.

9 hours ago, chris_netsmart said:

yes some of the files that I am download are MKV files which when Handbrake try's to convert are failing, and I would like to excluded them, also any NFO, Jpegs, Gifs, Txt, Thumbnails etc.   only files like AVI, Mp4,

You could try to use a pre-conversion hook (https://github.com/jlesage/docker-handbrake#hooks) to either remove an unwanted file or to move it directly to the output folder.

 

13 hours ago, Djoss said:

 

You could try to use a pre-conversion hook (https://github.com/jlesage/docker-handbrake#hooks) to either remove an unwanted file or to move it directly to the output folder.

 

thanks for the advice, I have looked at the pre_conversion.sh.example file and I can't make head or tails of it, I have also tried to find examples or tutorial on it, but I can't.

 

can you please point me to a good source of information on how to use the hooks.

Since hooks are all the rage at the moment, I’ll throw my question into the ring as well! :)

At the end of each conversion I want to check if the watch folder is empty and if it is, shut down the container.
I know I can do the first bit with a post processing hook, but is it possible to stop the container from the container shell? If it is, what’s the command?



Sent from my iPhone using Tapatalk

40 minutes ago, Jorgen said:

Since hooks are all the rage at the moment, I’ll throw my question into the ring as well! :)

At the end of each conversion I want to check if the watch folder is empty and if it is, shut down the container.
I know I can do the first bit with a post processing hook, but is it possible to stop the container from the container shell? If it is, what’s the command?



Sent from my iPhone using Tapatalk

Might be of use?

https://github.com/phusion/baseimage-docker/issues/451

  • Author
6 hours ago, chris_netsmart said:

thanks for the advice, I have looked at the pre_conversion.sh.example file and I can't make head or tails of it, I have also tried to find examples or tutorial on it, but I can't.

 

can you please point me to a good source of information on how to use the hooks.

Hooks are simple shell scripts that are executed by the automatic video converter.  To enable the hook, you just need to add a shell script at the right location.  First copy the example hook:

cp /mnt/usr/appdate/HandBrake/hooks/pre_conversion.sh.example /mnt/usr/appdate/HandBrake/hooks/pre_conversion.sh

Then you can edit /mnt/user/appdata/HandBrake/hooks/pre_conversion.sh and do what ever you want.  Here is an example of what I think you try to achieve:

#!/bin/sh
#
# This is an example of a pre-conversion hook.  This script is always invoked
# with /bin/sh (shebang ignored).
#
# The first parameter is the full path where the video will be converted.
#
# The second parameter is the full path to the source file.
#
# The third argument is the name of the HandBrake preset that will be used to
# convert the video.
#

CONVERTED_FILE="$1"
SOURCE_FILE="$2"
PRESET="$3"

echo "pre-conversion: Output File = $CONVERTED_FILE"
echo "pre-conversion: Source File = $SOURCE_FILE"
echo "pre-conversion: Preset = $PRESET"

EXTENSION="$(echo "${SOURCE_FILE##*.}" | tr '[:upper:]' '[:lower:]')"
case "$EXTENSION" in
    avi|mp4)
        # Nothing to do.  Allow conversion of known video files.
        echo "pre-conversion: allowing file conversion."
        ;;
    mkv)
        # Do not convert MKVs.  Move the file to its final destination.
        EXTENSION="$(echo "${CONVERTED_FILE##*.}" | tr '[:upper:]' '[:lower:]')"
        if [ "$EXTENSION" = "mkv" ]; then
            echo "pre-conversion: file conversion not required, moving file."
            mkdir -p "$(dirname "$CONVERTED_FILE")"
            mv "$SOURCE_FILE" "$CONVERTED_FILE"
        else
            echo "ERROR: Destination file has unexpected extension '$EXTENSION'."
        fi
        ;;
    *)
        # Remove unknown files.
        echo "pre-conversion: preventing file conversion by removing file."
        rm "$SOURCE_FILE"
esac

I hope this help.

  • Author
1 hour ago, Jorgen said:

but is it possible to stop the container from the container shell?

 

1 hour ago, cybrnook said:

 

The automatic video converter and hooks run under a non-privileged user, so killing process id 1 won't work.  However, since exiting HandBrake also terminate the container, this should work:

killall -sigterm ghb

 

 
The automatic video converter and hooks run under a non-privileged user, so killing process id 1 won't work.  However, since exiting HandBrake also terminate the container, this should work:
killall -sigterm ghb

 



Great, thanks to both of you!


Sent from my iPhone using Tapatalk
15 hours ago, Jorgen said:

At the end of each conversion I want to check if the watch folder is empty and if it is, shut down the container. 
I know I can do the first bit with a post processing hook, but is it possible to stop the container from the container shell? If it is, what’s the command?

 

13 hours ago, Djoss said:

The automatic video converter and hooks run under a non-privileged user, so killing process id 1 won't work.  However, since exiting HandBrake also terminate the container, this should work:


killall -sigterm ghb

 

 

Ok, "killall -sigterm ghb" works well, at least when running manually in the container shell.

But I've run into another problem. The post-conversion hook runs before the watch folder is cleaned up, so I can't look for an empty folder.

[autovideoconverter] Executing post-conversion hook...
post-conversion: Status = 0
post-conversion: Output File = /output/movie.mkv
post-conversion: Source File = /watch/movie.mp4
post-conversion: Preset = Mathias_MKV_720p30_v2
[autovideoconverter] Post-conversion hook exited with 0
[autovideoconverter] Conversion ended successfully.
[autovideoconverter] Removed /watch/movie.mp4

I could use the source file parameter to test if the watch folder only contains that file, but that has two problems:

1. Source files in sub folders will trip it up

2. Not sure if the watch folder purge have time to run before the container is shut down by the script

 

Hmm, might have to resort to a scheduled external script polling the watch folder.

 

 

@Community Developer  thanks for the code. I will give it a try.

@Communuity Developer  one question. I just added the code to my pre_conversion.sh file and kicked off a converestion.  was looking at the log file I saw this this error going through


/config/hooks/pre_conversion.sh: line 44: syntax error: unexpected end of file (expecting ";;")
is it something I need to be concern about. as I have had a look at the code, and with my very limited knowledge of coding this looks ok.

 

 

46 minutes ago, chris_netsmart said:

@Communuity Developer

Hey @Advanced Member, who are you calling @Community Developer?:P

1 hour ago, trurl said:

Hey @Advanced Member, who are you calling @Community Developer?:P

Djoss. 

  • Author
22 hours ago, chris_netsmart said:

@Communuity Developer  one question. I just added the code to my pre_conversion.sh file and kicked off a converestion.  was looking at the log file I saw this this error going through


/config/hooks/pre_conversion.sh: line 44: syntax error: unexpected end of file (expecting ";;")
is it something I need to be concern about. as I have had a look at the code, and with my very limited knowledge of coding this looks ok.

 

Yep, missing the last ';;'... Try this:

#!/bin/sh
#
# This is an example of a pre-conversion hook.  This script is always invoked
# with /bin/sh (shebang ignored).
#
# The first parameter is the full path where the video will be converted.
#
# The second parameter is the full path to the source file.
#
# The third argument is the name of the HandBrake preset that will be used to
# convert the video.
#

CONVERTED_FILE="$1"
SOURCE_FILE="$2"
PRESET="$3"

echo "pre-conversion: Output File = $CONVERTED_FILE"
echo "pre-conversion: Source File = $SOURCE_FILE"
echo "pre-conversion: Preset = $PRESET"

EXTENSION="$(echo "${SOURCE_FILE##*.}" | tr '[:upper:]' '[:lower:]')"
case "$EXTENSION" in
    avi|mp4)
        # Nothing to do.  Allow conversion of known video files.
        echo "pre-conversion: allowing file conversion."
        ;;
    mkv)
        # Do not convert MKVs.  Move the file to its final destination.
        EXTENSION="$(echo "${CONVERTED_FILE##*.}" | tr '[:upper:]' '[:lower:]')"
        if [ "$EXTENSION" = "mkv" ]; then
            echo "pre-conversion: file conversion not required, moving file."
            mkdir -p "$(dirname "$CONVERTED_FILE")"
            mv "$SOURCE_FILE" "$CONVERTED_FILE"
        else
            echo "ERROR: Destination file has unexpected extension '$EXTENSION'."
        fi
        ;;
    *)
        # Remove unknown files.
        echo "pre-conversion: preventing file conversion by removing file."
        rm "$SOURCE_FILE"
        ;;
esac

 

  • Author
On 3/15/2019 at 9:14 AM, Jorgen said:

 

 

Ok, "killall -sigterm ghb" works well, at least when running manually in the container shell.

But I've run into another problem. The post-conversion hook runs before the watch folder is cleaned up, so I can't look for an empty folder.


[autovideoconverter] Executing post-conversion hook...
post-conversion: Status = 0
post-conversion: Output File = /output/movie.mkv
post-conversion: Source File = /watch/movie.mp4
post-conversion: Preset = Mathias_MKV_720p30_v2
[autovideoconverter] Post-conversion hook exited with 0
[autovideoconverter] Conversion ended successfully.
[autovideoconverter] Removed /watch/movie.mp4

I could use the source file parameter to test if the watch folder only contains that file, but that has two problems:

1. Source files in sub folders will trip it up

2. Not sure if the watch folder purge have time to run before the container is shut down by the script

 

Hmm, might have to resort to a scheduled external script polling the watch folder.

 

 

Or it might be a good feature to add...

Can you add feature request at https://github.com/jlesage/docker-handbrake/issues ?

9 hours ago, Djoss said:

Or it might be a good feature to add...

Can you add feature request at https://github.com/jlesage/docker-handbrake/issues ?

Done. Let me know if/when you need help with testing. Thanks for all your work on this container, it's very very useful.

Hey @Djoss,

 

I thought I would take another look into passing an Nvidia GPU into the container and then seeing the steps to getting NVENC with command line. The container isn't even seeing the GPU. Is this because there is no official support for nvidia? I'm also getting these libnvidia-encode errors.

 

988247871_ScreenShot2019-03-17at1_10_04AM.thumb.png.15aa3c517844a16ccb87465b43c35447.png

17 hours ago, Djoss said:

Yep, missing the last ';;'... Try this:


#!/bin/sh
#
# This is an example of a pre-conversion hook.  This script is always invoked
# with /bin/sh (shebang ignored).
#
# The first parameter is the full path where the video will be converted.
#
# The second parameter is the full path to the source file.
#
# The third argument is the name of the HandBrake preset that will be used to
# convert the video.
#

CONVERTED_FILE="$1"
SOURCE_FILE="$2"
PRESET="$3"

echo "pre-conversion: Output File = $CONVERTED_FILE"
echo "pre-conversion: Source File = $SOURCE_FILE"
echo "pre-conversion: Preset = $PRESET"

EXTENSION="$(echo "${SOURCE_FILE##*.}" | tr '[:upper:]' '[:lower:]')"
case "$EXTENSION" in
    avi|mp4)
        # Nothing to do.  Allow conversion of known video files.
        echo "pre-conversion: allowing file conversion."
        ;;
    mkv)
        # Do not convert MKVs.  Move the file to its final destination.
        EXTENSION="$(echo "${CONVERTED_FILE##*.}" | tr '[:upper:]' '[:lower:]')"
        if [ "$EXTENSION" = "mkv" ]; then
            echo "pre-conversion: file conversion not required, moving file."
            mkdir -p "$(dirname "$CONVERTED_FILE")"
            mv "$SOURCE_FILE" "$CONVERTED_FILE"
        else
            echo "ERROR: Destination file has unexpected extension '$EXTENSION'."
        fi
        ;;
    *)
        # Remove unknown files.
        echo "pre-conversion: preventing file conversion by removing file."
        rm "$SOURCE_FILE"
        ;;
esac

 

thanks for the reply. but I am sad to report that I am still getting an error

 

pre-conversion: Preset = myh264
/config/hooks/pre_conversion.sh: line 43: syntax error: unexpected newline (expecting ")")
[autovideoconverter] Pre-conversion hook exited with 2

 

Hi,

 

I have been using this docker for a while now and it is perfect! Again Thanks for this.

 

Today though I am suddenly unable to write to the Handbrake output folder from my Main Rig, nothing has been changed, I have rebooted both my server and Main Rig but still no joy?  I am having to use putty to delete and move files around at the moment. 

 

I run 2 Handbrake Dockers and the output folder on the other one is still accessible.

 

the output folder is one of 5 subfolders in my Movies share on unraid, I am able to write to the other 4 with no issues

 

Any ideas?

 

image.png.f23004fec66be1459dc40f64862d98e2.png

 

image.png.f893271cee6524b8345ce9303668c2bb.png

 

 

 

Edited by mbc0

  • Author
On 3/17/2019 at 4:13 AM, FieldGenEJ said:

I thought I would take another look into passing an Nvidia GPU into the container and then seeing the steps to getting NVENC with command line. The container isn't even seeing the GPU. Is this because there is no official support for nvidia? I'm also getting these libnvidia-encode errors.

For sure, under Linux, the UI doesn't support NVENC.  It seems that the command line could support it, but this is to validate.

 

Also, as indicated by the messages you mentioned, some libraries are missing in the container... and I'm not sure if sources are available to compile them.

  • Author
On 3/17/2019 at 6:21 AM, chris_netsmart said:

thanks for the reply. but I am sad to report that I am still getting an error

 

pre-conversion: Preset = myh264
/config/hooks/pre_conversion.sh: line 43: syntax error: unexpected newline (expecting ")")
[autovideoconverter] Pre-conversion hook exited with 2

Try to copy-paste or download the script from https://gist.githubusercontent.com/jlesage/b2770b32bcfb8d1138887d86673ad8a8/raw/b82a2a089e7bd63d74d5d66cff4d8798763c3d1b/pre_conversion.sh.  It's working for me.

  • Author
1 hour ago, mbc0 said:

Hi,

 

I have been using this docker for a while now and it is perfect! Again Thanks for this.

 

Today though I am suddenly unable to write to the Handbrake output folder from my Main Rig, nothing has been changed, I have rebooted both my server and Main Rig but still no joy?  I am having to use putty to delete and move files around at the moment. 

 

I run 2 Handbrake Dockers and the output folder on the other one is still accessible.

 

the output folder is one of 5 subfolders in my Movies share on unraid, I am able to write to the other 4 with no issues

 

Any ideas?

 

image.png.f23004fec66be1459dc40f64862d98e2.png

 

image.png.f893271cee6524b8345ce9303668c2bb.png

 

 

 

Are the files/folders have the same ownership and permissions (compare between a working and non-working one)?  Verify with "ls -l".

image.png.68e774f7104c0a7ab10eb4a8710d6df1.png

  • Author
18 hours ago, mbc0 said:

image.png.68e774f7104c0a7ab10eb4a8710d6df1.png

So your "handbrakedocker" folder seems to have the correct/normal ownership/permissions.  Likely a permission issue with SMB?

Unfortunately a bit over my head to be honest, I just chmod -R 777 and now working fine... All my SMB Shares (I have a lot!) are working normally with correct access except my Handbrakedocker folder so I wouldn't know where to begin!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.