Page 1 of 1

Comskip command to process all files in folder

Posted: Wed Sep 27, 2017 12:33 pm
by triks
Hello,

I have managed to install and process ts files with Comskip using this command line:

comskip /volume1/recorded\ tv/test/tv.ts

A tv.txt file is created in the test folder and Kodi 16.3 skips the commercials well.

My issue is that I am unable to find anywhere a command to scan all files within the test folder.

As comskip is running on a Synology NAS (Linux) I am limited with the software I can install and was hoping there is a command like *.ts or *.* that would check for existing txt files and if the txt file doesn't exist it would process the *.ts file.

I am a donator and a keen user of Comskip.

thank you in advance.
Patrik

Re: Comskip command to process all files in folder

Posted: Wed Sep 27, 2017 2:46 pm
by erik
you have to use a command script that finds recordings, check if the comskip output files exists and if not, run comskip on the recording.
There are various for various systems but I am not aware of one special for Synology
If it can run sh or csh or something alike its not too complex to build one
I also would expect any recording program to be able to run a command when a recording finishes.
So two option:
Trigger from recording or
discover new recordings on storage

Re: Comskip command to process all files in folder

Posted: Thu Sep 28, 2017 12:06 am
by triks
Thank you Erik for your prompt and helpful reply.

Have run the below script on my Synology NAS via Scheduled Tasks / User-defined scripts and it processed a test recording (test.ts) creating a test.txt and test.edl file. Tested in Kodi v16 and the commercials were skipped correctly.

but the original question still stands, is there a command/script for comskip to process all videos in a folder which do not have *.txt or *.edl as yet...?

--------------------------------------------------------------------
#!/bin/sh

INPUTVIDEO="/volume1/video/test/test.ts"
COMSKIPPATH="/volume1/@appstore/comskip/bin/comskip"
COMSKIPINI="/volume1/video/test/comskip.ini"

FlagCommercials(){
$COMSKIPPATH --ini=$COMSKIPINI "$INPUTVIDEO"
}

FlagCommercials

--------------------------------------------------------------------


Thanks to Schumi2004 Github & Shermer321 at Kodi Forums

Synology Comskip Download
https://schumi2004.stackstorage.com/s/5 ... box6w?dir=

Synology Comskip Instructions
https://github.com/SynoCommunity/spksrc/wiki/Comskip

Re: Comskip command to process all files in folder

Posted: Wed Oct 04, 2017 7:55 pm
by triks
Hi Erik,

since my last post I have spent much time searching google for a script that:

1. Finds new recorded TV files not yet processed (720p/1080i .ts format) in \volume1\Recorded TV\
2. Processes the new files and creates txt file in \volume1\Recorded TV\

No transcoding or pvr functions are required as DVBlink does all that very well.

The current script I have successfully runs via Scheduled Tasks at 2am but only processes the file I specify - not very practical.... So close yet so far ;)

With your knowledge of comskip and scripts (standard Linux is fine) is there anything you can think of to achieve the above 2 tasks without additional software ?

thanks again
Patrik

Current working script on my Synology NAS:

Code: Select all

#!/bin/sh
INPUTVIDEO="/volume1/video/test/test.ts"
COMSKIPPATH="/volume1/@appstore/comskip/bin/comskip"
COMSKIPINI="/volume1/video/test/comskip.ini"
COMSKIPLOGS="/volume1/video/test/comskip"

FlagCommercials(){
    $COMSKIPPATH --ini=$COMSKIPINI "$INPUTVIDEO"
}

FlagCommercials

Re: Comskip command to process all files in folder

Posted: Thu Oct 05, 2017 5:29 pm
by McGuyver
I have the following script setup that starts transcoding/encoding my comskipped recordings. Hopefully it will give you some ideas.

Code: Select all

#!/bin/bash
if [[ ! -f ${HOME}/tmp/.running ]]; then
    touch ${HOME}/tmp/.running
    for s in ${HOME}/tmp/output/*mac.ts; do
        INPUT="${s}"
        OUTPUT="$(basename ${INPUT} .$(echo ${INPUT##*.})).mp4"
        BASE="$(dirname ${INPUT})/$(basename ${INPUT} .$(echo ${INPUT##*.}))"
        if [[ -f ${BASE}.vprj ]]; then continue; fi
        if [[ -f ${INPUT}.processed ]]; then continue; fi
        ${HOME}/bin/test1.sh -input ${INPUT} -output ${OUTPUT} -sync -tv >${BASE}.encode.log 2>&1
        touch ${INPUT}.processed
    done
    rm ${HOME}/tmp/.running
fi

Re: Comskip command to process all files in folder

Posted: Fri Oct 06, 2017 7:30 am
by triks
Thanks McGuyver I will look through it and see what I can use... What system are you using it on ?

Re: Comskip command to process all files in folder

Posted: Fri Oct 06, 2017 8:03 am
by McGuyver
triks wrote:Thanks McGuyver I will look through it and see what I can use... What system are you using it on ?
I'm using it on my main linux system.

Re: Comskip command to process all files in folder

Posted: Wed Nov 15, 2017 12:34 am
by triks
Still haven't been able to find code to process all files in a directory...

So far the script I have runs perfectly and processes the named file but nowhere can I find code to process an entire directory which is a pity.

Any further pointers or advice is appreciated.

Re: Comskip command to process all files in folder

Posted: Tue Jan 30, 2018 6:45 pm
by Mans
triks wrote:Still haven't been able to find code to process all files in a directory...

So far the script I have runs perfectly and processes the named file but nowhere can I find code to process an entire directory which is a pity.

Any further pointers or advice is appreciated.
Great evening Erik and to other users of Comskip via a Synology NAS,

I've been reading about this topic and about the quote as above, does anyone found out how to complete this script in order process the entire directory, incl subdirectories ?
Anyone who can point us out how to extent the script like mentioned earlier within this topic:

#!/bin/sh
INPUTVIDEO="/volume1/video/test/test.ts"
COMSKIPPATH="/volume1/@appstore/comskip/bin/comskip"
COMSKIPINI="/volume1/video/test/comskip.ini"
COMSKIPLOGS="/volume1/video/test/comskip"

FlagCommercials(){
$COMSKIPPATH --ini=$COMSKIPINI "$INPUTVIDEO"
}

FlagCommercials

Thanks to all for your input.

Mans.