[Support] Djoss - HandBrake


Recommended Posts

12 hours ago, comet424 said:

hi I new to handbrake.. just practiced the defaults and copying a file into the folder to get converted.. but if I tried a 2nd time I woul;dnt convert  like must keep a log file what its done

 

my question is  what is the settings I should set it running the webgui  you can change to 4k for video  or 264 265  10bit 12 bit etc

as I was gonna convert my entire  video collection  I have made from ym dvds  different formats

but I figured I convert everything so they all the same

 

is there a best option   like fps  and all that   so I can convert my avis  etc

as I don't know whats the best settings to set  so it can just run and convert the whole collection 

There is no best option, this forum is for the Docker for Handbrake and any issues/help with the application and settings. And whilst I appreciate you are looking for the settings for Handbrake you are looking in the wrong place. But, I have stated there are no best options. There are some recommendations, but for Anime/Cartoons the recomendation differs to Action films to Dramas as percentage frame changes differ.

 

My recomendation: Go look through Handbrake specific forums for guidance on the best options for you, save them as a config and then use this docker to automate using that config.

 

Good luck.

Link to comment
27 minutes ago, comet424 said:

I thought there was 1 setting that is the best

There may be. For you. What is best for playing on a HD projection screen 7.1 home theatre is not even close to what would be best for someone who only ever watches on their smartphone with headphones on.

 

Huge range of options, depending on the the target playback device. If you have multiple playback device types, there probably isn't one setting that isn't a compromise.

 

You will have to research and make decisions based on your specific needs, and there are entire forums dedicated to optimizing your library. This isn't one of those forums.

Link to comment

oh ok .. here I thought handbrake it converts it to the best quality  you can get... and then Plex is where it downgrades it to different devices.. but figure the handbrake  just converted to the best quality you can ever get to BlueRay orginal format.  and then Plex would downgrade it to a phone  or tablet  etc..

 

shows how much I know about this stuff I just use the makemkv  too   from my blurays 

 

sorry about that just learning as  I go 🙂

 

Link to comment
1 minute ago, comet424 said:

here I thought handbrake it converts it to the best quality  you can get... and then Plex is where it downgrades it to different devices

If you want the best quality possible, don't convert it, store the raw rips. Unless you are using only lossless compression with no modification of encoding or format, every conversion loses quality.

 

The point of conversion is typically to either modify the encoding or format to achieve the smallest possible file size with acceptable quality. What those settings are is highly personalized.

Link to comment

oh ok  so the VOBS  would I just rename the biggest VOB  that be the movie  and rename is ay  from  …vob  to  die hard.vob and will plex play it then

as I thought I had to convert it..  and what is a better format  like mp4 mkv  avi.. I was going to convert my older avis and home videos to  a better format.. as I remember avi  you cant add tags..

is there a best file format?  like mvk mp4 avi  

but ya I can do that just rip my dvds blurays to my array

Link to comment
3 minutes ago, comet424 said:

oh ok  so the VOBS  would I just rename the biggest VOB  that be the movie  and rename is ay  from  …vob  to  die hard.vob and will plex play it then

as I thought I had to convert it..  and what is a better format  like mp4 mkv  avi.. I was going to convert my older avis and home videos to  a better format.. as I remember avi  you cant add tags..

is there a best file format?  like mvk mp4 avi  

but ya I can do that just rip my dvds blurays to my array

I would use MakeMKV to convert it.

Link to comment

oh ok  so  is MKV the best then  as another friend he converts to mp4

too many formats lol  

but ok sounds good... I just been recently  just ripping my dvds blurays to unraid.. just been doing my own documents and my sisters documents photos home video backup.. best thing since my Windows Home Server 2003.. worked great too  just damn updates  least unraid doesn't get virus's  or bugs that crypial it like windows

wish I had this program years ago    

Link to comment
1 minute ago, comet424 said:

oh ok  so  is MKV the best then  as another friend he converts to mp4

too many formats lol  

but ok sounds good... I just been recently  just ripping my dvds blurays to unraid.. just been doing my own documents and my sisters documents photos home video backup.. best thing since my Windows Home Server 2003.. worked great too  just damn updates  least unraid doesn't get virus's  or bugs that crypial it like windows

wish I had this program years ago    

Basically MakeMKV takes the raw video from a DVD or Blu-ray and puts it into an MKV container. It also lets you choose the audio and subtitle tracks you wish to include.

Link to comment
On 3/2/2020 at 4:01 AM, OFark said:

You specify a variable (AUTOMATED_CONVERSION_OUTPUT_DIR) as the output folder name i.e. /output and then the path (/output) as whereever you want to store the vidoes on your shares.

I did set it in that section but its not putting it there.   Weird. I'll keep trying

Link to comment

I'm trying to set up a pipeline where movies are encoded at more than one resolution for streaming via Plex. My idea was to simply move the input to the next watch directory when finished, along with doing a rename of the output file to include something like "1080", "480", etc so the files could b dropping in the same Plex directory and let it handle the selection. For Handbrake, I figured I'd just setup multiple watch and output directories, each watch directory having it's own preset.

It kind of works. But I'm getting a slight surprise in that the output directory isn't what I seem to think it is. Here's part of the output of my post-conversion hook:

[autovideoconverter] Executing post-conversion hook...
post-conversion: Status = 0
post-conversion: Output File = /output/2/t1/Gag Reel-deleted.mkv
post-conversion: Source File = /watch2/t1/Gag Reel-deleted.mkv
post-conversion: Preset = Custom H.265 MKV 480p
conversion was successful
moving to 480


APP_NAME=HandBrake
APP_NICE_CMD=
APP_USER=app
AUTOMATED_CONVERSION_CHECK_INTERVAL=5
AUTOMATED_CONVERSION_FORMAT=mkv
AUTOMATED_CONVERSION_KEEP_SOURCE=1
AUTOMATED_CONVERSION_MAX_WATCH_FOLDERS=5
AUTOMATED_CONVERSION_NON_VIDEO_FILE_ACTION=ignore
AUTOMATED_CONVERSION_NON_VIDEO_FILE_EXTENSIONS=jpg jpeg bmp png gif txt nfo
AUTOMATED_CONVERSION_NO_GUI_PROGRESS=0
AUTOMATED_CONVERSION_OUTPUT_DIR=/output
AUTOMATED_CONVERSION_OUTPUT_DIR_2=/output-0480
AUTOMATED_CONVERSION_OUTPUT_SUBDIR=SAME_AS_SRC
AUTOMATED_CONVERSION_PRESET=Custom H.265 MKV 1080p
AUTOMATED_CONVERSION_PRESET_2=Custom H.265 MKV 480p
AUTOMATED_CONVERSION_SOURCE_MIN_DURATION=10
AUTOMATED_CONVERSION_SOURCE_STABLE_TIME=5

and here's my hook

 

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

echo "post-conversion: Status = $CONVERSION_STATUS"
echo "post-conversion: Output File = $CONVERTED_FILE"
echo "post-conversion: Source File = $SOURCE_FILE"
echo "post-conversion: Preset = $PRESET"

export T1080=$(echo "$PRESET" | grep -E '\b1080')
export T0720=$(echo "$PRESET" | grep -E '\b0?720')
export T0480=$(echo "$PRESET" | grep -E '\b0?480')
if [ $CONVERSION_STATUS -eq 0 ]; then
    echo "conversion was successful"
    if [ -n "$T1080" ]; then
        echo "moving to 1080"
        eval mv "\"$CONVERTED_FILE\"" "\"$(echo "$CONVERTED_FILE" | sed 's/[.]\([^.]*\)$/ - (1080).\1/')\""
    elif [ -n "$T0720" ]; then
        echo "moving to 720"
        eval mv "\"$CONVERTED_FILE\"" "\"$(echo "$CONVERTED_FILE" | sed 's/[.]\([^.]*\)$/ - (720).\1/')\""
    elif [ -n "$T0480" ]; then
        echo "moving to 480"
        eval mv "\"$CONVERTED_FILE\"" "\"$(echo "$CONVERTED_FILE" | sed 's/[.]\([^.]*\)$/ - (480).\1/')\""
    fi
    :
else
    echo "conversion failed"
    :
fi

env | sort | while read L; do echo "$L"; done

I don't understand the path of the output file. I expected that to be in the directory of AUTOMATED_CONVERSION_OUTPUT_DIR_2. That directory does exist and is mounted in the container; I added a path to the container for that. It seems I'm not really understanding something about the override variables.

Link to comment
7 minutes ago, rbroberts said:

I'm trying to set up a pipeline where movies are encoded at more than one resolution for streaming via Plex. My idea was to simply move the input to the next watch directory when finished, along with doing a rename of the output file to include something like "1080", "480", etc so the files could b dropping in the same Plex directory and let it handle the selection. For Handbrake, I figured I'd just setup multiple watch and output directories, each watch directory having it's own preset.

Ugh. And I just discovered another issue with this approach. Handbrake can't tell that it has already transcoded the file after a restart if I've renamed the output. Is there a way to defeat the attempt to reencode everything?

Link to comment

Okay, yet another issue with hooks. My pre_conversion.sh hook wants to move the input to a different watch directory if if decides it shouldn't encode it. DVD rips from MakeMKV appear to always have the string "720x480" near the top, so I've passing the file through head/strings/grep/awk to find this (or not). If it sees the line and the current encoder is not my DVD quality encoder, it moves the input to the correct watch directory.

Except I can't see any sign that pre_conversion is running. This hook should be putting something in the log, but while I see output in the log from my post_conversion.sh script, I'm not seeing anything from this.

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"

# We use a preset with the name of the max resolution, e.g., 480 for
# DVD quality, 1080 for bluray quality. We refuse run a conversion for
# something with DVD quality with a higher quality transcoder. This
# makes our life a little easier for figuring out what we have.

export T1080=$(echo "$PRESET" | grep -E '\b1080')
export T0720=$(echo "$PRESET" | grep -E '\b0?720')
export T0480=$(echo "$PRESET" | grep -E '\b0?480')

export DVD=$(head -n 50 "$SOURCE_FILE" | strings | grep '^size:.*x480')

if [ -z "$DVD" ]; then
    echo "Not a 480 video, proceed as usual for \"$SOURCE_FILE\""
else
    if [ -n "$T0480" ]; then
        # Let the conversion go as normal
        echo "Proceed as usual for \"$SOURCE_FILE\""
        :
    else
        O=$(echo "$SOURCE_FILE" | sed 's=/watch/=/watch2/=')
        echo mv "\"$SOURCE_FILE\"" "\"$O\""
        mkdir -p $(dirname "$O")
        mv "$SOURCE_FILE" "$O"
    fi
fi

env | sort | while read L; do echo "$L"; done

Edited: the original script had a syntactic error, so i thought that was the issue. But after fixing it to the above, my pre_conversion.sh script still isn't being run. I can run it manually on the handbrake console and see it works...

Edited by rbroberts
Link to comment
22 hours ago, rbroberts said:

Except I can't see any sign that pre_conversion is running. This hook should be putting something in the log, but while I see output in the log from my post_conversion.sh script, I'm not seeing anything from this.

I think I've found the reason it's not working....

/etc/services.d # find . -type f | xargs grep _conversion.sh
./autovideoconverter/run:        if [ -f /config/hooks/post_conversion.sh ]; then
./autovideoconverter/run:            /usr/bin/with-contenv sh /config/hooks/post_conversion.sh $hb_rc "$OUTPUT_FILE" "$video" "$AC_PRESET"

I'm assuming that someplace in that tree I should be finding the other hooks. That assumption might be wrong, but I don't have anything else to go on right now. Grepping for "hooks" shows the same matches...

 

I'd really, really love it if the hooks could modify the output file name. That would avoid the issue of handbrake thinking a file wasn't converted when I want to name it with some suffix-part in the name to play nice with Plex.

Link to comment
On 3/15/2020 at 10:08 PM, rbroberts said:

I don't understand the path of the output file. I expected that to be in the directory of AUTOMATED_CONVERSION_OUTPUT_DIR_2. That directory does exist and is mounted in the container; I added a path to the container for that. It seems I'm not really understanding something about the override variables.

And this bit of autovideoconverter/run doesn't look right either:

while true; do
    for DIR in /watch /watch2 /watch3 /watch4 /watch5; do
        # Set default settings.
        AC_PRESET="${AUTOMATED_CONVERSION_PRESET:-Very Fast 1080p30}"
        AC_FORMAT="${AUTOMATED_CONVERSION_FORMAT:-mp4}"
        AC_SOURCE_STABLE_TIME="${AUTOMATED_CONVERSION_SOURCE_STABLE_TIME:-5}"
        AC_SOURCE_MIN_DURATION="${AUTOMATED_CONVERSION_SOURCE_MIN_DURATION:-10}"
        AC_OUTPUT_SUBDIR="${AUTOMATED_CONVERSION_OUTPUT_SUBDIR:-UNSET}"
        AC_KEEP_SOURCE="${AUTOMATED_CONVERSION_KEEP_SOURCE:-1}"

        # Apply per-watch folder settings.
        if [ -n "${DIR#*/watch}" ]; then
            for VAR in PRESET FORMAT SOURCE_STABLE_TIME SOURCE_MIN_DURATION OUTPUT_SUBDIR KEEP_SOURCE
            do
                eval "AC_$VAR=\"\${AUTOMATED_CONVERSION_${VAR}_${DIR#*/watch}:-\$AC_$VAR}\""
            done
        fi

        # Process watch folder.
        process_watch_folder "$DIR"
    done

    sleep "${AUTOMATED_CONVERSION_CHECK_INTERVAL:-5}"
done

Note that OUTPUT_DIR is not part of the set that can be set, though that's what the documents say. It looks like the names have to be output/2, output/3, etc, but in that case, I really don't want watch -> output. I really want the default to be treated symmetrically with the others, but there doesn't seem to be any way to do that.

Link to comment

And...because I can't leave it alone, here's a modified autovideoconvert/run that runs pre_conversion.sh and honors AUTO_CONVERSION_OUTPUT_DIR eliminating that extra /2, /3, etc from the output subdirectory. I'm running this on my instance now. I'd love to see or something equivalent incorporated into your distribution.

run.new

Link to comment

And...okay, once I start tinkering, it's hard to stop 🙂

 

That run script works, which is the main thing. It's not ideal, only because of how the watch directories get mounted as separate devices. My pre_conversion.sh script runs HandBrakeCLI to find the dimensions of the video and, if it's DVD quality, it moves it straight to where I've configured a conversion for that input size/type. On the unraid server, that's nearly instantaneous since it's the same device. But on the unraid, mv become cp. It's still faster than doing the conversion. I realize that having a max size won't really take any longer, but the whole point (for me) is to have a set of conversions at different resolutions and let Plex figure out which one to stream, so I need to tack that that suffix on the name. And that's easier to manage on a per-watch-directory basis since conversion presets are tied to that, too.

 

I don't want to start whacking that run script too much, and at this point, to get all the watch directories on the same mount point would require that AUTO_CONVERSION_OUTPUT_DIR* be something other that a top-level mount point which is a much bigger change. Even what I already did may risk breaking some peoples configurations....

Link to comment
9 hours ago, rbroberts said:

And this bit of autovideoconverter/run doesn't look right either:


while true; do
    for DIR in /watch /watch2 /watch3 /watch4 /watch5; do
        # Set default settings.
        AC_PRESET="${AUTOMATED_CONVERSION_PRESET:-Very Fast 1080p30}"
        AC_FORMAT="${AUTOMATED_CONVERSION_FORMAT:-mp4}"
        AC_SOURCE_STABLE_TIME="${AUTOMATED_CONVERSION_SOURCE_STABLE_TIME:-5}"
        AC_SOURCE_MIN_DURATION="${AUTOMATED_CONVERSION_SOURCE_MIN_DURATION:-10}"
        AC_OUTPUT_SUBDIR="${AUTOMATED_CONVERSION_OUTPUT_SUBDIR:-UNSET}"
        AC_KEEP_SOURCE="${AUTOMATED_CONVERSION_KEEP_SOURCE:-1}"

        # Apply per-watch folder settings.
        if [ -n "${DIR#*/watch}" ]; then
            for VAR in PRESET FORMAT SOURCE_STABLE_TIME SOURCE_MIN_DURATION OUTPUT_SUBDIR KEEP_SOURCE
            do
                eval "AC_$VAR=\"\${AUTOMATED_CONVERSION_${VAR}_${DIR#*/watch}:-\$AC_$VAR}\""
            done
        fi

        # Process watch folder.
        process_watch_folder "$DIR"
    done

    sleep "${AUTOMATED_CONVERSION_CHECK_INTERVAL:-5}"
done

Note that OUTPUT_DIR is not part of the set that can be set, though that's what the documents say. It looks like the names have to be output/2, output/3, etc, but in that case, I really don't want watch -> output. I really want the default to be treated symmetrically with the others, but there doesn't seem to be any way to do that.

Are you running the latest version of the container?  Because the OUTPUT_DIR should be set:

 

https://github.com/jlesage/docker-handbrake/blob/master/rootfs/etc/services.d/autovideoconverter/run#L371

 

  • Like 1
Link to comment
On 3/15/2020 at 10:18 PM, rbroberts said:

Ugh. And I just discovered another issue with this approach. Handbrake can't tell that it has already transcoded the file after a restart if I've renamed the output. Is there a way to defeat the attempt to reencode everything?

Note that it's input files that are checked: the same input file won't be re-encoded more than once.  If you moved out the input file and then re-added it again, it may be re-encoded again if its characteristics changed.  If you don't want this to happen, make sure to keep file's dates the same when moving it around. 

Link to comment
On 3/15/2020 at 10:23 PM, rbroberts said:

Okay, yet another issue with hooks. My pre_conversion.sh hook wants to move the input to a different watch directory if if decides it shouldn't encode it. DVD rips from MakeMKV appear to always have the string "720x480" near the top, so I've passing the file through head/strings/grep/awk to find this (or not). If it sees the line and the current encoder is not my DVD quality encoder, it moves the input to the correct watch directory.

Except I can't see any sign that pre_conversion is running. This hook should be putting something in the log, but while I see output in the log from my post_conversion.sh script, I'm not seeing anything from this.


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"

# We use a preset with the name of the max resolution, e.g., 480 for
# DVD quality, 1080 for bluray quality. We refuse run a conversion for
# something with DVD quality with a higher quality transcoder. This
# makes our life a little easier for figuring out what we have.

export T1080=$(echo "$PRESET" | grep -E '\b1080')
export T0720=$(echo "$PRESET" | grep -E '\b0?720')
export T0480=$(echo "$PRESET" | grep -E '\b0?480')

export DVD=$(head -n 50 "$SOURCE_FILE" | strings | grep '^size:.*x480')

if [ -z "$DVD" ]; then
    echo "Not a 480 video, proceed as usual for \"$SOURCE_FILE\""
else
    if [ -n "$T0480" ]; then
        # Let the conversion go as normal
        echo "Proceed as usual for \"$SOURCE_FILE\""
        :
    else
        O=$(echo "$SOURCE_FILE" | sed 's=/watch/=/watch2/=')
        echo mv "\"$SOURCE_FILE\"" "\"$O\""
        mkdir -p $(dirname "$O")
        mv "$SOURCE_FILE" "$O"
    fi
fi

env | sort | while read L; do echo "$L"; done

Edited: the original script had a syntactic error, so i thought that was the issue. But after fixing it to the above, my pre_conversion.sh script still isn't being run. I can run it manually on the handbrake console and see it works...

Look at the container's log: you should have a message telling the pre-conversion hook being invoked.

 

Also, make sure you have the latest version of the container.

  • Like 1
Link to comment
8 hours ago, rbroberts said:

to get all the watch directories on the same mount point would require that AUTO_CONVERSION_OUTPUT_DIR* be something other that a top-level mount point

This should work.  You should be able to set AUTO_CONVERSION_OUTPUT_DIR to "/output/anotherdir" for example.

Link to comment
14 hours ago, Djoss said:

Look at the container's log: you should have a message telling the pre-conversion hook being invoked.

 

Also, make sure you have the latest version of the container.

Well, there was no message until I edited the run script. I've saved aside my copy, so I'll see if there is a newer version of the contain, though unraid doesn't seem to think so. The version-looking part on the screen is the repository which say jlesage/handbrake:v1.11.2....which, now that I'm looking at the support info, looks like it's really old.

 

So I guess the mystery of why it's not working is solved, now I have to figure out why unraid thinks I'm up-to-date.

Link to comment

Maybe I'm doing this wrong but this is my log and its definitely not pulling.   What I did was create a folder under the completed called DE (DONE ENCODING) and TBE (TO BE ENCODED)  original I know.   Anyways it seemed like it wasn't pulling it because of permissions so using the add another path I added both of them again in the hopes that it creates the correct permissions.  Well, the log below is what I got.  I just don't want it to use the completed folder as I don't feel the need to re-encode EVERYTHING but only what I move (yeah, I get it defeats the purpose but I'm weird like that)  Thoughts?  


[autovideoconverter] starting...
[autovideoconverter] Processing watch folder '/watch'...
[autovideoconverter] Skipping '/watch/FILE.mkv' (7f6a4731fab123cb02580bf4d47002c0): already processed with failure.
[autovideoconverter] Watch folder '/watch' processing terminated.
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning: Unsupported high keycode 372 for name <I372> ignored
> X11 cannot support keycodes above 255.
> This warning only shows for the first high keycode.
> Internal error: Could not resolve keysym XF86MonBrightnessCycle
> Internal error: Could not resolve keysym XF86RotationLockToggle

Link to comment
On 3/17/2020 at 12:49 AM, rbroberts said:

...and at this point, to get all the watch directories on the same mount point would require that AUTO_CONVERSION_OUTPUT_DIR* be something other that a top-level mount point which is a much bigger change. Even what I already did may risk breaking some peoples configurations....

 

On 3/17/2020 at 8:54 AM, Djoss said:

This should work.  You should be able to set AUTO_CONVERSION_OUTPUT_DIR to "/output/anotherdir" for example.

 

Well, my message was a bit confusing. I really want to get all the watch directories in the same tree. And I don't see a variable for that; those appear to be mount points at /watch2, /watch3, etc. So while I can make the output directories all part of the same tree, I can't seem to do that for the inputs, at least not that I can tell.

Link to comment

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.