Skip to content

Instantly share code, notes, and snippets.

@lifeofguenter
Last active November 11, 2018 21:14
Show Gist options
  • Select an option

  • Save lifeofguenter/d3e6d50999eac73dd60e to your computer and use it in GitHub Desktop.

Select an option

Save lifeofguenter/d3e6d50999eac73dd60e to your computer and use it in GitHub Desktop.
NZBGet Transcoders
#!/bin/bash
##############################################################################
### NZBGET POST-PROCESSING SCRIPT ###
# Simple dimple mkv to mp4 conversion (Sony Bravia compatible)
#
# Author: Günter Grodotzki <guenter@perlhipster.com>
# Version: 2014-06-17
### NZBGET POST-PROCESSING SCRIPT ###
##############################################################################
# Exit codes used by NZBGet
POSTPROCESS_SUCCESS=93
POSTPROCESS_ERROR=94
POSTPROCESS_SKIP=95
# only post process 100% ok files
if [ "$NZBPP_TOTALSTATUS" -ne "SUCCESS" ]; then
exit $POSTPROCESS_SKIP
fi
# change to working dir
cd "$NZBPP_DIRECTORY"
# get all avi files
for file in *.mkv *.MKV; do
if [[ ! -e "$file" ]]; then
continue
fi
basename=$(basename "$file")
extension="${basename##*.}"
filename="${basename%.*}"
ffmpeg -loglevel panic -i "$basename" -c:v copy -c:a libfaac -b:a 192k -ac 2 "$filename.mp4"
rm "$file"
done
exit $POSTPROCESS_SUCCESS
#!/bin/bash
##############################################################################
### NZBGET POST-PROCESSING SCRIPT ###
# Simple dimple xvid to mp4 conversion (Sony Bravia compatible)
#
# Author: Günter Grodotzki <guenter@perlhipster.com>
# Version: 2014-05-27
### NZBGET POST-PROCESSING SCRIPT ###
##############################################################################
# Exit codes used by NZBGet
POSTPROCESS_SUCCESS=93
POSTPROCESS_ERROR=94
POSTPROCESS_SKIP=95
# only post process 100% ok files
if [ "$NZBPP_PARSTATUS" -ne 2 ] && [ "$NZBPP_UNPACKSTATUS" -ne 2 ]; then
exit $POSTPROCESS_SKIP
fi
# change to working dir
cd "$NZBPP_DIRECTORY"
# get all avi files
for file in *.avi *.AVI; do
if [[ ! -e "$file" ]]; then
continue
fi
basename=$(basename "$file")
extension="${basename##*.}"
filename="${basename%.*}"
ffmpeg -loglevel panic -i "$basename" -c:v libx264 -crf 20 -pix_fmt yuv420p -profile:v high -level 4.0 -c:a libfaac -b:a 192k -ac 2 "$filename.mp4"
rm "$file"
done
exit $POSTPROCESS_SUCCESS
#!/bin/bash
##############################################################################
### NZBGET POST-PROCESSING SCRIPT ###
# Move files...
#
# Author: Günter Grodotzki <guenter@perlhipster.com>
# Version: 2014-05-27
##############################################################################
### OPTIONS ###
# The final destination dir
#FinalDestination=~/downloads/z
### NZBGET POST-PROCESSING SCRIPT ###
##############################################################################
# Exit codes used by NZBGet
POSTPROCESS_SUCCESS=93
POSTPROCESS_ERROR=94
POSTPROCESS_SKIP=95
# only post process 100% ok files
if [ "$NZBPP_PARSTATUS" -ne 2 ] && [ "$NZBPP_UNPACKSTATUS" -ne 2 ]; then
exit $POSTPROCESS_SKIP
fi
# move complete folder
mv "$NZBPP_DIRECTORY" "$NZBPO_FINALDESTINATION"
exit $POSTPROCESS_SUCCESS
@Serhioromano
Copy link

DOes not work for me. I use Sonnar and NZBGet on QNAP NAS. I added mkv2mp4 and Z script and set them both into postProcess script as global as for category in the order I'd mentioned them. What could be wrong? Do I need restart NZBGet or reload is ok?

Copy link

ghost commented Jan 23, 2017

@Serhioromano there is an error in the mkv2mp4 script

Replace:

if [ "$RAN" -ne "1"]; then

with

if [ "$RAN" -ne "1" ]; then

Note the extra white space.

I got this error:

mkv2mp4: /home/nzbget/downloads/scripts/mkv2mp4.sh: line 68: [: missing `]'

@sbcrumb
Copy link

sbcrumb commented Nov 11, 2018

I am using this to transcode audio only. How can I get it to not delete the file when it is done with the command? IE keep it a MKV

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment