How to Troubleshoot Ad Detection Problems

Server Version#: 1.42.2.10156
Player Version#: Apple TV app latest version

Ad detection has been working, but recently it’s started behaving very erratically. I record some local OTA programming to watch at a more convenient time. I have ad detection turned on but not automatic ad skipping.

  • At the first commercial break I get the “Skip Ads” button and it works correctly
  • At the second break there is no “Skip Ads” button. I have to skip forwards 10s at a time past the ads.
  • Then, after skipping the second break, during program content, the “Skip Ads” button appears (not during ads). If I click the “Skip Ads” button it terminates the whole program.

How do I troubleshoot this further?

I dont think it works with the new ffmpeg.

I’m not sure. How that applies to my question… can you clarify?

https://forums.plex.tv/t/buffer-overflows-in-plex-commercial-skipper

Is there a way to downgrade ffmpeg to an earllier version? Which version?

Everything I find on the web says it wouldn’t be possible to downgrade to a previous version because PMS uses its own highly customized fork.

There has to be a solution for this.

Do Plex developers read these messages?

I’m about ready to throw in the towel and give up on PMS if I can’t get this working.

they strip mined open source, and now dont want to maintain it. There is an older version that works, but it has other security issues.

See Apple TV Logs and PMS logs. Reproduce the issue, capture both client and server logs and share them here or DM them to me.

I will do this later today, after recording and viewing new OTA content.

Just FYI, the ad-skip behavior is the same regardless of the player:

  • Samsung Plex App
  • AppleTV app
  • Plex web interface at https://[local PMS server]:32400

This leads me to believe that the problem is in the analysis and ad identification metadata.

I can also provide a media file demonstrating the issue if that will help. If that’s the case I’ll need to know how to provide both the media and any ad marking metadata file(s).

Thanks

1 Like

Terminates the program as in dismissing or close the Plex app or dropping playback to the previous page (if you started playback from the Show or episode level, did it return you to that page)?

Sorry, that wasn’t clear. At that point (late in the program, with Skip Ads displayed during program content, not ads), it skips to the end of the program.

Can you go to one of these titles and view it’s XML data? Can you copy and paste it here or in a DM to me? I’m suspecting that the ad marker maybe ending at the end of the file or an overlap in ad and credit markers.

IIRC if you’d like to reanalyze the file for ad detection you’ll need to Plex Dance the file. Once the file is readd, ad detection can be ran again. Either manually, automatically when added, or during maintenance depending on your settings.

Below is the XML from a program recorded yesterday that exhibited the missing ad skip markers

What are the units for time offsets? Looks like milliseconds based on the duration attribute being 1912438, which if ms would be just under 32 minutes, which is about right. Is that the case?

<?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="1" allowSync="1" identifier="com.plexapp.plugins.library" librarySectionID="1" librarySectionTitle="TV Shows" librarySectionUUID="25a819f4-2b3f-4ac1-9ef6-fd94f905c70f" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1770226015">
   <Video ratingKey="215" key="/library/metadata/215" parentRatingKey="201" grandparentRatingKey="200" guid="plex://episode/698570ce865507da83d0f441" parentGuid="plex://season/61fd5f3a6c42744532d5e89b" grandparentGuid="plex://show/61fd5f3a6c42744532d5e89b" type="episode" title="KGW News at 5" grandparentKey="/library/metadata/200" parentKey="/library/metadata/201" librarySectionTitle="TV Shows" librarySectionID="1" librarySectionKey="/library/sections/1" grandparentTitle="KGW News at 5" parentTitle="Season 2026" summary="Important local news and weather from KGW." parentIndex="2026" viewOffset="844000" lastViewedAt="1771610800" lastRatedAt="0" year="2026" thumb="/library/metadata/215/thumb/1771551060" art="/library/metadata/215/art/1771551060" grandparentThumb="/library/metadata/200/thumb/1771291859" grandparentArt="/library/metadata/200/art/1771291859" duration="1912438" originallyAvailableAt="2026-02-19" addedAt="1771551059" updatedAt="1771551060">
      <Media id="160" duration="1912438" bitrate="15719" width="1920" height="1080" aspectRatio="1.78" audioChannels="6" audioCodec="ac3" videoCodec="mpeg2video" videoResolution="1080" container="mpegts" videoFrameRate="NTSC" channelIdentifier="5fc76c777dc1e8002d48a892-5fc705f5dd53a6002d8f919c" mediaGrabBeginsAt="1771549200" mediaGrabDevice="device://tv.plex.grabbers.tunerservice/dvb%23v4l%23%2fsys%2fdevices%2fpci0000%3a00%2f0000%3a00%3a14.0%2fusb3%2f3-3%2f3-3%3a1.0%3a0014459185" mediaGrabStatus="complete" origin="dvr" videoProfile="main" hasVoiceActivity="0">
         <Part accessible="1" exists="1" id="160" key="/library/parts/160/1771551059/file.ts" duration="1912438" file="/media/plex/KGW News at 5 (2014)/Season 2026/KGW News at 5 (2014) - 2026-02-19 17 00 00 - KGW News at 5.ts" size="2013633972" container="mpegts" deepAnalysisVersion="6" packetLength="188" requiredBandwidths="9910,9454,8622,8259,8128,8128,8128,8128" videoProfile="main">
            <Stream id="638" streamType="1" codec="mpeg2video" index="0" bitrate="7572" bitDepth="8" chromaLocation="left" chromaSubsampling="4:2:0" closedCaptions="1" codedHeight="1080" codedWidth="1920" colorRange="tv" frameRate="29.970" height="1080" level="4" profile="main" refFrames="1" requiredBandwidths="9334,8878,8046,7683,7560,7560,7560,7560" scanType="interlaced" streamIdentifier="256" width="1920" displayTitle="1080i" extendedDisplayTitle="1080i (MPEG2VIDEO)" />
            <Stream id="640" streamType="2" selected="1" codec="ac3" index="1" channels="6" bitrate="384" language="English" languageTag="en" languageCode="eng" audioChannelLayout="5.1(side)" requiredBandwidths="384,384,384,384,384,384,384,384" samplingRate="48000" streamIdentifier="257" displayTitle="English (AC3 5.1)" extendedDisplayTitle="English (AC3 5.1)" />
            <Stream id="641" streamType="2" codec="ac3" index="2" channels="2" bitrate="192" language="Spanish" languageTag="es" languageCode="spa" audioChannelLayout="stereo" requiredBandwidths="192,192,192,192,192,192,192,192" samplingRate="48000" streamIdentifier="258" displayTitle="Spanish (AC3 Stereo)" extendedDisplayTitle="Spanish (AC3 Stereo)" />
            <Stream id="639" streamType="3" canAutoSync="0" codec="eia_608" index="0" bitrate="7572" embeddedInVideo="1" requiredBandwidths="9334,8878,8046,7683,7560,7560,7560,7560" streamIdentifier="256" displayTitle="Unknown" extendedDisplayTitle="Unknown (Closed Captions)" />
         </Part>
      </Media>
      <Image alt="KGW News at 5" type="coverPoster" url="/library/metadata/200/thumb/1771291859" />
      <Image alt="KGW News at 5" type="snapshot" url="/library/metadata/215/thumb/1771551060" />
      <Image alt="KGW News at 5" type="background" url="/library/metadata/215/art/1771551060" />
      <UltraBlurColors topLeft="0c304c" topRight="165c91" bottomRight="1f2a58" bottomLeft="1e2b29" />
      <Channel id="7" filter="channel=7" tag="8.1 KGWDT (NBC)" />
      <Marker id="10" type="commercial" startTimeOffset="876980" endTimeOffset="982680">
         <Attributes id="10" />
      </Marker>
      <Marker id="10" type="commercial" startTimeOffset="1535300" endTimeOffset="1661090">
         <Attributes id="10" />
      </Marker>
      <Marker id="10" type="commercial" startTimeOffset="1745910" endTimeOffset="1910680">
         <Attributes id="10" />
      </Marker>
      <Marker id="10" type="credits" startTimeOffset="1793194" endTimeOffset="1835194">
         <Attributes id="10" version="4" />
      </Marker>
      <Marker final="1" id="10" type="credits" startTimeOffset="1855194" endTimeOffset="1912438">
         <Attributes id="10" version="4" />
      </Marker>
      <Field locked="1" name="art" />
      <Extras size="0" />
      <Related />
   </Video>
</MediaContainer>

I tried the “Plex Dance” and was able to perform everything up to the last step.

After moving the media files back to their original location running “Scan Library” did not restore the items. According to the UI the scan completed immediately, but I can’t tell if there’s something running in background. top filtered on user plex shows almost no activity by any of the 8 background processes.

The xml shows the commercial detection and credit detection overlapping in times. That sounds logs an issue with the detection. Do you have auto skip credits enabled? That could explain it jumping to the end when you skip the commercial.

I do not have auto-skip-credits enabled.

However, the more pressing issue for me is fact that ad-skip analysis seems to miss commercial breaks regularly.

This wouldn’t be as big an issue if it weren’t for two other issues:

  • The lack of a 30-second forward skip in the AppleTV and Samsung apps
  • The serious problem in the Samsung TV app where backward skip does not work at all