Jump to content

ComSkipper ... A Emby Plugin that skips commercials


Recommended Posts

BillOatman
Posted
14 minutes ago, jkdebuhr said:

Maybe paths are Case sensitive?

I have this in emby : smb://192.168.72.135/recordings/Channels/TV/ but should be smb://192.168.72.135/Recordings/Channels/TV/

However Recording shows.. I fixed the casea nd will try again

Windows is not, Mac might be.

Posted
On 4/14/2024 at 9:40 PM, BillOatman said:

Windows is not, Mac might be.

Found it and fixed it.. took a bit to get it to appear in the logs

 

THANKS

Posted
13 minutes ago, jkdebuhr said:

Found it and fixed it.. took a bit to get it to appear in the logs

 

What was the fix?

  • 2 weeks later...
Posted

I had the paths not exactly right so it couldnt access the correct folder

wjcarpenter
Posted

I've only been playing with this plugin for a few days, so I'm only part way through this enormous thread. I hope this info isn't redundant.

I run emby in a docker container and wanted to run the comskip analysis piece on the host instead of the container. That took a bit of fiddling around. I documented my glue in case it might help others.

https://hackaday.io/page/39080-comskip-for-docker-emby

  • Agree 1
wjcarpenter
Posted (edited)

@vdrover

Thanks for the pointer. I may look into that at some point. I'm rather fond of MKV.

 

Edited by wjcarpenter
  • 3 weeks later...
Posted

I just figured out why MCEBuddy hasn't been doing it's thing very well. I have a "lifetime" but "Legacy License" for which they want another $80 for a "Lifetime with upgrades for 36 months" License.

I've know this existed for a long time but have been happy with my MCEBuddy implementation so with 27 pages I'm behind a bit. Give me the short of how to install and set up this plugin!

Posted
On 12/20/2021 at 4:55 PM, Sammy said:

D'fuq?

Wow! Might give this a whirl but am pretty happy with MCEBuddy at this point.

Guess not any longer! 😂

Posted
2 hours ago, vdrover said:

@SammyIt's all in the first post.

Just went back to the first post and saw I was the second post..

  • Haha 1
  • 5 weeks later...
Posted

Hi @BillOatman

 

I have asked you before about:

Quote

also there is a bug: when the Comskipper skip the scene first time and then I rewind before the scene, it will not skip again. I should exit the movie and play it again to work.

and you have answered:

Quote

That is on purpose.  That way if comskip makes a mistake and ComSkipper skips too far as a result, you can rewind back to the correct spot and watch from there.

 

I have used this plugin to skip some inappropriate scenes for my kids. Therefore, I kindly request to add the ability in the setting to enable/disable it, or at least, is there any way to make it work in Scripter-X?

Many thanks

Posted
5 minutes ago, iBoss said:

I have used this plugin to skip some inappropriate scenes for my kids. Therefore, I kindly request to add the ability in the setting to enable/disable it, or at least, is there any way to make it work in Scripter-X

I don't think comskip works this way. It looks for logos and other indicators of scene changes like all-black images.  

  • Agree 1
BillOatman
Posted
On 6/14/2024 at 12:41 PM, iBoss said:

Hi @BillOatman

 

I have asked you before about:

and you have answered:

 

I have used this plugin to skip some inappropriate scenes for my kids. Therefore, I kindly request to add the ability in the setting to enable/disable it, or at least, is there any way to make it work in Scripter-X?

Many thanks

 

On 6/14/2024 at 12:48 PM, vdrover said:

I don't think comskip works this way. It looks for logos and other indicators of scene changes like all-black images.  

@iBoss I assume you are modifying the edl file to skip the scenes as well as the commercials, right?  I will add that option when I have time.  If you don't see it in a couple weeks, ping me again.

If you are skipping scenes due to language, have a look at this .  You might like it better.

  • Like 1
BillOatman
Posted (edited)

@iBoss  Coded it up last night but ran into a issue where with the setting as you are requesting, as soon as I did a rewind inside the commercial Emby immediately skipped to the defined commercial end which effectively made it impossible to rewind before the commercial unless you set your rewind to be a couple minutes.  I remember now, that is a reason I had it not skip more than once in the first place.  I'll look at it some more and see if I can detect a rewind was done, but it may not be possible to do what you want via a plugin.

Or I suppose accept that as a behavior if you have that option selected. Maybe that's the correct answer.

Edited by BillOatman
  • Like 2
BillOatman
Posted (edited)

I tried that too and it still really confuses Emby.  Sorry @iBossbut that's just not in the cards.  It is open source so if you or someone wants to play with it, feel free.  Or take a look at the Pottymouth plugin I referenced above.

Edited by BillOatman
  • Like 1
Posted

I am attempting to use comskip at the start of a live recording with ScripterX. It is not creating a edl file and seems to kick off, as I can see it in the embyserver.txt logs that it has started. From what I can tell it dies straight away.

If I run the command manually it runs perfectly and generates a edl file.

I am running debian bookworm.

 

Can anyone who has comskip running on a live tv stream via ScripterX and has it successfully working give me some advice please. I have been attempting to get this working now for a number of days and just can't seem to automate it.

Spaceboy
Posted
8 hours ago, SirFoxey said:

I am attempting to use comskip at the start of a live recording with ScripterX. It is not creating a edl file and seems to kick off, as I can see it in the embyserver.txt logs that it has started. From what I can tell it dies straight away.

If I run the command manually it runs perfectly and generates a edl file.

I am running debian bookworm.

 

Can anyone who has comskip running on a live tv stream via ScripterX and has it successfully working give me some advice please. I have been attempting to get this working now for a number of days and just can't seem to automate it.

i had this working but when the issues occured with ScripterX last year i switched to using MCEBuddy again as a standalone tool. i havent yet gone back to using scripterx but if i get time i will look into it. my config is in this thread quite early on

Posted

@spaceboy Are you using docker?

Posted
2 hours ago, Spaceboy said:

i had this working but when the issues occured with ScripterX last year i switched to using MCEBuddy again as a standalone tool. i havent yet gone back to using scripterx but if i get time i will look into it. my config is in this thread quite early on

MCEBuddy is unfortunately not a option for me as it is only for windows I believe and I am under linux

Posted (edited)

I am not using docker currently for anything, never really been able to get my head around docker. 

If I run this docker that docker container, will it watch my current emby setup or would I have to re-deploy emby within docker also?

As i have another linux box running something else in docker a docker container, which has access to the share all my media is on for emby which I could run what you are suggesting

Edited by SirFoxey
more info
Posted
3 hours ago, SirFoxey said:

I am not using docker currently for anything, never really been able to get my head around docker. 

If I run this docker that docker container, will it watch my current emby setup or would I have to re-deploy emby within docker also?

As i have another linux box running something else in docker a docker container, which has access to the share all my media is on for emby which I could run what you are suggesting

I actually think that you could run this container on it's own as part of the config is to map a real folder on your HDD/SSD to a virtual folder inside the container. You might find some permissions issues, but having been down the road you're on, rebuilding everything in docker could be a great way to "do things right" with all the knowledge you now have (at least that was my experience). 

Definitely recommend this walkthrough for learning docker/docker compose.

  • Like 1
Posted
On 6/17/2024 at 10:07 PM, BillOatman said:

I tried that too and it still really confuses Emby.  Sorry @iBossbut that's just not in the cards.  It is open source so if you or someone wants to play with it, feel free.  Or take a look at the Pottymouth plugin I referenced above.

Thank you for trying to help; I really appreciate your effort.

  • 1 month later...
Deihmos
Posted
On 2/16/2022 at 12:39 PM, vdrover said:

Detecting & skipping commercials on Ubuntu 

I wanted to contribute by sharing the details of setting up comskip on Ubuntu 20.04.3 LTS. Other flavors of linux will be similar I suspect. 

I'm a bit new to Emby, so this how-to is very detailed as I was learning and experimenting as i was going. I hope you find it useful!

Step 1 — Preparation

Before starting, you should have Live TV working in Emby and be able to record TV shows. You will also need to know the location of your emby server. Mine is installed in "/opt/emby-server". To check where your is installed, you can use this command from your terminal. 

$ sudo find / -type d -name "emby-server"

And since you will be testing in some steps, it will be helpful to have already recorded a show and know the full path. I will use the example file path below, but you should replace it with the real path to your file:

/mnt/Emby/TV Shows/Seinfeld (1981)/Season 8/Seinfeld S08E05.ts

Step 2 — Install comskip

In this step you will install the "donator version" comskip. I strongly recommend that you support the author my making a donation here

This step does not involve Emby in any way. The instructions were borrowed from here.

  1. From a terminal, enter the following commands.
    $ 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
  2. Verify that comskip is working by entering the command below. The basic instructions for using comskip should be displayed.
    $ comskip -h
  3. Verify the path of comskip by entering the command below. If different than shown below, be sure to substitute this path when needed in Step 5.
    $ which comskip
    /usr/local/bin/comskip

Step 3 — Create a comskip configuration file 

comskip requires the use of a configuration file to accurately detect commercials. For example, here is a basic configuration file that specifies some parameters:

detect_method=107
output_edl=1
live_tv=1
edl_skip_field=3
max_commercialbreak=300
verbose=0
output_default=0
delete_logo_file=1

These parameters are stored in a file called comskip.ini. You need to create a comskip.ini file and note the full path to this file for use in Step 5.

  1. Download the attached comskip.ini file to your downloads folder.
  2. Copy the file to your /etc folder with the following command:
    $ sudo cp ~/Downloads/comskip.ini /etc
  3. The path of your config file will be:
    /etc/comskip.ini

Step 4 — Test that comskip is working as expected

This step does not involve Emby in any way, but it is important to help troubleshoot any issues later on when we ask Emby to trigger comskip (Step 5).

We will now use the path to your recorded show from Step 1 and the path to the comskip.ini file from Step 3 to test comskip.

  1. From your terminal, enter the following command:
    $ comskip --ini=/etc/comskip.ini '/mnt/Emby/TV Shows/Seinfeld (1981)/Season 8/Seinfeld S08E05.ts'
  2. If comskip is working as expected, the output should be similar to that shown below with a slowly increasing progress indicator. Wait for this process to finish. "Commercials were found" should be the last line of the output.
    Comskip 0.82.010, made using ffmpeg
    Donator build
    The commandline used was:
    	comskip
    	--ini=/etc/comskip.ini
    	"/mnt/Emby/TV Shows/Seinfeld (1981)/Season 8/Seinfeld S08E05.ts"
    
    Setting ini file to /etc/comskip.ini as per commandline
    Using /etc/comskip.ini for initiation values.
    0:41:16 - 148470 frames in 685.90 sec(216.46 fps), 1.00 sec(248.00 fps), 99%
    148549 frames decoded in 704.88 seconds (210.74 fps)
    Commercials were found.
  3. Using your file manager, navigate to the folder containing your recorded show. You should now see a file named "Seinfeld S08E05.edl" (note the EDL filename extension). You can view the file contents to confirm the start and end times (in seconds) for the commercials.
    0.00	77.54	0
    2167.10	2293.04	0

Step 5 — Launch comskip when a recording is complete.

This is where we start to connect Emby and comskip. In this step we will configure the LiveTV section of Emby to launch the comskip application you installed and tested above.

There are two ways to go here: (A) launch comskip when a recording completes, or (B) launch comskip when a recording begins and look for commercials in real time. CHOOSE ONE METHOD OR THE OTHER, NOT BOTH.

Step 5(A) — Post-processing: running comskip when a recording is complete.

  1. From your Emby instance, navigate to the Advanced LiveTV settings as follows: Manage server > Live TV / DVR > Advanced.
  2. Scroll down. Locate the following 2 fields and enter the values shown (see Step 2 for the correct path for comskip and Step 3 for the path to comskip.ini):
    • Post-processing application: /usr/local/bin/comskip
    • Post-processor command line arguments: --ini=/etc/comskip.ini "{path}"
  3. Click the Save button at the bottom to save your changes.
  4. To test that this is working, record a new show. When the recording is complete, wait a few minutes and then check for the presence of a new EDL file in the folder containing the show.
    • The EDL file should be created shortly after the recording completes. However, comskip can take a while to completely process every frame of your video. The longer the video, the longer it will take to finish. Thus, the EDL file may not be finalized for 5 to 30 minutes after the recording is complete. 

Step 5(B) — Live-processing: run comskip in real time during a recording. MASSIVE thanks to @reneboulard for his excellent work on live-processing in Linux.

Live processing requires the installation of the Emby Scripter-X plugin. This allows you to execute scripts and commands when specific events occur such as the start of a recording.

It also requires the use of a bash script (attached) called emby_preprocessing.sh. The attached bash script is very powerful. It logs activity, and allows you to use show-specific comskip.ini files on a per-show basis (see Step 8).

  1. Install the Emby Scripter-X plugin:
    1. From your Emby instance, navigate to the Plugins area as follows: Manage server > Plugins. Click the Catalog tab at the top.
    2. In the General section, locate and click Emby Scripter-X. On the plugin detail page, click the Install button. When installation is complete, reboot your Emby server.
  2. Create and test the bash file: 
    1. Download the attached emby_preprocessing.sh file to your downloads folder. Copy the file to your /usr/local/sbin/ folder with the following command:
      $ sudo cp ~/Downloads/emby_preprocessing.sh /usr/local/sbin/
    2. Make the bash file executable with the following command:
      $ sudo chmod +x /usr/local/sbin/emby_preprocessing.sh
    3. Test that the bash script is working by launching the script along with the test file above and looking for the production of EDL files. Here are sample commands:
      $ cd /usr/local/sbin/
      $ ./emby_preprocessing.sh '/mnt/Emby/TV Shows/Seinfeld (1981)/Season 8/Seinfeld S08E05.ts'
  3. Combine the Emby Scripter-X plugin with the bash script:
    1. Ensure that the live_tv parameter in /ect/comskip.ini is enabled: live_tv=1
    2. In the Emby Plugins area, ensure that the Real Time option is enabled.
    3. Navigate to the Emby Scripter-X settings as follows: Manage server > Scripter-X → Actions
    4. Scroll down to locate the onLiveTVRecordingStart section. Click the section title to display the details. 
    5. Click the "+" icon at the top-left of the long list of variables and then the edit/pencil icon on the right. 
    6. Complete the following:
      1. Script file: /usr/local/sbin/emby_preprocessing.sh
      2. Parameters: "%recording.path%" "%recording.name%"
      3. using (dropdown): /bin/bash
    7. Click the save/check icon on the right to save the changes.
    8. Test that the the Emby Scripter-X plugin is properly launching the bash script by recording a show and looking for the production of EDL files. Since the bash script includes a 1-minute delay, wait a few minutes and be patient. Once the EDL file is created, you can observe this file during the recording.  Entries should show up in real time as commercials are detected.

1684966836_Scripter-XActions2022-03-01at4_11_45PM.png.d3f80807fa0a08454defd6f758b208fc.png

Step 6 — Installing the Com Skipper plugin for Emby Server

Now that your system is properly configured and tested, it's time to install the Com Skipper plugin and enjoy the ability to skip commercials while watching a recorded show!

Note: This plugin is not (yet) in the existing plugin catalog and must be installed manually. Once installed, it will appear in the Plugins section of Emby and you can manage it from there.

  1. Download the com_skipper plugin from the first post in this thread. I recommend subscribing to this thread to get notified when updates are released. You might also consider watching this repository on Github for the same reason.
  2. Extract the ZIP file to your downloads folder.
  3. Copy the DLL file to the Emby plugins folder with the following command (update to your emby path from step 1 as needed) .
    $ sudo cp ~/Downloads/ComSkipper.dll /opt/emby-server/system/plugins
  4. Restart Emby from the dashboard.
  5. Review the plugin settings by navigating to Manage server > Plugins > Com Skipper > Settings.
    • Note 1: The setup described above does not support the Real Time Processing option shown in the plugin.
    • Note 2: For AppleTV users, you MUST enable the first 2 options for things to work as you expect. 

350241105_Plugins2022-02-16at11_32_31AM.png.8842e31a81e3e36cc5c15357aca39b3e.png

Step 7 — Test commercial skipping in your Emby client!

If everything is done right, you can now watch either the show you used for testing in Step 4, or the new show you recorded as a test in Step 5. Commercials should be skipped based on the times (in seconds) noted in the EDL files created by comskip.

If many of your commercials are not detected, or if the start/end time for the detected commercials is not accurate enough for you, feel free to experiment with the values in /etc/comskip.ini until the desired accuracy is achieved. Google is your friend in this pursuit. For example, this thread, and this one regarding country-specific INI files.

Step 8 — Using series-specific comskip.ini files

If you followed the live-processing instructions in Step 5(B), you can put a comskip.ini file in the parent folder for any series you are recording. This file can have different parameters than the default file in /etc. This is useful for problematic shows that need specific optimization. 

Using the Seinfeld example above, use this command to copy and then modify your default ini file:

$ cp /etc/comskip.ini '/mnt/Emby/TV Shows/Seinfeld (1981)'
$ nano '/mnt/Emby/TV Shows/Seinfeld (1981)/comskip.ini'

comskip.ini 5.84 kB · 73 downloads

emby_preprocessing.sh 3.54 kB · 50 downloads

Does this still work for anyone for live processing? Scripterx does not seem to do anything. It used to work.The log does not give any info.

 

2024-08-08 22:21:55 : Starting preprocessing script The 6 O'Clock News 2024_08_08_22_00_00.ts
2024-08-08 22:23:00 : Start comskip of The 6 O'Clock News 2024_08_08_22_00_00.ts from /mnt/Medialibrary/Recorded TV/The 6 O'Clock News
2024-08-08 22:23:00 : use default ini and no logofile
2024-08-08 22:23:00 : no logo file to move
2024-08-08 22:23:00 : Finished prepostprocessing script The 6 O'Clock News 2024_08_08_22_00_00.ts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...