Linux Tvheadend transcoding + comskip
Added by Latuxette Tuux almost 11 years ago
Hello every one,
I share with you my script for transcoding records from Tvheadend + searching commercial, then read it with XBMC.
For Debian user by exemple:
after have add Deb-Mutimedia repository apt source.list : see how http://www.deb-multimedia.org
apt-get update && apt-get upgrade
apt-get install deb-multimedia-keyring
apt-get update
apt-get install libargtable2-dev libavformat-dev libavcodec-dev checkinstall
apt-get install --reinstall libavcodec53 libavcodec-dev
You found comskip pour Linux here
http://forum.xbmc.org/showthread.php?tid=150084
Note: remenber to use checkinstall make install for creat a .deb of comskip
I hop it will help, norlmaly i'll keep it script update
Regards
---
Tuxa
#! /bin/bash #Write by Tuxa <tuxa galaxie.eu.org> # It script it publish on GNU GENERAL PUBLIC LICENSE #http://www.gnu.org/licenses/gpl-3.0.en.html SCRIPTNAME="tvh-transcoder.sh" DATE=`date "+%m/%d/%y %l:%M:%S %p"` DATELOG=`date +%Y%m%d%H%M%S` WORKINGDIR="/media/MEDIA/Video/Trancode" FINALDIR="/media/MEDIA/Video/Enregistrements" LOGFILE="$WORKINGDIR/logs/$DATELOG-$SCRIPTNAME.log" HANDBRAKECLIPATH=`which HandBrakeCLI` COMSKIPPATH=`which comskip` function convert_to_mkv() { if [ -f "$1" ] then echo "$(date +"%m/%d/%y %l:%M:%S %p"): Start trancoding $1" >> $LOGFILE nice -n 19 $HANDBRAKECLIPATH -i "$1" -t 1 -c 1 -o "$2.mkv" -f mkv -e x264 --x264-tune film -b 1200 -2 -a 1 -E faac -B 160 -R 0 -6 dpl2 -D 1 -C 2 && \ echo "$(date +"%m/%d/%y %l:%M:%S %p"): Finished without error" >> $LOGFILE fi } function search_commercials_from_mkv() { if [ -f "$1" ] then echo "$(date +"%m/%d/%y %l:%M:%S %p"): Searching commercials on $1" >> $LOGFILE nice -n 19 $COMSKIPPATH -q "$1" >> $LOGFILE && \ echo "$(date +"%m/%d/%y %l:%M:%S %p"): Finished without error" >> $LOGFILE fi } function search_commercials_from_ts() { if [ -f "$1" ] then echo "$(date +"%m/%d/%y %l:%M:%S %p"): Searching commercials on $1" >> $LOGFILE nice -n 19 $COMSKIPPATH -t -q "$1" >> $LOGFILE && \ echo "$(date +"%m/%d/%y %l:%M:%S %p"): Finished without error" >> $LOGFILE fi } function clean_directory() { echo "$(date +"%m/%d/%y %l:%M:%S %p"): Cleaning files of $1" >> $LOGFILE if [ -f "$2.mkv" ] then echo "$(date +"%m/%d/%y %l:%M:%S %p"): Move $2.mkv to $FINALDIR" >> $LOGFILE mv "$2.mkv" $FINALDIR fi if [ -f "$2.txt" ] then echo "$(date +"%m/%d/%y %l:%M:%S %p"): Move $2.txt to $FINALDIR" >> $LOGFILE mv "$2.txt" $FINALDIR fi if [ -f "$2.log" ] then echo "$(date +"%m/%d/%y %l:%M:%S %p"): Move $2.log to $WORKINGDIR/logs/$DATELOG-$2.log" >> $LOGFILE mv "$2.log" "$WORKINGDIR/logs/$DATELOG-$2.log" fi } echo "--------------------------------------------------------------------------------------------------------" >> $LOGFILE echo "$SCRIPTNAME started on $DATE" >> $LOGFILE echo "--------------------------------------------------------------------------------------------------------" >> $LOGFILE cd $WORKINGDIR for FILE in $WORKINGDIR/*.* do if [[ $FILE == *.ts ]]; then FILESHORT="`basename "$FILE" .ts`" convert_to_mkv "$FILE" "$FILESHORT" search_commercials_from_mkv "$FILESHORT.mkv" clean_directory "$FILE" "$FILESHORT" echo "$(date +"%m/%d/%y %l:%M:%S %p"): Delete source file $FILE" >> $LOGFILE #rm $FILE #mv "$FILE" $WORKINGDIR/Trash/ echo "--------------------------------------------------------------------------------------------------------" >> $LOGFILE fi if [[ $FILE == *.mkv ]]; then FILESHORT="`basename "$FILE" .mkv`" search_commercials_from_mkv "$FILE" clean_directory "$FILE" "$FILESHORT" echo "--------------------------------------------------------------------------------------------------------" >> $LOGFILE fi if [[ $FILE == *.avi ]]; then FILESHORT="`basename "$FILE" .avi`" convert_to_mkv "$FILE" "$FILESHORT" search_commercials_from_mkv "$FILESHORT.mkv" clean_directory "$FILE" "$FILESHORT" echo "$(date +"%m/%d/%y %l:%M:%S %p"): Delete source file $FILE" >> $LOGFILE #rm $FILE #mv $FILE $WORKINGDIR/Trash/ echo "--------------------------------------------------------------------------------------------------------" >> $LOGFILE fi done DATE=`date "+%m/%d/%y %l:%M:%S %p"` echo "$SCRIPTNAME finish at $DATE" >> $LOGFILE echo "--------------------------------------------------------------------------------------------------------" >> $LOGFILE
Replies (1)
RE: Linux Tvheadend transcoding + comskip - Added by saen acro over 9 years ago
Is your code can be connected to this
https://github.com/Helly1206/comskipper
and in near feature to be integrated in tvheadend
aka
TVH + Timeshift + FILE WRITE +comskip Analysis +
live stream split to time shift and comskip
analysed stream status to set DVR PAUSE to file write
and commercial not to be written to file