Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
IvoNet committed Dec 7, 2017
0 parents commit c4e4910
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .ignore
@@ -0,0 +1,6 @@
.idea/
*.iml
*.iws
.DS_*
_.*
target/
22 changes: 22 additions & 0 deletions README.md
@@ -0,0 +1,22 @@
# Handbrake on Synology Nas

This project is the companion code to [this](http://ivo2u.nl/dA) blog post.

It contains the code necessary to get Handbrake CLI working on your Synology NAS.

## usage

* Copy scripts in the bin folder to your synology ~/bin folder
* make sure the ~/bin folder is part of your PATH
* make sure the files are executable `chmod +x ~/bin/m4v*`
* Change the `CONVERTED_FILE_LOCATION` in `m4v.sh` to point to a location on your NAS
* Change directory to you have a `*.mkv` file to convert
* `m4v.sh "<your movie>.mkv"` wait and see it arrive in `CONVERTED_FILE_LOCATION`

Note that the first time will take longer because Docker needs to download the image
of course convertion will always take quite a bit of time so you might want to start
conversions from a `screen` (read about in on the internet) to be able to log off.

Have fun,

Ivo.
30 changes: 30 additions & 0 deletions bin/m4v.sh
@@ -0,0 +1,30 @@
#!/bin/sh
###############################################################################
# Please change the following variables to suit your needs
###############################################################################

# Place where the m4v files should be saved to...
CONVERTED_FILE_LOCATION="/volume1/video/m4v/inbox"

###############################################################################
# DO NOT CHANGE CODE BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
###############################################################################
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
mkv="$(basename $1)"
map="$(dirname $1)"
m4v="${mkv%.*}.m4v"
m4v="$(basename $m4v)"
docker run --rm \
--cpuset-cpus="1-2" \
--name handbrake \
-v "$(pwd)/$map:/input:ro" \
-v "${CONVERTED_FILE_LOCATION}:/output:rw" \
supercoder/docker-handbrake-cli:latest \
-i "/input/$mkv" \
-o "/output/$m4v" \
-e x264 -q 20.0 -r 30 --pfr -a 1 -E faac -B 160 -6 dpl2 -R Auto \
-D 0.0 --audio-copy-mask aac,ac3,dtshd,dts,mp3 --audio-fallback ffac3 \
-f mp4 -X 1280 -Y 720 --loose-anamorphic --modulus 2 -m \
--x264-preset medium --h264-profile high --h264-level 3.1
IFS=$SAVEIFS
6 changes: 6 additions & 0 deletions bin/m4vAll.sh
@@ -0,0 +1,6 @@
#!/bin/sh
find . -iname "*mkv" -print0 | while read -d $'\0' file
do
m4v.sh "$file"
test $? -gt 0 && break;
done

0 comments on commit c4e4910

Please sign in to comment.