[DOCKER] Handbrake GUI + Automation via CLI


Recommended Posts

  • Replies 252
  • Created
  • Last Reply

Top Posters In This Topic

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 :-(

 

Update:

 

I made a simple script that just loops every five mins called up by the go file. This is turn calls the convert script. No errors. But it seems to just take the file instantly and no idea where it goes. Doesn't convert it or copy it anywhere. It did complain about the source and destination path. Updated those in the script provided above, applied the correct permissions on said folders. Can't find any info on any log in the docker folder or in the docker. I'll have to try the shell inside the docker as mentioned in a previous post to see if I can find what it's doing with the file. At this point I might just use and alternative app on my Windows VM no monitor and convert automatically.

Link to comment

I just close the guac page personally and leave the docket running. Then just pull up guac and log in when I need it again.

Problem is that when you hit quit your exiting the program, but the docker itself is still running.  No real way to recover (as you discovered) short of restarting the container unless the author includes code to determine if the program is not running and then restart it automatically.

What is the proper method to end a session when using the webGUI? I used the "Quit" from the File menu and could not get it to open up again properly without restarting the docker.

 

Link to comment
  • 3 weeks later...

I'm having some problems with this docker.  I have a few dockers up and running, and while I'm no expert, I some idea what to do.  After I've pasted the link in to the template repositories and try to add the docker, nothing populates and i can't seem to figure out how to correct the matter.  Am I missing something?

Install Community Applications and forget about repositories altogether

 

http://lime-technology.com/forum/index.php?topic=40262.0

Link to comment

What a great docker app! I have it running smoothly. I am looking for some help with the automation side. I read through the thread and didn't see much about how to use the automation script side.

 

If there are any pointers, I'd appreciate it. I have ~480 standard DVD ISO files (each in their own folder) in a directory. I'm adding them individually, but it's time consuming.

 

Would there be a way to have the script look in each folder and if an M4V file doesn't exist, load the ISO and convert it, saving the M4V into the folder the ISO came from?

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

What a great docker app! I have it running smoothly. I am looking for some help with the automation side. I read through the thread and didn't see much about how to use the automation script side.

 

If there are any pointers, I'd appreciate it. I have ~480 standard DVD ISO files (each in their own folder) in a directory. I'm adding them individually, but it's time consuming.

 

Would there be a way to have the script look in each folder and if an M4V file doesn't exist, load the ISO and convert it, saving the M4V into the folder the ISO came from?

 

I'm looking for something very similar to this. Basically, I have my (movie) folder that I'm converting the movie content to be able to be loaded onto an iPad.

 

What I'm looking for is to basically have my movie folder (which has subfolders) watched. Anytime a *.mkv file is loaded into that movie folder or into a subfolder. I'd like for handbrake to convert it, as well as convert any older movies that have not been converted yet.

 

All my converted files are stored in one large directory with no subfolders.

 

If this is already an ability within this docker container please let me know. Automating this entire process would be stellar!

 

Link to comment
  • 4 weeks later...

First off...LOVE this docker.  Eliminated a PC that i used for handbrake and makemkv both with dockers!

 

I went through the pages of support on this thread and to be honest 98.7% of it was over my head (63% of all statistics are made up on the spot). 

 

My question:  When the files are output, i have to use MC, or krusader to modify permissions to allow others to write to them.  Its not a big deal at all, but was curious if i have done something wrong in setting up my docker that this is the case?

 

Any info is appreciated!

 

al

Link to comment

Love that there is a docker for handbrake!

 

But I've run across a problem, and I don't know if it is a bug or just operator error.

 

I have a 1TB HDD mounted using 'Unassigned Devices' plugin which is where my 'dockers' file lives. I also created a folder there to deposit media I wanted to convert with Handbrake and pointed handbrake the handbrake container's 'Movie' folder initially at my 'Encode' folder where I was depositing movies and then later I pointed it to the whole device itself.  I moved some .ts files into that 'Encode' folder and started up Handbrake GUI, but to my frustration I couldn't see the TS files I'd copied into my 'Encode' folder.  I could see the media that was living in my 'Output' folder, but nothing in the 'Encode' folder.

 

Next I copied my .TS file from the 'Encode' folder which lives on the Unassigned Device to the 'Output' folder, which is living on the UNRAID Array in a User Share.  Magically, I could now see my TS file. 

 

What am I missing?  Can I not use unassigned devices as locations?

Link to comment

Love that there is a docker for handbrake!

 

But I've run across a problem, and I don't know if it is a bug or just operator error.

 

I have a 1TB HDD mounted using 'Unassigned Devices' plugin which is where my 'dockers' file lives. I also created a folder there to deposit media I wanted to convert with Handbrake and pointed handbrake the handbrake container's 'Movie' folder initially at my 'Encode' folder where I was depositing movies and then later I pointed it to the whole device itself.  I moved some .ts files into that 'Encode' folder and started up Handbrake GUI, but to my frustration I couldn't see the TS files I'd copied into my 'Encode' folder.  I could see the media that was living in my 'Output' folder, but nothing in the 'Encode' folder.

 

Next I copied my .TS file from the 'Encode' folder which lives on the Unassigned Device to the 'Output' folder, which is living on the UNRAID Array in a User Share.  Magically, I could now see my TS file. 

 

What am I missing?  Can I not use unassigned devices as locations?

I don't know exactly what you are doing, but I do know that any docker container cannot see any drives that were mounted after the docker service was started. Not sure that applies in your case since it seems like you may be saying that you have docker.img itself on the UD.
Link to comment

Love that there is a docker for handbrake!

 

But I've run across a problem, and I don't know if it is a bug or just operator error.

 

I have a 1TB HDD mounted using 'Unassigned Devices' plugin which is where my 'dockers' file lives. I also created a folder there to deposit media I wanted to convert with Handbrake and pointed handbrake the handbrake container's 'Movie' folder initially at my 'Encode' folder where I was depositing movies and then later I pointed it to the whole device itself.  I moved some .ts files into that 'Encode' folder and started up Handbrake GUI, but to my frustration I couldn't see the TS files I'd copied into my 'Encode' folder.  I could see the media that was living in my 'Output' folder, but nothing in the 'Encode' folder.

 

Next I copied my .TS file from the 'Encode' folder which lives on the Unassigned Device to the 'Output' folder, which is living on the UNRAID Array in a User Share.  Magically, I could now see my TS file. 

 

What am I missing?  Can I not use unassigned devices as locations?

I don't know exactly what you are doing, but I do know that any docker container cannot see any drives that were mounted after the docker service was started. Not sure that applies in your case since it seems like you may be saying that you have docker.img itself on the UD.

 

Correct.

 

So my setup is as follows

 

Array:

4TB WDRed - parity

4TB WDRed - data

**4TB WDRed - data** coming soon

 

Mounted Via 'Unassigned Devices' plugin

1TB WDGreen - docker.iso lives here

 

Docker:

8080/tcp <-> *.103:8081

/Output <-> /mnt/user/unRAID_Media/

/nobody/.config/ghb <-> /mnt/disks/WD1TB/handbrake_scripts/

/Movies <-> /mnt/disks/WD1TB/

 

I add *.ts files to WD1TB or a subfolder, and they don't show up when I look for them through handbrake

 

I put them in /unRAID_Media/ and they work just fine

 

EDIT: Also, I don't have a script in the folder I created called 'handbrake_scripts' nor do I have a 'Watch' Folder.  I'm wondering if there is a problem with the way the docker or the mapping is occurring with a /mnt/disks/ as opposed to something that is either in the array or the cache.

 

My original goal was to not have the ts files copied over to the array for speed reasons until I get a cache SSD/SSD array

Link to comment

Ok -

 

So I point /Output/ and /nobody/.config/ghb to folders on the array and everything appears and works like magic.  I suspect there must be a permissions issue or a file path issue that is above my head as to why I can't use an unassigned device as a mapping to Dockers.

 

Now, I try to edit my convert.sh script, and it is a read only file, and I can't copy anything into my watch folder because it's owned by nobody and everyone only has read and read execute permissions.

 

I wanted to post here before I went off and CHMOD'ed both folders to 777.  What'd I miss?

Link to comment

You could pin the container to a single core with --cpuset and set a maximum percentage with the --cpu-shares option in the custom parameters section of the template. https://docs.docker.com/engine/reference/run/#cpu-share-constraint

How do you do this? I installed the docker application from the community and i do not see any custom parameters. Nevermind i see advanced adds extra parameters option.  Would simply putting this --cpuset-cpus="1,3"  in that spot limit it to 2 of my four?

 

Nevermind again, that did it, i only see my cpu at topping out around 50% total now so it must have worked. Might make it 1,2,3 and leave 4 open to prevent peg while maximizing everything else. I am curious if anyone else messed with this and found a sweet spot. 

Link to comment

You could pin the container to a single core with --cpuset and set a maximum percentage with the --cpu-shares option in the custom parameters section of the template. https://docs.docker.com/engine/reference/run/#cpu-share-constraint

How do you do this? I installed the docker application from the community and i do not see any custom parameters. Nevermind i see advanced adds extra parameters option.  Would simply putting this --cpuset-cpus="1,3"  in that spot limit it to 2 of my four?

Yes.

 

Link to comment
  • 1 month later...

Sparklyballs, thanks for making this docker. I have a few questions (for anyone with a good answer, doesn't have to bo Sparklyballs.)

 

1. What is the right way to do the volume mapping?

 

I uninstalled Handbrake because I wasn't sure if I was doing the volume mapping right.

 

I have a user Share called "Automation".

 

My original settings - http://i.imgur.com/Tx2u0Xq.png

Are these settings better? - http://i.imgur.com/ex4jQuB.png

 

Or is there a third and better way to do the volume mapping?

 

2. How do you get the "Watched-Folder" to automatically process files?

 

I have tried putting files into the "Watched Folder" (using my original volume mappings) but my Finder wouldn't let me upload files into that folder. I'm assuming it's a permissions problem.

 

And secondly, what do you have to do to get the "Watched Folder" to actually process those files automatically?

 

I know you're supposed to edit the script to use (I think) the HandbrakeCLI, but how do you actually activate the CLI?

 

Do you have to so manually? Or are the automatic settings in the Script you're supposed to edit?

 

-----

 

Note: Sorry if these are noob questions. I have read this entire thread from the beginning and a great deal of it went over my head. I'm trying to clarify things so I can get things working on my end. Hope this post helps other users out.

Link to comment

@Sparklyballs

 

Would it be possible for me to update the version of Handbrake inside this Docker? It currently has 10.2 and Handbrake is on version 10.5. Changes since 10.2 include:

 

- Various bug fixes for all platforms and the core engine.

- Updated x265 to 1.9 which brings bug fixes and performance improvements.

- Improvements in large AVI file handling.

 

I haven't run into any bugs so far, but I am using x265 so having the most up to date version of that encoder would be nice.

 

I'm new to Docker and hope to eventually start making my own Dockers, but at this point I'm not even sure what is/isn't possible. If it's something you'd have to update then I guess we just wait until you have the time/desire to do so. :-)

Link to comment

Sparklyballs, thanks for making this docker. I have a few questions (for anyone with a good answer, doesn't have to bo Sparklyballs.)

 

1. What is the right way to do the volume mapping?

 

I uninstalled Handbrake because I wasn't sure if I was doing the volume mapping right.

 

I have a user Share called "Automation".

 

My original settings - http://i.imgur.com/Tx2u0Xq.png

Are these settings better? - http://i.imgur.com/ex4jQuB.png

 

Or is there a third and better way to do the volume mapping?

 

2. How do you get the "Watched-Folder" to automatically process files?

 

I have tried putting files into the "Watched Folder" (using my original volume mappings) but my Finder wouldn't let me upload files into that folder. I'm assuming it's a permissions problem.

 

And secondly, what do you have to do to get the "Watched Folder" to actually process those files automatically?

 

I know you're supposed to edit the script to use (I think) the HandbrakeCLI, but how do you actually activate the CLI?

 

Do you have to so manually? Or are the automatic settings in the Script you're supposed to edit?

 

-----

 

Note: Sorry if these are noob questions. I have read this entire thread from the beginning and a great deal of it went over my head. I'm trying to clarify things so I can get things working on my end. Hope this post helps other users out.

 

Krackato did you ever get the mappings figured out? , I would like to install this container but am not sure what goes in my cache drive folder and what doesn't ?

Link to comment

@Sparklyballs

 

Would it be possible for me to update the version of Handbrake inside this Docker? It currently has 10.2 and Handbrake is on version 10.5. Changes since 10.2 include:

 

- Various bug fixes for all platforms and the core engine.

- Updated x265 to 1.9 which brings bug fixes and performance improvements.

- Improvements in large AVI file handling.

 

I haven't run into any bugs so far, but I am using x265 so having the most up to date version of that encoder would be nice.

 

I'm new to Docker and hope to eventually start making my own Dockers, but at this point I'm not even sure what is/isn't possible. If it's something you'd have to update then I guess we just wait until you have the time/desire to do so. :-)

 

I am also interested in this. Is it possible to update it ourselves?

Link to comment

Updated the other day (maybe a couple weeks ago, whever the last update happened) now cannot start the Handbrake Docker... it had previously been working fine...

 

sparklyballs/handbrake:latest

 

Here is Log error.

 

Fatal server error:

 

Server is already active for display 1

If this server is no longer running, remove /tmp/.X1-lock

and start again.

 

Openbox-Message: Failed to open the display from the DISPLAY environment variable.

Link to comment

Updated the other day (maybe a couple weeks ago, whever the last update happened) now cannot start the Handbrake Docker... it had previously been working fine...

 

sparklyballs/handbrake:latest

 

Here is Log error.

 

Fatal server error:

 

Server is already active for display 1

If this server is no longer running, remove /tmp/.X1-lock

and start again.

 

Openbox-Message: Failed to open the display from the DISPLAY environment variable.

http://lime-technology.com/forum/index.php?topic=47912.0

 

Haven't really fully tested this ^^^

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.