Post-processing via script at end of recording

Pretty self explanatory - I'd like the ability to call a bash or python script once a recording is finished.

EDIT - To elaborate a bit further, here is a use case:

The ability to post-process a show after its recording has completed will allow for additional functionality that doesn't currently exist in Channels DVR. Conversion to another format, commercial removal, import into other media managers, etc. are all attainable with other Open Source and Paid software solutions. This would be an easy way to expand the power of the Channels DVR App without having to re-invent the wheel.

This is on our radar, but there's no timeline for it.

Still on the radar? any closer? I'd prefer not to hack something together, it's likely to be fragile if there's more post-processing added, beyond comskip.

Right now, replacing the comskip executable with a cuckoo seems like the cleanest way to do it, until there's an 'official' supported method.

2 Likes

I too would like to something like this. I preferer my files in a .mkv format which I would prefer to .mpg. In plex dvr I use a an easy post processing script ffmpeg.exe to convert plex's .ts files to .mkv.

1 Like

I'm in the same spot - I prefer my files in a mkv format. Typically my processing (thru a batch call to mcebuddy) will save me over half the space while keeping the same quality. I've just started testing out Channels and this is pretty high on my list of needs

Thanks!

Eric

Add me to the list that would like this feature. For the less technical folks like myself.... maybe something like..... "After recording is complete and commercial detection is done, move file to location X".

For those with some scripting skills, the channels-dvr.log file can be used as an event trigger. A more formal solution would be great, but I have found watching logfiles as an event-trigger mechanism is useful in the interim. Pull the output from "tail -F channels-dvr.log" and grep for "Processing file-" and you will get recording completion notifications of the form:

2021/08/03 20:00:00.025611 [DVR] Processing file-375: TV/America's Top Dog/America's Top Dog S02E07 The Comeback Dogs 2021-08-03-1900.mpg

Obviously this solution breaks if the logfile format changes. I would strongly urge the devs to create a formal event logfile with a structured format as the recommended solution to code against (the poor mans message bus). A great way to enable the DIY crowd when a full-featured solution might be some time away.

You can look into Channels' own event log:

1 Like

Thanks! Had no idea that was there. Will see what goodies it includes. Hopefully it allows me to discontinue my log tailing.

Interesting idea. However, this might not work with all versions of Channels DVR. For instance, the Synology build of Channels is mostly a black box. I wouldn't even know where to begin looking for the log file. This might make me switch things up though. It would be nice to automate the few remaining manual tasks.

I've put something together that works as a 'hook' to run scripts when a recording completes. See https://github.com/Channels-DVR-Goodies/cuckoo. It's currently in a 'works for me' status, I'd love for other people to give it a try, and give me feedback.

In a nutshell, it replaces the Channels DVR's private copy of comskip with an executable that runs whatever it finds in a directory (in alpha-sort order). It makes a copy of the private copy of comskip with the name '50-comskip' so you can run scripts or other executables before or after the private copy of comskip is executed.

It's been working great for me for a couple of months now. It only supports Linux, needs to be re-applied when Channels DVR updates itself (though that's painless, could even be done with a cron job) and the documentation could be improved...

This is a stop-gap until the intrepid crew at FancyBits can put an 'official' mechanism in place. It's not an ideal solution, but it is 'clean' in that it does not modify Channels DVR or the private copy of comskip. It just subverts the invocation of comskip by Channels DVR to run something else (using standard Linux mechanisms), which in turn also invokes the private copy of comskip as well as other scripts/executables of your choosing. It also passes through the parameters that Channels DVR passes to comskip, so you get the path to the recording, etc.

Obviously you need to have the 'Detect Commercials' option enabled, or comskip won't be called by Channels DVR in the first place.

While you're at it, turn on 'MCEBuddy Metadata' and 'EDL Export', and take a look at https://github.com/Channels-DVR-Goodies/json2shell and https://github.com/Channels-DVR-Goodies/edl2mkvchapters

https://github.com/Channels-DVR-Goodies/json2shell takes the JSON file that MCEBuddy Metadata outputs, and turns the contents into shell variables. Thus your scripts can have access to all the metadata that the JSON file contains. I use it to organize my transcoded recordings by genre, for example.

https://github.com/Channels-DVR-Goodies/edl2mkvchapters takes the EDL file and converts it to a 'chapters' file for use with mkvmerge. Thus you can add chapter marks for the regions identified by comskip. Personally, I prefer chapter marks over actually cutting the file, because comskip isn't 100% trustworthy for me. Chapter marks are non-destructive. This 'chapters' file is of the ' XML based chapter format' type , so it's more sophisticated than the one that you can ask comskip to generate, which is the 'simple format'.

1 Like

As the sayings go

  • Never be afraid to ask questions
  • Closed mouths don't get fed
  • The squeaky wheel gets the grease
  • You lose 100% of the games you don't play
  • I'm running out of cheesy sayings to entertain you with this post

So, yea, bump. :slight_smile: