I have some episodes that were recorded and marked as the wrong episode number in the guide. I renamed the file, but now the commercial offsets that were detected seem to apply to the wrong episode.
Where does plex store the offsets extracted from comskip so that I can adjust it?
Is it possible to run detection again manually for a specific file? (this would also be useful for tuning comskip.ini settings)
I also tried to run it manually from the command line but I get errors about the video codec not being supported so I guess itâs not finding the correct libraries
Data is stored in the database, do a getinfo on the file.
You should have Plex âdancedâ the file before renaming so the entry would have been removed from the database.
If the DVR and Library are set to detect commercials on all items, you can analyze the season or dance the file to get Plex to re-detect commercials. Alternatively, you can create a custom comskip.ini file and all your DVR media will be rescanned. Removing Commercials | Plex Support
Thanks for the reply. Please can you expand further on what you mean by âdancedâ the file? By getinfo, do you mean the XML info of the file via the UI/API?
I searched the sqlite database but could not locate any data for the ads/commercials. Do you know where in the database theyâre stored - which table?
I recently added a custom comskip, but its not been used yet. I ideally donât want to run the comskip on all the media in the library, since most of the historical media has the commercials cut out already. Its only recent recordings I want to run (or rerun) it for, because I did not get good episode numbering when recording, and Iâve also adjusted my comskip.ini.
If I understood you correctly, I could set the library to run for all - then run âanalyseâ on the episodes I want, then unset at the library level?
Commercial (and intro) markers live in the media_parts table, in the extra_data column; the data in this column is URL-encoded. However, this table doesnât hold the actual name of the media to which the data belongs; to get that, youâll have to use the media_item_id to join on the media_items table. And from there, youâll need to use that tableâs metadata_item_id column to join on the metadata_items table.
Editing the data in media_parts to adjust the markers probably isnât practical. I agree with @pl_5309, the best way to correct your commercial markers would be to configure the library for ad detection for all items and then perform the Plex Dance on the affected items. After doing so, forcing a media analysis should cause ad detection to run; Iâd wait until intro detection for the items has completed, however.
I would strongly recommend keeping your existing TV/Movies libraries in separate directories than the ones for use with the DVR due to past, present and future oddities that have occurred.
If no commercials are detected, it will rescan the file every night until you remove it as an example.
Great point; Iâd assumed we were talking about a DVR-only library since thatâs how I have mine organized. Itâs probably not always a safe assumption to make.
I normally would use a separate library - but this is already a specific library for one specific show - so it would mean two libraries for a single TV show.
I tried setting the library to run commercial detection for recorded content, then running Analyse on the individual episodes, but it only does intro detection, probably because it doesnât know theyâre recorded since I changed the filenames.
I will try setting it to all content, analysing, then disabling that. If anyone has any hints on the other questions about where this commercial metadata is stored it would also be highly
appreciated.
In case anyone else benefits, I discovered to run the Plex commercial skipper (comskip) manually you need to set the FFMEPG_EXTERNAL_LIBS environment variable in this format (on Windows):
set FFMPEG_EXTERNAL_LIBS=\\\\?\\C\:\\Users\\<username>\\AppData\\Local\\Plex\ Media\ Server\\Codecs\\73e06c8-3759-windows-x86\\
The exact path will differ, but I was previously missing all the extra backslash escapes and ? before the drive, etc.
@dannytrigo2 your question was spot on for me and my needs!
@pshanew your explanation of the media_parts and media_items tables was perfect for me. Once turning on ad detection, I was able to use the following sqlite3 query to check each day how ad detection was progressing during the maintenance hours over night as PMS worked to retroactively ad detect shows in my library.
sqlite3 com.plexapp.plugins.library.db '
SELECT hints
FROM media_items, media_parts
WHERE media_parts.media_item_id = media_items.id
AND media_parts.extra_data LIKE "%commercials=%";' \
".exit"