# Commercial Skipper codec

**URL:** <https://forums.plex.tv/t/commercial-skipper-codec/795388>\
**Category:** Live TV & DVR\
**Tags:** livetv-dvr\
**Created:** [June 2, 2022, 3:37pm UTC](https://forums.plex.tv/t/commercial-skipper-codec/795388 "2022-06-02T15:37:46Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Meldrak](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/meldrak/32/25967_2.png) [@Meldrak](https://forums.plex.tv/u/Meldrak)\
**Post date:** [June 2, 2022, 3:37pm UTC](https://forums.plex.tv/t/commercial-skipper-codec/795388/1 "2022-06-02T15:37:46Z")

</div>

Server Version#: 1.26.2.5797 docker  
Tuner Make/Model: HD Homerun Connect

Commercial Skipper does not work, always the same error about codec

```auto
The commandline used was:
Plex Commercial Skipper, made using ffmpeg
Donator build
**Unsupported codec!**
 **Unsupported codec!ames** in 9.93 sec(124.37 fps), 1.00 sec(122.00 fps), 2%
 0:39:53 - 61116 frames in 513.67 sec(118.98 fps), 1.00 sec(78.00 fps), 99%%
61145 frames decoded in 513.96 seconds (118.97 fps)
        "/usr/lib/plexmediaserver/Plex Commercial Skipper"
        --ini=/usr/lib/plexmediaserver/Resources/comskip.ini
        --output=/data/Videos/ReplayTV/.grab/...
        -t
        --quiet
        "/data/Videos/ReplayTV/.grab/.../

```

```auto
[mpegts @ 0x148d12beb040] start time for stream 5 is not set in estimate_timings_from_pts
Input #0, mpegts, from '/data/Videos/ReplayTV/file.ts':
  Duration: 00:39:17.52, start: 1.400000, bitrate: 8378 kb/s
  Program 1 
    Metadata:
      service_name : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Main) ([27][0][0][0] / 0x001B), none(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 90k tbc
    Stream #0:1[0x101](fra): Audio: eac3 (EAC3 / 0x33434145), 48000 Hz, stereo, s16p
    Stream #0:2[0x102]: Audio: eac3 (EAC3 / 0x33434145), 48000 Hz, stereo, s16p
    Stream #0:3[0x103](fra): Audio: eac3 (EAC3 / 0x33434145), 48000 Hz, stereo, s16p
    Stream #0:4[0x104](fra): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) (hearing impaired)
    Stream #0:5[0x105](fra): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
**Unsupported codec!**
 **Could not open video codec**

```

---

<div class="post-metadata">

**Author:** ![pshanew](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pshanew/32/160555_2.png) [@pshanew](https://forums.plex.tv/u/pshanew)\
**Post date:** [June 3, 2022, 9:16pm UTC](https://forums.plex.tv/t/commercial-skipper-codec/795388/2 "2022-06-03T21:16:31Z")

</div>

You’ll need to provide some [environment variables to the command line](https://forums.plex.tv/t/comskip-command-line-help-missed-removing-commercials-now-want-to-get-rid-of-them-after-the-fact/663479/3). Note: The example in that particular post is from Windows, so the environment variable will be different.

I’m curious what you’re attempting to accomplish though. Running it manually will not actually modify the file to remove commercials, nor will it update Plex’s database with commercial markers for the file. It will just produce and EDL file and some logging.

When Plex performs commercial skipping after recording, it runs its commercial skipper and then performs additional post-processing using the created EDL file. I’ve not seen anyone reproduce that step of the process directly from the command-line.

You can configure Plex to go back and run its commercial removal/marking process on existing media files; the configuration requirements are described in the post I linked. Just keep in mind that a DVR must be configured in Plex for this to work.

---

<div class="post-metadata">

**Author:** ![Meldrak](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/meldrak/32/25967_2.png) [@Meldrak](https://forums.plex.tv/u/Meldrak)\
**Post date:** [June 4, 2022, 7:32pm UTC](https://forums.plex.tv/t/commercial-skipper-codec/795388/3 "2022-06-04T19:32:46Z")

</div>

It is plex that runs the commercial skipper and send the error about codec  
and it result in a 0 byte TS file  
Plex and DVR are well configured like documentation and post here

here the content of the FFMPEG\_EXTERNAL\_LIBS   
-rw-r–r-- 1 nobody users 278536 May 17 14:58 libaac\_decoder.so  
-rw-r–r-- 1 nobody users 200456 May 17 14:58 libaac\_encoder.so  
-rw-r–r-- 1 nobody users 143624 May 17 14:58 libac3\_decoder.so  
-rw-r–r-- 1 nobody users 155176 May 17 14:58 libac3\_encoder.so  
-rw-r–r-- 1 nobody users 304848 May 17 14:58 libdca\_decoder.so  
-rw-r–r-- 1 nobody users 1652640 May 17 14:58 libh264\_decoder.so  
-rw-r–r-- 1 nobody users 1542400 May 17 14:58 libhevc\_decoder.so  
-rw-r–r-- 1 nobody users 1789960 May 17 14:58 liblibx264\_encoder.so  
-rw-r–r-- 1 nobody users 131688 May 17 14:58 libmp3\_decoder.so  
-rw-r–r-- 1 nobody users 652344 May 17 14:58 libmpeg2video\_decoder.so  
-rw-r–r-- 1 nobody users 874432 May 17 14:58 libmpeg4\_decoder.so  
-rw-r–r-- 1 nobody users 1770912 May 17 14:58 libvp9\_decoder.so

---

<div class="post-metadata">

**Author:** ![triks\_melb](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/triks_melb/32/107894_2.png) [@triks\_melb](https://forums.plex.tv/u/triks_melb)\
**Post date:** [June 4, 2022, 9:41pm UTC](https://forums.plex.tv/t/commercial-skipper-codec/795388/4 "2022-06-04T21:41:26Z")

</div>

I can’t get Commercial Skipping to work at all on PMS / Linux so I’ve given up on it for now.

---

<div class="post-metadata">

**Author:** ![Meldrak](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/meldrak/32/25967_2.png) [@Meldrak](https://forums.plex.tv/u/Meldrak)\
**Post date:** [June 5, 2022, 10:07am UTC](https://forums.plex.tv/t/commercial-skipper-codec/795388/5 "2022-06-05T10:07:19Z")

</div>

so bad Plex team should test the feature before proposing it !!!

---

<div class="post-metadata">

**Author:** ![pl\_5309](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@pl\_5309](https://forums.plex.tv/u/pl_5309)\
**Post date:** [June 5, 2022, 11:01am UTC](https://forums.plex.tv/t/commercial-skipper-codec/795388/6 "2022-06-05T11:01:17Z")

</div>

File permissions don’t seem to be correct. In a non-docker setup they are owned by plex:plex

---

<div class="post-metadata">

**Author:** ![Meldrak](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/meldrak/32/25967_2.png) [@Meldrak](https://forums.plex.tv/u/Meldrak)\
**Post date:** [June 5, 2022, 2:08pm UTC](https://forums.plex.tv/t/commercial-skipper-codec/795388/7 "2022-06-05T14:08:54Z")

</div>

it is the correct permissions for docker unraid environnement

---

<div class="post-metadata">

**Author:** ![pshanew](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pshanew/32/160555_2.png) [@pshanew](https://forums.plex.tv/u/pshanew)\
**Post date:** [June 5, 2022, 4:53pm UTC](https://forums.plex.tv/t/commercial-skipper-codec/795388/8 "2022-06-05T16:53:53Z")

</div>

Strange. I use PMS on Docker (not Unraid though) and commercial skipping works fine for me. In fact, I’m in the process of running about nine episodes through ad skipping right now and just verified the first couple have succeeded.

I’m running PMS Version 1.27.0.5849 currently, but this has worked consistently through all versions back as far as I can recall.

Full [server logs](https://support.plex.tv/articles/200250417-plex-media-server-log-files/) may be needed to shed some light on what’s going on. My previous experience is that issues such as these are almost always caused by permissions problems.

---

<div class="post-metadata">

**Author:** ![Meldrak](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/meldrak/32/25967_2.png) [@Meldrak](https://forums.plex.tv/u/Meldrak)\
**Post date:** [June 8, 2022, 2:25pm UTC](https://forums.plex.tv/t/commercial-skipper-codec/795388/9 "2022-06-08T14:25:32Z")

</div>

for a new test I set “chmod 777 to libs” still the same error

what is your environnement to compare ?

in my case it’s DVB-T from France received in MPEG4 AVC interlaced  
my tuner is a Silicondust HDHomerun Connect

[Plex Media Server Logs\_2022-06-08\_16-13-37.zip](https://forums.plex.tv/uploads/short-url/lXPMck8vY2xT0ieRXVshDBnJjoA.zip) (4.7 MB)

---

<div class="post-metadata">

**Author:** ![pshanew](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pshanew/32/160555_2.png) [@pshanew](https://forums.plex.tv/u/pshanew)\
**Post date:** [June 8, 2022, 2:39pm UTC](https://forums.plex.tv/t/commercial-skipper-codec/795388/10 "2022-06-08T14:39:48Z")

</div>

> [@Meldrak](#):
>
> what is your environnement to compare ?
> 
> in my case it’s DVB-T from France received in MPEG4 AVC interlaced  
> my tuner is a Silicondust HDHomerun Connect

I use an HDHomeRun Connect 4K. I’m in the US, which means an ATSC 1.0 signal with mpeg2video (and AC3 audio). The tuner supports ATSC 3.0 which uses HEVC; I may be able to perform a test with that as my area does have ATSC 3.0 broadcasts.

You may want to also ensure that your /tmp directory is 777 as well; I’ve seen some strange issues reported on the forums where the permissions for /tmp were somehow changed such that Plex couldn’t write to it.

---

<div class="post-metadata">

**Author:** ![Meldrak](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/meldrak/32/25967_2.png) [@Meldrak](https://forums.plex.tv/u/Meldrak)\
**Post date:** [June 8, 2022, 2:54pm UTC](https://forums.plex.tv/t/commercial-skipper-codec/795388/11 "2022-06-08T14:54:46Z")

</div>

yes /tmp is already full access

I also tried the option in plex to convert TV stream from tuner  
reencoding is working, so no codecs errors

with commercial skipper activated and converting it fail  
Plex comskip binary is not using the same libs maybe

---

<div class="post-metadata">

**Author:** ![pshanew](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/pshanew/32/160555_2.png) [@pshanew](https://forums.plex.tv/u/pshanew)\
**Post date:** [June 8, 2022, 4:26pm UTC](https://forums.plex.tv/t/commercial-skipper-codec/795388/12 "2022-06-08T16:26:57Z")

</div>

Your logs show that the commercial skipper is actually completing successfully (at least for the attempt in the most recent log):

```auto
Jun 08, 2022 16:11:22.612 [0x1549d26dbb38] DEBUG - Jobs: '/usr/lib/plexmediaserver/Plex Commercial Skipper' exit code for process 5648 is 0 (Commercials found)
Jun 08, 2022 16:11:22.613 [0x1549cbe03b38] DEBUG - [Grabber/0442def4734f86fd8d8db95a385d5b5855ba975a/AdDetector] EDL built after 83.4 seconds.

```

Where it appears to be failing is the next step, where it attempts to actually use Plex Transcoder (ffmpeg) to actually remove the commercials from the file using the segment list (itself built from the EDL):

```auto
Jun 08, 2022 16:11:22.621 [0x1549cbe03b38] DEBUG - [Grabber/0442def4734f86fd8d8db95a385d5b5855ba975a/JobRunner] Job running: FFMPEG_EXTERNAL_LIBS='/config/Library/Application\ Support/Plex\ Media\ Server/Codecs/994f4ee-4302-linux-x86_64/' X_PLEX_TOKEN=xxxxxxxxxxxxxxxxxxxx "/usr/lib/plexmediaserver/Plex Transcoder" -y -safe 0 -skip_before_video_key 1 -skip_before_inpoint 1 -offset_inout 1 -i /data/Videos/ReplayTV/.grab/0442def4734f86fd8d8db95a385d5b5855ba975a-eae8a1c71a1e376267d0bfa4720bce51ec243047/segment-list.txt -map 0 -c copy -loglevel quiet -loglevel_plex error "/data/Videos/ReplayTV/.grab/0442def4734f86fd8d8db95a385d5b5855ba975a-eae8a1c71a1e376267d0bfa4720bce51ec243047/Section de recherches (2006) - S11E07 - Manipulations-comskipped.ts"
Jun 08, 2022 16:11:22.631 [0x1549cbe03b38] DEBUG - [Grabber/0442def4734f86fd8d8db95a385d5b5855ba975a/JobRunner] Jobs: Starting child process with pid 5659
Jun 08, 2022 16:11:22.729 [0x1549c9ba4b38] ERROR - [Transcoder] [h264 @ 0x149f539c95c0] mmco: unref short failure
Jun 08, 2022 16:11:22.729 [0x1549c9ba4b38] ERROR - [Transcoder] [h264 @ 0x149f539c95c0] number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
Jun 08, 2022 16:11:23.095 [0x1549c9ba4b38] ERROR - [Transcoder] [h264 @ 0x149f5312bdc0] mmco: unref short failure
Jun 08, 2022 16:11:23.096 [0x1549c9ba4b38] ERROR - [Transcoder] [h264 @ 0x149f5312bdc0] number of reference frames (0+5) exceeds max (4; probably corrupt input), discarding one
Jun 08, 2022 16:11:23.473 [0x1549c9ba4b38] ERROR - [Transcoder] [mpegts @ 0x149f530fd040] sample rate not set
Jun 08, 2022 16:11:23.474 [0x1549c9ba4b38] ERROR - [Transcoder] Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Jun 08, 2022 16:11:23.474 [0x1549c9ba4b38] ERROR - [Transcoder] Error initializing output stream 0:5 -- 
Jun 08, 2022 16:11:23.474 [0x1549c9ba4b38] ERROR - [Transcoder] 
Jun 08, 2022 16:11:23.480 [0x1549d26dbb38] DEBUG - Jobs: '/usr/lib/plexmediaserver/Plex Transcoder' exit code for process 5659 is 1 (No commercials found)

```

Have you tried (recently?) just having it mark ads for skipping instead of removing them?

---

<div class="post-metadata">

**Author:** ![Meldrak](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/meldrak/32/25967_2.png) [@Meldrak](https://forums.plex.tv/u/Meldrak)\
**Post date:** [June 9, 2022, 9:14am UTC](https://forums.plex.tv/t/commercial-skipper-codec/795388/13 "2022-06-09T09:14:16Z")

</div>

> [@pshanew](#):
>
> cently?) just having it mark ads for skipping instead of removing them?

when I tried marking instead of removing I didn’t see the skip button on ads  
as you suggest I did the tests again, logs seems OK commercials found

for 4 records 2 do not propose me to skip ads  
and the 2 others I have the skip button but after 1mn of ads

so it’s working but not very accurate, I see the comskip.ini I will try to find if there’s better option for my region

---

<div class="post-metadata">

**Author:** ![triks\_melb](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/triks_melb/32/107894_2.png) [@triks\_melb](https://forums.plex.tv/u/triks_melb)\
**Post date:** [June 11, 2022, 1:13am UTC](https://forums.plex.tv/t/commercial-skipper-codec/795388/14 "2022-06-11T01:13:31Z")

</div>

Unsure of what I changed but commercial skipping seems to be working now.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [September 9, 2022, 1:13am UTC](https://forums.plex.tv/t/commercial-skipper-codec/795388/15 "2022-09-09T01:13:34Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
