NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Add-ons (3rd party plugins, utilities and skins) v
« Previous 1 2 3 4 5 … 20 Next »
How to get Comskip working on Linux

 
  • 0 Vote(s) - 0 Average
How to get Comskip working on Linux
wmarler
Offline

Junior Member

United States
Posts: 17
Threads: 6
Joined: Apr 2020
#1
2020-04-23, 06:45 AM
I was looking at getting this working on my machine and the wiki is sparse when it comes to Linux examples, and searching the forums left me with breadcrumbs that got me to success, but I thought I'd chronicle my experience here for anyone else who'd love this wonderful addon to npvr.

I'm running on bare metal Ubuntu 18.04. 

Building Comskip is really quick and easy on Ubuntu, so probably the same for any Debian based distro:
Code:
$ sudo apt-get update
$ sudo apt-get install ffmpeg libavcodec-dev libavformat-dev libavutil-dev autoconf automake git libargtable2-dev libtool
$ git clone git://github.com/erikkaashoek/Comskip
$ cd Comskip
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install

Note: I might be missing some dependencies. Sorry. I compiled several days before writing this post, and my system has been doing media stuff for years, it's very likely I already had necessary dependencies installed. 

Next you need a comskip.ini . It doesn't really matter where you put this file as you specifically call out its location when you use it later. It just needs to be accessible by the user running the nextpvr service. Mine is /etc/comskip.ini:
Code:
output_edl=1
live_tv=1
edl_skip_field=3
max_commercialbreak=300
verbose=10

Note: the "verbose=10" line will result in a lot going to your log file, if you use a log file. If you redirect to /dev/null, the verbosity setting doesn't matter. 

Next you need ParallelProcessing.sh. This file needs to live in /var/opt/nextpvr/scripts. A very basic one is this:
Code:
#!/bin/bash
/usr/local/bin/comskip --ini=/etc/comskip.ini "$1" > /dev/null

A slightly more useful one that keeps a log of the comskip attempt and uses 'nice' to not peg your CPU is this:
Code:
#!/bin/bash
/usr/bin/nice -n 19 /usr/local/bin/comskip --ini=/etc/comskip.ini "$1" > /var/opt/nextpvr/logs/"comskip-${5}.log"

Remember that this script is called by the user who is running the nextpvr service, and you probably don't know for sure what the PATH variable is. Make it easy on yourself and provide the full paths to the executables. You can find them by running "which nice" and "which comskip".

This file needs to be executable by the nextpvr user. Being executable by all is fine afaic:
Code:
$ chmod +x  /var/opt/nextpvr/scripts/ParallelProcessing.sh


And there you go. Restarting the nextpvr service is not necessary to bring these changes into service.

A note on usage: sub/mvallevand can correct me if I'm wrong here, but I believe ParallelProcessing.sh is only called when you specifically record a show. That means that if you tune in to a live TV channel it does not start processing the stream for commercials until you hit the 'record' button.
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,626
Threads: 767
Joined: Nov 2003
#2
2020-04-23, 07:11 AM
(2020-04-23, 06:45 AM)wmarler Wrote: A note on usage: sub/mvallevand can correct me if I'm wrong here, but I believe ParallelProcessing.sh is only called when you specifically record a show. That means that if you tune in to a live TV channel it does not start processing the stream for commercials until you hit the 'record' button.
Correct, it's only called for recordings, not live tv.
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,767
Threads: 954
Joined: May 2006
#3
2020-04-23, 12:43 PM
I did make a similar suggestion https://forums.nextpvr.com/showthread.ph...#pid533174 if you had done a forum search, so I am glad we are on the same page.

Martin
wmarler
Offline

Junior Member

United States
Posts: 17
Threads: 6
Joined: Apr 2020
#4
2020-04-23, 03:52 PM
(2020-04-23, 12:43 PM)mvallevand Wrote: I did make a similar suggestion ...

Yea I found it, it was really helpful. It had some gaps that I wanted to fill in, and it's in the subforum about Docker containers ... I didn't want to hijack it. I figure I can add to this thread as I get deeper into use cases, tweaks, etc (for example, using hardware decoding).
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,767
Threads: 954
Joined: May 2006
#5
2020-04-23, 04:20 PM
If you really want to help document NextPVR (which would be very helpful) I suggest you help out on the wiki.

Martin
wmarler
Offline

Junior Member

United States
Posts: 17
Threads: 6
Joined: Apr 2020
#6
2020-04-23, 05:21 PM
Yea, I was looking at that. How do I go about that? Do I have to fork sub's NextPVR repo, make/test/commit/push my changes to my fork, then submit a pull request to to sub?
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,767
Threads: 954
Joined: May 2006
#7
2020-04-23, 05:34 PM
It doesn't accept PR so forks are not necessary so you can download it directly and submit markdown files. I would be happy to submit the markedown files for anyone, the key is moving information forum the forum to grow the wiki.

Martin
thool
Offline

Junior Member

USA
Posts: 15
Threads: 4
Joined: Apr 2020
#8
2022-03-04, 02:49 AM
Summary: seeing codec issue.

Hi, I found this thread and a couple others, but comskip is not doing anything as far as I can tell. Looking for guidance please.

Front end: Kodi 18.9 running on RPi4 LibreELEC 9.2.8, NextPVR client version 3.3.17.1

Back end: Version: 5.2.6.220206, running on ubuntu server 20.04.3, Comskip 0.82.011
Transcoder: Preferred profile=default, avoid transcoding, video encoder=cpu, audio transcode=leave native.

Installed using the steps from the first post, had to install a few packages to make it work.

/etc/comskip.ini (group=root, user=root, mode=644):

Code:
output_edl=1
live_tv=1
edl_skip_field=3
max_commercialbreak=300
verbose=10

/var/opt/nextpvr/scripts/ParallelProcessing.sh (group=root, user=root, mode=755):
Code:
#!/bin/bash
/usr/local/bin/comskip --ini=/etc/comskip.ini "$1" > /dev/null

Once installed, I set a recording of Home Improvement which was about 4 minutes away. During recording I didn't see any indication thru Kodi that anything was going on. Same after, using TV -> Recordings, it played all the content with commercials.

I downloaded the log from the back end, and attached what looks like pertinent info:
Code:
2022-03-03 20:29:00.087    [DEBUG][8]    DefaultDirectoryChoice: first
2022-03-03 20:29:00.090    [DEBUG][8]    Preferred filename is 'Home.Improvement.S06E22.Family.Un-Ties'
2022-03-03 20:29:00.598    [DEBUG][8]    allocating recording target filename: /mnt/recordings/Home Improvement/Season 06/Home.Improvement.S06E22.Family.Un-Ties.ts
2022-03-03 20:29:00.598    [DEBUG][8]    About to start recording (1520 on 21): /mnt/recordings/Home Improvement/Season 06/Home.Improvement.S06E22.Family.Un-Ties.ts...
2022-03-03 20:29:00.599    [DEBUG][8]    (Recording is due to be stopped at 3/3/2022 9:00 PM)
2022-03-03 20:29:00.605    [DEBUG][8]    HDHomeRunRecorder.StartStream()
2022-03-03 20:29:00.605    [DEBUG][8]    ipaddress is 192.168.1.51
2022-03-03 20:29:00.605    [DEBUG][8]    building graph
2022-03-03 20:29:00.605    [DEBUG][8]    About to load channel from tuning
2022-03-03 20:29:00.609    [DEBUG][8]    source@1
2022-03-03 20:29:00.609    [DEBUG][8]    Requesting: http://192.168.1.51:5004/tuner0/v8.3
2022-03-03 20:29:00.958    [DEBUG][18]    HTTP input source starting
2022-03-03 20:29:00.983    [DEBUG][8]    Creating writer: /mnt/recordings/Home Improvement/Season 06/Home.Improvement.S06E22.Family.Un-Ties.ts
2022-03-03 20:29:00.986    [DEBUG][8]    Created Mutex: Global\NPVR-mutex-5ce0161a4df3e4f161bf46fdcd84c4af
2022-03-03 20:29:00.988    [DEBUG][8]    Created map: /mnt/recordings/Home Improvement/Season 06/Home.Improvement.S06E22.Family.Un-Ties.ts.map
2022-03-03 20:29:00.995    [DEBUG][8]    StartStream [/mnt/recordings/Home Improvement/Season 06/Home.Improvement.S06E22.Family.Un-Ties.ts] allocated handle: 1
2022-03-03 20:29:00.995    [DEBUG][8]    StartStream() returned handle=1
2022-03-03 20:29:00.995    [DEBUG][8]    Allocated Handle: 1
2022-03-03 20:29:00.995    [DEBUG][8]    Started recording (1520:1:/mnt/recordings/Home Improvement/Season 06/Home.Improvement.S06E22.Family.Un-Ties.ts)
2022-03-03 20:29:01.019    [DEBUG][8]    Starting: bash -c "'/var/opt/nextpvr/scripts/ParallelProcessing.sh' '/mnt/recordings/Home Improvement/Season 06/Home.Improvement.S06E22.Family.Un-Ties.ts' 8.3 1520 21 'Home Improvement'"
2022-03-03 20:29:01.105    [DEBUG][26]    > Comskip 0.82.011, made using ffmpeg
2022-03-03 20:29:01.105    [DEBUG][20]    > Donator build
2022-03-03 20:29:01.133    [DEBUG][20]    > /mnt/recordings/Home Improvement/Season 06/Home.Improvement.S06E22.Family.Un-Ties.ts: could not open video codec
2022-03-03 20:29:12.200    [DEBUG][26]    Got request [192.168.1.61]: /service (recording.lastupdated)
2022-03-03 20:29:12.200    [DEBUG][26]    method=recording.lastupdated
2022-03-03 20:29:12.200    [DEBUG][26]    parameters:
2022-03-03 20:29:12.200    [DEBUG][26]       method: recording.lastupdated
2022-03-03 20:29:12.200    [DEBUG][26]       sid: 7a43f8131be24ae2b8b7b481a0704736
2022-03-03 20:29:12.200    [DEBUG][26]       client_ip: 192.168.1.61
2022-03-03 20:29:12.200    [DEBUG][26]       user_agent: Kodi/18.9 (X11; Linux armv7l) LibreELEC/9.2 App_Bitness/32 Version/18.9-(18.9.0)-Git:leia_pi4_18.9-Leia
2022-03-03 20:29:12.200    [DEBUG][26]       host_callback: ...
2022-03-03 20:29:12.201    [DEBUG][26]    LastUpdated
2022-03-03 20:29:12.201    [DEBUG][26]    <?xml version="1.0" encoding="utf-8" ?>
<rsp stat="ok">
  <last_update>1646357341</last_update>
</rsp>

This line caught my eye:
Code:
2022-03-03 20:29:01.133    [DEBUG][20]    > /mnt/recordings/Home Improvement/Season 06/Home.Improvement.S06E22.Family.Un-Ties.ts: could not open video codec

In the directory the recording lives in, there is a zero length file which looks like it should be the EDL: Home.Improvement.S06E22.Family.Un-Ties.txt

The log file there says this:
Code:
[mpegts @ 0x55af35453340] PES packet size mismatch
[mpegts @ 0x55af35453340] probed stream 0 failed
[mpegts @ 0x55af35453340] probed stream 1 failed
[mpegts @ 0x55af35453340] PES packet size mismatch
[mpegts @ 0x55af35453340] Could not find codec parameters for stream 0 (Unknown: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x55af35453340] Could not find codec parameters for stream 1 (Unknown: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from '/mnt/recordings/Home Improvement/Season 06/Home.Improvement.S06E22.Family.Un-Ties.ts':
  Duration: 00:00:00.61, start: 50546.722689, bitrate: 433 kb/s
  Program 5
  No Program
    Stream #0:0[0x51]: Unknown: none
    Stream #0:1[0x54]: Unknown: none
Could not open video codec

ffmpeg installed:
ffmpeg is already the newest version (7:4.2.4-1ubuntu0.1).
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,767
Threads: 954
Joined: May 2006
#9
2022-03-04, 02:58 AM
There was a recent post were adding a sleep command helped give comskip enough buffered data to work

Martin
thool
Offline

Junior Member

USA
Posts: 15
Threads: 4
Joined: Apr 2020
#10
2022-03-04, 03:23 AM
Thank you for the very prompt reply. I'll continue looking for that, assuming the word "sleep" was used. Found this from you: https://forums.nextpvr.com/showthread.ph...#pid569396

Are you suggesting trying a sleep before comskip is called, like this in ParallelProcessing.sh?
Code:
#!/bin/bash
sleep 60
/usr/local/bin/comskip --ini=/etc/comskip.ini "$1" > /dev/null

I really don't care if comskip runs after, so would it be worth changing this file to PostProcessing.sh?

Rationale from https://www.nextpvr.com/nwiki/pmwiki.php...ty.ComSkip
Alternatively you can start Comskip when a recording ends by creating a PostProcessing.bat file in "Default Data Directory\Scripts". You may wish to do this if you transcode your recordings first, if your h.264 recordings fail to comskip in parallel, or if you lack adequate processing power to run in parallel. If you transcode, set the comskip .ini settings to support your alternative file format.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (2): 1 2 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  comskip parallel processing not updating skips in Kodi Deihmos 1 349 2025-04-13, 04:13 AM
Last Post: mvallevand
  Comskip + NextEnd VCR58 12 2,454 2023-06-30, 02:26 PM
Last Post: mvallevand
  issue for NextTool on Linux spagio 3 1,487 2022-05-14, 09:34 PM
Last Post: mvallevand
  comskip - parallel proc - Invalid frame dimensions 2leftfeet 7 2,590 2021-05-02, 01:35 AM
Last Post: EdwardWelch
  Zap2it not working knosey@hotmail.com 1 1,979 2021-04-22, 11:26 PM
Last Post: jguarrasi
  Comskip problem RTKAT 4 3,961 2018-08-26, 09:12 PM
Last Post: RTKAT
  searchlite not working is their still support fame1418 5 6,289 2017-12-18, 08:51 PM
Last Post: mvallevand
  NscriptHelper - still working? psycik 10 5,912 2017-07-10, 09:16 PM
Last Post: psycik
  Desktop Gadget not working after Win10 Creators Update Bobbybear 1 3,503 2017-06-26, 09:01 PM
Last Post: Bobins
  Comskip, NextPVR and Plex buckeyestargazer 4 7,898 2017-06-16, 07:58 PM
Last Post: scJohn

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode