Channels HTTP API

Is is possible to do open the app with IFTTT now too?

Apple doesnā€™t publish their APIs. They changed how their software remotes communicate with the Apple TV in tvOS 13.

Itā€™s unclear if the new stuff will include the ability to launch apps. For now their software remotes donā€™t have that functionality. Itā€™s not clear what is being used to launch apps with Shortcuts.

Hopefully the people that maintain programming libraries to communicate with the Apple TV will dig and find something.

I know I asked about this somewhere on this forum long time ag, but could try another attempt until my sub expire.
You mentioned once that each video has stored in API start and end time of the commercials detected, but I cannot find relevant info on forum. If I use that information for ffmpeg to re-encode file and cut the commercials and put the file under same name in directory will Channels re-scan again file and try to detect commercials or I will have trouble to playing file because Channels server become crazy

1 Like

If you do this, you need to choose the Refeah Metadata option so it can read the length of the new file.

You probably need to have it re-index commercials too. Thereā€™s a chance that it still tries to detect them though. Thereā€™s no function to remove commercial indexes.

Could You remind me how to get that time stamps for particular video?

You need to find the FileId. You can find this in View Details in the web admin.

Then you can fetch the data with /dvr/files/:file_id

In the JSON, the Commercials key will list an array of floats. This is a list of all start and ends of commercial breaks in seconds. So:

[24.24, 450.23, 1201.02, 1421.55]

Would mean that the first commercial break starts at 24.24 and ends on 450.23.

If the first digit is a 0, it means the recording starts with a commercial. If it doesn't, it means the recording starts with a show.

Obligatory reminder that the API is not stable or public and can change at any time*

1 Like

Cutting is not so easy as I thought it will be better to split clip and then join. Can I assume that in you example when commercial break starts at 24.24 the movie ends 24.23?

May help you to look at these files created by comskip in the Logs/comskip/fileid# folder for each show that was processed by comskip.

video.edl
video.ffmeta
video.ffsplit
video.txt
video.vdr

I can't tell you how to use them, but if you look at video.ffsplit it appears that could be used with ffmpeg to output each show segment.

Here's a post from @tmm1 at the comskip github site on using ffsplit and ffmeta

You are briliant. This is sort of information I was looking for. Tomorrow I try to do some testing :slight_smile:

Ok some good and bad news. Ended up with the script, you can grab here.

Split for segments is supported,unfortunately one caveat came in and I cannot test merging clip because FFMPEG do not support HE-AAC codecs. I tried to download and build some big package but in result I messed up my environment and had to repair lot of libraries, and macosx version was not supported anyway.
There is no way to use homebrew to get proper ffmpeg builds because Homebrew idiots turned off support for enabling additional options to packages.

There are some standalone builds for FFMPEG but could make it to work with HE-AAC and some channels broadcast sound in that format.

As always tough, using ffmpeg to split clip results in lot of errors in console, I never know if they are important or not. Maybe some better CLI tools exist somewhere.

Ok, I compiled ffmpeg version with all the option flags, it took hell of a time so I share it with you if someone needit to test linux version (Ubuntu) and MacOS Mojave version

Still when I try to concatenate TS segments to Mpeg I got AAC codec is not supported, not sure why, Google is silent on that error :frowning:

So I tried first to concatenate TS segments into one TS file and then convert to Mpeg. So maybe someone more familiar with video editing and ffmpeg can explain me the best procedure?

I didn't look through all the file but if you wanna check grab Output.ts and converted Output.mpeg

For test I used Sliders episode from Comet, after concatenations there was some graphic "We'll be right back" seen during episode, not sure if this count as commercial for comskip or not. Also apparently stream recorded from Comet is H264/AAC already so maybe it is not necessary to re-encode, but I was sure that all american channels broadcasting in Mpeg-2 so something changed?

OTA broadcasts are MPEG2/AC3 encoded; TVE streams are H.264/AAC encoded. Also, not sure why you needed to compile your own ffmpeg; Channels ships with ffmpeg statically linked in the same location as its DVR server.

Never heard about it. I had ffmpeg compiled on my system before I installed Channels so that binary tooks precedence and it lacked correct AAC support because of Homebrew, thats why i built it myself because other binaries provided on internet also lacked AAC support because of some stupid licensing.

I see your point but Comet is OTA channel, I couldn't find it on my friend's DirecTV box in channels line-up so not sure how it apply to TVE since Comet also provides stream free of charge on their website.

If you have a TVE source setup in Channels, Comet is automatically added as channel 6751, regardless of which provider you use. (All channels from 6700 and up are automatically available with a TVE source.)

1 Like

Ok stil question remains - what is the best order of proceeedings with recording to cut commercial from them. for TVE split and join without re-encoding and for OTA split and convert? does ffmpeg has some flag to display just the codecs used in video/audio stream so I could script this?

Ffmpeg has ffprobe to analyze streams, and the -c copy option in ffmpeg will preserve codecs and only remux, not transcode.

Also, after comskip runs, in each file's comskip log directory is an ffmeta file you can use to either embed chapter markers or how to split/segment an input file.

Check out the docs at ffmpeg.org: they're quite complete.

Also, https://github.com/BrettSheleski/comchap might interest you

I already use comskip log directory in my script I shared few post above :slight_smile:
FFMpeg is so complete that overwhelming but they dont provide Channel specific answers.
and my question was about how to proceed with the files FOR CHANNELS DVR PURPOSE i.e I need to put the file in the same place as it was before but to do this I need to have MPEG not TS and I couldn't find clear and simply answer - will something like this
ffmpeg -i "concat:segment001.ts|segment002.ts|segment003.ts|segment004.ts|segment005.ts" -c copy output.mpeg only changes extension or in fact put ts in mpeg container that is required by Channels.

in the meantime as I finish my script just a thought.
Instead of relying on unsupported tuner simulators like Telly and Xteve, wouldn't it be possible to add POST endpoint to the API for dvr stuff?
Of course with Oauth token authorisation and with the payload of:

  • stream url
    -show name
  • date
    -time start
    -time finish
    That would give great opportunity to building stuff, e.g trakt client integrated with Channels :slight_smile:
1 Like

Thanks to @racameron ( the only one who follows discussion here) I updated script on gist to include merging into TS file with mpeg extension.

Can you please share more details on how to use this script?