The wiki mentions post recording scripts here and I thought I'd share my mods to those for others:
https://tvheadend.org/projects/tvheadend/wiki/Tvheadend_post_recording_scripts
This script can be called from the DVR Post Processing command as "/usr/share/tvheadend/scripts/postprocessing.sh %f %b %e 'command'" where command is comskip or compact. It assumes recordings are in /video/Recordings/SeriesName and compact videos go to /video/videos.
[quote]
#!/bin/sh
# variables
TSVIDEO=$1 #Full path to recording /video/Recordings/%{ShowName}/%{FileName.ext}
basename=$2 #Basename of recording FileName.ext
error=$3 #error from tvheadend recorder "OK" if no error
command=$4 #Type of Post Processing to do comskip or compact
compactbase=$(echo "$basename" | sed "s/...$//") # Remove file ext (3 char)
# exit if not ok
if [ $error != "OK" ]; then
echo " Not OK"
exit 1
fi
# Determine Length of Pathname & Filename
TS=${#TSVIDEO}
# echo $TS
# Determine Length of the Filename Only
base=${#basename}
# echo $base
# Calcualte the difference between filename and full path length
let TSPATHlen=$TS-$base
# echo $TSPATHlen
# Strip Filename down to Filepath
TSPATH="${TSVIDEO:0:$TSPATHlen}"
# Debug Outputs for testing script works
# echo " Original Full File Name "
# echo $TSVIDEO
# echo " Stripped Down Path "
# echo $TSPATH
# Check if command is comskip and then issue comskip command
if [ $command = "comskip" ]; then
/usr/bin/comskip -t -d 13 $TSVIDEO $TSPATH
exit 0
fi
# Check if command is compact and then issue proper ffmpeg command
if [ $command = "compact" ]; then
COMPACTVIDEO="/video/videos/$compactbase.mp4"
/usr/bin/ffmpeg -i $TSVIDEO -vcodec h264 -acodec mp3 -crf 30 $COMPACTVIDEO
exit 0
fi
if [ $command = "" ]; then
/usr/bin/comskip -t -d 13 $TSVIDEO $TSPATH
exit 0
fi
[/quote]