[DOCKER] Handbrake GUI + Automation via CLI


Recommended Posts

  • Replies 252
  • Created
  • Last Reply

Top Posters In This Topic

Thanks for the change.

 

As for the directory, don't sweat it.  I'll just do a symbolic link and forget about it.

+1. A lot easier than what RobJ volunteered me for

 

;D

Yeah, sorry!  But it's a good idea, although not particularly brilliant or even that new!  It could help with container management for the future.  Maybe when you have an itch to program, and nothing better to do, you might think about a deprecation process.  But yes, I guess I am creating work for others!

 

* It would allow container authors to not feel trapped by first version design limitations.  They can redesign it the way they want, using everything they have learned since the first version.

* It would help in the situation where there are multiple containers for the same application.  One or more of the authors could decide to discontinue theirs and mark it as 'Deprecated in favor of ___'.

* It would help where containers appear to be abandoned.  If let's say no one is able to contact anyone responsible for container X for a month, and it has serious shortcomings, and there is a suitable replacement, then several container authors could vote to 'Deprecate in favor of _Y_' or just 'Deprecated'.

Link to comment

Thanks for the change.

 

As for the directory, don't sweat it.  I'll just do a symbolic link and forget about it.

+1. A lot easier than what RobJ volunteered me for

 

;D

Yeah, sorry!  But it's a good idea, although not particularly brilliant or even that new!  It could help with container management for the future.  Maybe when you have an itch to program, and nothing better to do, you might think about a deprecation process.  But yes, I guess I am creating work for others!

 

* It would allow container authors to not feel trapped by first version design limitations.  They can redesign it the way they want, using everything they have learned since the first version.

* It would help in the situation where there are multiple containers for the same application.  One or more of the authors could decide to discontinue theirs and mark it as 'Deprecated in favor of ___'.

* It would help where containers appear to be abandoned.  If let's say no one is able to contact anyone responsible for container X for a month, and it has serious shortcomings, and there is a suitable replacement, then several container authors could vote to 'Deprecate in favor of _Y_'.

Actually i am beginning to run out of ideas for CA.  Not quite but getting to the end of my list.  I'm sure my wife will thank you however - she already complains about the amount of time i spend on the "store"

 

But, dockerMan already supports something like that (just not pretty)  it automatically appends :latest as a tag to the repository it pulls.  No idea how much work is involved for authors to support different versions but if a version is appended to the repository when you add the container, dockerMan will grab that version instead of latest

Link to comment

Hello Sparklyballs,

 

Thanks you for this great container

 

I'm hoping this is the right place to ask this ...

 

I'm trying to do some scripting to convert the way convert.sh works

 

(The Question)

I was curious if I can SSH into the container so that I can see what my script is actually doing?

or would recreating a similar virtual machine be easier?

 

(The Endless rambling of a sleep deprived night shift worker)

I'm trying to start compression off when a file gets dropped into the Watched-Folder, (already set up to do this)

It selects the largest file to start compressing from the Watched-Folder

Compresses it with my settings (using my old style two pass settings, can't get same size / quality from RF)

When done it moves the uncompressed file from the Watched-Folder to the /Output folder beside the compressed file

 

It then Selects the next file which is the largest from the /Movies directory and moves it to the Watched-Folder

Where it hopefully starts again from the top ... repeating until the /Movies and the /Watched-Folder are both empty

 

When I'm in Windows 7 and move a bunch of files to the /Movies folder (copies slow) then drag them into the watched folder (fast copy) it only ever seems to kick off compression on the first video.

Each first video I drop in converts, but not the rest.

 

Thanks for your time,

Bobby

 

this is the poorly mangled attempt so far

 

#!/bin/bash

########### EDITABLE VARIABLES ##########

DEST_EXT=mkv

#########################################


##### DO NOT CHANGE ANYTHING BELOW HERE ###############

SRC=/nobody/.config/ghb/Watch-Folder
DEST=/Output
HANDBRAKE_CLI=HandBrakeCLI

# wait for file system to stabilize between unRaid and container
sleep 10

IFS=$(echo -en "\n\b")

for FILE in `ls $SRC`
do
	pushd /$SRC

	# select largest file over a week old
	OUTPUT="$(find . -name "*.ts" -mtime +7 -maxdepth 1 -type f -printf "%p:%s\n" | sort -t":" -k2 -n | tail -1 | cut -f1 -d":" )"

	if [ -z "$OUTPUT" ]; then
		exit 1;
	fi

	FULLFILENAME=$(basename $OUTPUT)
	FILENAME=$(echo "$FULLFILENAME" | sed 's/\.[^\.]*$//')
	EXTENSION=$(echo "$FULLFILENAME" | sed 's/^.*\.//')

	popd

# convert video with my favorite settings for HD Content
# need to add BITRATE variable for SD versus HD (1500 for SD, 3000 for HD)		
# is there a formula that would work (height times width manipulated by X for letterboxed material)
# then again don't know autocrop settings until after starting

	$HANDBRAKE_CLI --previews 20 -v -i $SRC/$FULLFILENAME -o $DEST/$FILENAME.$DEST_EXT --subtitle 1, -e x264 -T -x b-adapt=2:rc-lookahead=30 -b 3000 -a 1 -E faac -B 160 --decomb -2 >/nobody/.config/EncodeLogs/$FILENAME.log

# move source to destination after conversion

	mv $SRC/$FULLFILENAME $DEST/$FULLFILENAME

# chown all FILENAME to nobody:users	
	chown nobody:users $DEST/$FILENAME.*

# remove symlinks of last file converted
#		find /$SRC -name "$FILENAME.$EXTENSION" -maxdepth 1 -type l -exec rm -f {} \;

# files to be converted	(Next)	
	pushd /Movies/

# select largest file over a week old
	OUTPUT="$(find . -name "*.ts" -mtime +7 -maxdepth 1 -type f -printf "%p:%s\n" | sort -t":" -k2 -n | tail -1 | cut -f1 -d":" )"

	if [ -z "$OUTPUT" ]; then
		break;
	fi

	FULLFILENAME=$(basename $OUTPUT)
	FILENAME=$(echo "$FULLFILENAME" | sed 's/\.[^\.]*$//')
	EXTENSION=$(echo "$FULLFILENAME" | sed 's/^.*\.//')

	popd

# move in next largest video
# drop in a symbolic link to trigger next conversion ?

	mv /Movies/$output /$SRC

	chown nobody:users /$SRC/$output

done

 

 

 

 

 

 

 

 

Link to comment

...

(The Question)

I was curious if I can SSH into the container so that I can see what my script is actually doing?

or would recreating a similar virtual machine be easier?

...

docker exec -it container-name bash

will give you a bash session inside a container.

 

Thank you trurl,

 

this will help me see what kind of a mess I tried to mix into Sparklyballs good work

Link to comment
  • 2 weeks later...
  • 2 weeks later...

...

(The Question)

I was curious if I can SSH into the container so that I can see what my script is actually doing?

or would recreating a similar virtual machine be easier?

...

docker exec -it container-name bash

will give you a bash session inside a container.

 

Thank you trurl,

 

this will help me see what kind of a mess I tried to mix into Sparklyballs good work

 

perfessor101 , I like your script ideas (moving file in and out watch folder, so you can monitor the process of Handbrake, cool).

can you share your script when it work ? I have a lot of files to encore to .mkv container, hope your script will help me convert quicker. Thanks

Thanks

Link to comment

...

(The Question)

I was curious if I can SSH into the container so that I can see what my script is actually doing?

or would recreating a similar virtual machine be easier?

...

docker exec -it container-name bash

will give you a bash session inside a container.

 

trurl , I install HB docker, It is seem working correct in GUI. But when I copy couple files to location Watch folder , video file doesn't convert by HB , even I manually start and stop Icon HB from docker tab, seem script file convert.sh not kick in . Do I need to run script convert.sh from terminal console ? I'm not Linux guy, pls gentle me.

Thanks

 

Link to comment
  • 1 month later...

Sparklyballs,  first thank you for all your work.  The dockers really make unraid awesome.  I've been using your handbrake docker for sometime without issue.  I see this question was brought up before and you responded that libdvdcss was not included in the HB docker.  Are you interested in pursuing this?  If not can you assist me?

 

I've had HB working with libdvdcss before and it makes the backup process a lot simpler but lost this by switching to Unraid from a standalone server.

 

Any help is greatly appreciated.

 

Thanks

 

Link to comment
  • 3 weeks later...

Here is my modified script, it runs as a cron every 1 min.  It looks in the watch folder for files and then removes it from the watch folder after being transcoded.  It also checks to make sure only 1 instance of the script is running.

 

#!/bin/bash

# check if we are the only local instance
if [[ "`pidof -x $(basename $0) -o %PPID`" ]]; then
echo "This script is already running with PID `pidof -x $(basename $0) -o %PPID`"
exit
fi

########### EDITABLE VARIABLES ##########

DEST_EXT=mp4
PRESET=Roku

#########################################



##### DO NOT CHANGE ANYTHING BELOW HERE ###############

SRC=/Watch
DEST=/Output
HANDBRAKE_CLI=HandBrakeCLI



IFS=$(echo -en "\n\b")
for FILE in `ls $SRC`
do
        filename=$(basename $FILE)
        extension=${filename##*.}
        filename=${filename%.*}

        $HANDBRAKE_CLI -i $SRC/$FILE -o $DEST/$filename.$DEST_EXT --preset $PRESET

chown nobody:users $DEST/$filename.$DEST_EXT
rm -rf $SRC/$FILE
done

Link to comment

I think what I am talking about is a bit different.  Instead of using MakeMKV to backup a disc, you can integrate the libdvdcss dll into handbrake.  this way when you open HB, select source, /dev/sr0/ it can decrypt the disc and encode all in one step.  right now I have 2 steps, 1. MakeMKV to "extract and decode", 2. HB to re-encode and compress.  I really wish SparklyBalls would respond.  If he doesn't want to do it that's fine, but some guidance so I can do a tutorial would be helpful.

 

Thanks

Link to comment

I am loosing track here.

 

I have the mappings set up like this:

 

/Output ? /mnt/cache/videos/AVI/

/nobody/.config/ghb ? /mnt/cache/

/Movies ? /mnt/user/videos/AVI/

 

However I cant locate the converted files.

I expected them to find in  /mnt/cache/videos/AVI/

 

But they don't show up there.

 

Handbrake ends the conversion normally without errors.

 

Is there something wrong with my setup? Or are the files written to the docker. img this way?

 

 

 

Link to comment

There are two folders inside the Handbrake Container, Output and Movies.

  • The Output folder is directed to  /mnt/cache/videos/AVI/ (on your cache drive)
  • The Movies folder is directed to  /mnt/user/videos/AVI/ (on your array)

If you want both the Output and Movies folder directed to same location you need to change the mappings.

Edit: I looked a bit more into this and your mappings are actually correct (but a bit confusing). For clarity I would use /mnt/cache/videos/AVI/ for both Output and Movies.

 

Also make sure that the share videos is set to Use cache disk: Only in Share Settings. Otherwise the Mover could move your files to the array.

 

The default settings for the Destination is set to nobody as default so you need to change that to the Output folder. Click the down arrow and select Other and browse for the Output folder.

 

Tested your config and input and output files are in same folder.

Source.png.efa06f1c2c85a554bbdddd1b620bc9bf.png

Destination.png.637010dd7290964d5202ac8fe89d3c84.png

Link to comment

I am loosing track here.

 

I have the mappings set up like this:

 

/Output ? /mnt/cache/videos/AVI/

/nobody/.config/ghb ? /mnt/cache/

/Movies ? /mnt/user/videos/AVI/

 

However I cant locate the converted files.

I expected them to find in  /mnt/cache/videos/AVI/

 

But they don't show up there.

 

Handbrake ends the conversion normally without errors.

 

Is there something wrong with my setup? Or are the files written to the docker. img this way?

Not related to your problem, but I thought I'd mention it anyway. You should not map any config to only /mnt/cache as you have done in the second mapping.

You risk overwriting something if you have two dockers config pointing to /mnt/cache.

Link to comment

Here is my modified script, it runs as a cron every 1 min.  It looks in the watch folder for files and then removes it from the watch folder after being transcoded.  It also checks to make sure only 1 instance of the script is running.

 

#!/bin/bash

# check if we are the only local instance
if [[ "`pidof -x $(basename $0) -o %PPID`" ]]; then
echo "This script is already running with PID `pidof -x $(basename $0) -o %PPID`"
exit
fi

########### EDITABLE VARIABLES ##########

DEST_EXT=mp4
PRESET=Roku

#########################################



##### DO NOT CHANGE ANYTHING BELOW HERE ###############

SRC=/Watch
DEST=/Output
HANDBRAKE_CLI=HandBrakeCLI



IFS=$(echo -en "\n\b")
for FILE in `ls $SRC`
do
        filename=$(basename $FILE)
        extension=${filename##*.}
        filename=${filename%.*}

        $HANDBRAKE_CLI -i $SRC/$FILE -o $DEST/$filename.$DEST_EXT --preset $PRESET

chown nobody:users $DEST/$filename.$DEST_EXT
rm -rf $SRC/$FILE
done

 

Having the same problem as another on top. How to I get this to run. I modified the sample script provided by the docker but unsure how to get it to kick off. So i need to add something to my go line? like make another sh that loops and calls the handbrake script?

 

End goal here. Plug my microsd reader with card from my quad copter into my box, have unassigned devices auto mount and copy video files to watch folder, have watch folder be converted to output folder that Plex scans for my quad videos. I have the unassigned devices part working. just need them to auto convert now :-(

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.