Edit Commercials - mark all blocks as program

Right now you have to click each block detected as an ad to toggle it.

I'm asking for a way to mark the whole recording as program material (no ads) without having to click every block detected as an ad to toggle it.

The reason for this is I would like to keep some recordings in Channels DVR (but with ads removed) instead of having to move them to local content imports and spending even more time fixing matches and editing metadata.

I use VideoRedo to remove the ads in the recorded file and save it as a .ts file, then rename the .ts file to .mpg and move it over the Channels DVR recorded file. Before I do this I mark the recording as having no ads using Edit Commercials. After replacing the recorded file I Refresh Metadata to pickup the new duration. This works fine, but requires a lot of clicking to mark a recording as having no ads.

Would setting your recordings to not detect commercials accomplish what you are looking for?

Unfortunately not.
I use comskip to create a project file (.VPrj) with time markers used by my video editor, VideoRedo.
The comskip log file is also useful to pinpoint the PTS timestamp where a recording interruption occurred.

Now a lot less clicking, but not as easy as clicking a button or two.
Created a script I manually run after removing ads and replacing the original recorded file.
Of course this is based on current undocumented API's.

# Remove the commercial markers from Channels
POST /dvr/files/{FileID}/comskip/edit?source=local --data-raw "[]"

# Refresh metadata to update duration
PUT /dvr/files/{FileID}/reprocess

# Regenerate Video Index
PUT /dvr/files/{FileID}/m3u8

Posting the windows command file I'm using if anyone is interested.
I'm sure you could modify it for other OS's

I prompts you for the FileID of the recording, displays what you entered and prompts to continue doing the above API calls.
It will keep looping (until you don't enter a FileID) so you can process multiple recordings.
No error checking since I just wanted a quick and dirty script.

My DVR is at 192.168.1.4:8189, so just edit the IP:port to match yours.

marknocommercials.cmd
@ECHO OFF
:GETFID
SET _FILEID=
REM SET /P prompts user for input and assigns it to the variable _FILEID
SET /P _FILEID=Enter Recording's FileID, or press ENTER to cancel 
IF %_FILEID%.==. GOTO FINISHED
ECHO CTRL-C cancels, to process file '%_FILEID%'
PAUSE
ECHO Removing commercial markers from Channels
curl -XPOST "http://192.168.1.4:8189/dvr/files/%_FILEID%/comskip/edit?source=local" --data-raw "[]"
ECHO.
ECHO Refreshing Metadata
curl -XPUT "http://192.168.1.4:8189/dvr/files/%_FILEID%/reprocess"
ECHO.
ECHO Regenerating Video Index
curl -XPUT "http://192.168.1.4:8189/dvr/files/%_FILEID%/m3u8"
ECHO.
ECHO.
GOTO GETFID
:FINISHED
EXIT

I think I'll add a Bash version of this to OliveTin.

@chDVRuser would this also work for recordings I made on PBS and various premium channels (before I turned Comskip off on those channels)? I know I have some recordings I intend to keep, where "phantom" commercials were detected, and I'd love to clear away those incorrect detections.

Yes, it will work for those older recordings.

This is cool, I just did my first recording replacement as you described. It works perfectly. :+1:
Thank you for describing the process and for creating the script. :smiley:

1 Like

Thanks, I still use this script a few times per week.

Have you tried .m2ts instead?

No. It's already recorded as an MPEG Transport Stream by Channels DVR MPEG transport stream - Wikipedia

That container normally uses a .ts extension, but Channels DVR changes the file extension to .mpg. That doesn't change the container or what's in the file, just the filename extension.

.m2ts is a BDAV MPEG-2 transport stream used in Blu-ray disks, a different container .m2ts - Wikipedia

If you're using VideoRedo, here's what I did.
Copy the default Transport Stream Output Profile and name the copy Transport Stream (25MBS)


Then edit it using the Advanced option to change the Output Mux Rate to Manual and 25000 Kbps

That's the output profile I select when editing Channels DVR recordings and saving to .ts

For some m3u recordings I don't want to keep in Channels DVR, I edit and save as .mp4 (to include chapter marks where I make cuts) outside of Channels DVR and delete the recording from Channels DVR.

Anything I edit that will stay in Channels DVR uses that Transport Stream (25MBS) Output Profile.

The reason I mentioned .m2ts is because of this:

TS and M2TS are effectively the same thing. M2TS adds a four byte timestamp to each packet which can help with timing during playback. (192 byte packets vs 188 byte in .ts files)

Also, I tried this method recently with a TS file and when I played it with VLC, it kind of choked on it when seeking in the file. I tried with the default video player in Windows and it worked fine. So I thought maybe M2TS would potentially improve the timing during playback.

What you said makes sense though about TS and Channels.

I do use VideoReDo.

Why do you change the mux rate?

It's been so long since I changed it I don't remember exactly why. Something to do with an underflow or overflow when saving and VLC not skipping smoothly when it played it back. I changed a lot of settings over the years based on issues I had and suggestions from the old forum (which I never thought would go away).

1 Like

OK so my experience matches yours. :slightly_smiling_face:

Thanks for the settings, I will do exactly the same since it's been working for you all this time.
I'm new to this so I trust you. :wink:

I use your cmd script almost every day now. It's great! :smiley:

1 Like

If you look at the VRD log and see errors about underflow or overflow (forget which) while saving, that is where changing the output mux bitrate helps.

1 Like