Is it possible to get the live video using the API?

Hi.

I am new on this forum. I don’t know if this question has been asked before but I want to write a script that takes a screenshot of a live stream. I’d like to know if there is a way to do that with the API.

Thank you.

You can get the screenshot from the streams API

use the “preview” key

For anything else it works better if you integrate “client side” in the actual streaming software.

You cannot directly connect to the video feed and take a screenshot. There are not API’s for that.

Thank you for the reply.

Can you describe integrating to the client side?

Custom plugin for $software that does exactly what you need

Existing plugin for $software that provides the needed things

Ah ok. Thank you.

One more thing. Wouldn’t the preview key just return a thumbnail image? What if I want to recursively take screenshots at 1 second delays?

It returns a “template” so you can set the width/height you need

You need an alternative solution then.

Twitch’s preview is generally “cached” for a few minutes or so

If you are working in OBS, I use The OBS Websocket plugin and some custom code → https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md#takesourcescreenshot

I already have a Python script that can take these screenshots. That isn’t the issue. How can I hook up my Python script with the API?

The Twitch API doesn’t return/provide the ability to connect to the video stream to get screenshots.

Shoot. Any alternatives to suggest?

Use the OBS websocket plugin to talk to OBS and ask it for a screenshot

or

Like I already suggested

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.