veden.

Dakar → Paris, on the whiteboard · episode 1 of 10

Home

1Dakar → Paris, on the whiteboard · episode 1 of 10

Twitch, more than video games

Imagine someone filming themselves without ever cutting, day and night, for a month, hitchhiking from Dakar, in Senegal, to Paris. On the internet, people watch them live and write to them as they travel.

That is what Nico did, to promote his film. The problem: nobody can watch a month of video. So we handed the job to an artificial intelligence, which watches it for us and writes a short summary of each day.

This series explains how, in ten episodes, with no prior knowledge needed. This first episode introduces the place where it all happens: Twitch.

30 days of continuous Twitch livestream, from Dakar to Paris by hitchhiking: video, audio, chat and clips, analysed by an AI processing pipeline that runs locally, to publish a travel log every day.

The livestream is Nico's, who made this journey to promote his film. This series documents the system from end to end: capture, voice recognition, analysis of the chat and clips, language models, and the errors measured in production.

This first episode sets the scene: how a Twitch livestream works, and what its APIs let us retrieve.

Dennys Salioski · 8 min

Move forward with the arrow → or the Next button. The “Discovery / Technical” button at the top changes the level of the text. Zoom the whiteboard with the mouse wheel or by pinching.

1The livestream

One camera, one platform, viewers all at the same time

Twitch is a website where you watch videos live. A person, called the streamer, films themselves with a camera or a phone. Twitch sends the picture to everyone watching, at the same moment.

Nothing is cut or edited: you see things as they happen, with the dead time and the surprises. That is the whole difference from a YouTube video, which is prepared and then published once it is finished.

The streamer encodes their video (with software such as OBS, or a mobile app when outdoors) and sends it continuously to Twitch's ingest servers, usually over RTMP. Twitch transcodes it, into several qualities when the channel is entitled to them, then distributes it over HLS: a playlist of video segments a few seconds long, which the player downloads one after another.

Two consequences for us. The livestream runs a few seconds behind reality. And a program can record it exactly as a player watches it, segment by segment, without asking anyone for anything: that is what our machine does (episode 5).

1The chat

The chat: viewers talk, the streamer replies

Beside the video, there is the chat: a stream of messages where viewers write during the livestream. The streamer reads them and answers aloud. The audience does not just watch: it takes part.

When the chat goes wild, it is often because something is happening on screen. For a computer, that is a valuable clue.

Twitch chat is historically built on IRC. Each message arrives with tags: server timestamp, badges (subscriber, moderator), emotes with their position in the text, author identifier. You can connect read-only with an anonymous nickname, with no account or token. For a bot that reads and writes, Twitch now recommends EventSub.

The rate is very uneven: from dead calm to several messages per second at a high point. These peaks can be detected with a simple statistical calculation, without AI (episode 7).

chat captured over the 30 days

2.3 million

messages, or about 55 per minute on average.

1From video games to IRL

Born for video games, now a medium for real life

Twitch was born in 2011 for video games: you watch someone play, and comment along with them. Amazon bought it in 2014.

Then streamers started filming other things: their kitchen, their day, their travels. This is called IRL, for in real life. Nico's journey is part of it: a phone, a mobile connection, and the road.

Twitch was born in 2011 as the video games section of Justin.tv, a general-purpose livestreaming site. Amazon bought it in 2014.

Amazon's purchase of Twitch, August 2014

≈ $970M

in cash, according to the announcement at the time.

In September 2018, Twitch split its former IRL category into more specific categories, including Just Chatting and Travel & Outdoors. For a program, the category is metadata like any other: for a livestream in progress, the API returns its title, its category and its viewer count. Our machine reads these values at regular intervals.

1Clips

Clips: the audience cuts out the best moments

A livestream lasting several hours cannot be shared. A clip can: it is a short extract, from a few seconds to a minute, that viewers cut out themselves in one click, and give a title.

Every clip says “something happened here”. For us, it is a goldmine: thousands of moments chosen by humans.

A clip is an extract created by a viewer, during or after the livestream. The Get Clips API lists them by channel and by period, with their title, their creator, their view count and their position in the replay (vod_offset).

length of a clip, according to the Twitch documentation

5 to 60 s

On the project, more than 17,000 clips downloaded in 30 days.

Catch: a clip whose author does not rename it takes the title of the livestream. On our project, 38% of clips had no title of their own. Matching them to the right moment therefore takes more than their title (episode 8).

1Replays

Replays: the livestream recorded, for a while

Twitch can also record the whole livestream so that you can watch it again later: this is the replay. The chat messages are even there, scrolling by just as they did during the livestream.

But the replay only stays for a few days to a few weeks, then it is deleted. If our computer misses a moment, it has little time to catch up.

The replay (VOD, past broadcast) is the archive of the livestream, if the streamer has enabled it. The Get Videos API lists it; its replayed chat, however, is only reachable through Twitch's internal, undocumented API.

how long a replay is kept

7 to 60 days

depending on the channel's status, then it is deleted.

Our use: filling gaps in capture (network outage, machine restart). The system finds the missing ranges in its own recordings and downloads only those from the replay, as long as it exists; lost chat is recovered with a script run on demand.

1The APIs

A program can read all of this

An API is a front door designed for programs rather than for humans. Instead of displaying a page, Twitch answers precise questions: “is the livestream on?”, “which clips have been created in the last hour?”.

Our computer goes through three doors: one for information and clips, one to read the chat, one to record the video. That is what makes the whole project possible.

The project relies on three accesses:

  • Helix, the official API, with an application token (client credentials): livestream status, and the list of clips.
  • The chat over anonymous IRC, logged with its tags.
  • The video stream, recorded continuously by Streamlink, an open-source tool, in 10-minute segments named after their UTC start time.

measured on the project

≈ 7%

of clips were missing when we asked for 24 hours at once: pagination returned duplicates and lost some. We therefore query the API hour by hour, and remove the duplicates.

See the code: listing a channel's clips
import requests

CLIENT_ID, CLIENT_SECRET = "...", "..."   # created on dev.twitch.tv

jeton = requests.post("https://id.twitch.tv/oauth2/token", params={
    "client_id": CLIENT_ID,
    "client_secret": CLIENT_SECRET,
    "grant_type": "client_credentials",   # app token: no user account needed
}).json()["access_token"]

def clips(broadcaster_id: str, debut: str, fin: str) -> list[dict]:
    """Clips created between debut and fin (ISO 8601 dates in UTC). Ask for one hour at a time."""
    r = requests.get(
        "https://api.twitch.tv/helix/clips",
        headers={"Client-Id": CLIENT_ID, "Authorization": f"Bearer {jeton}"},
        params={"broadcaster_id": broadcaster_id, "started_at": debut, "ended_at": fin, "first": 100},
    )
    r.raise_for_status()
    return r.json()["data"]

1The problem

720 hours of livestream: nobody can watch it all

30 days, 24 hours a day: that makes 720 hours of video. Even a fan sees only a small part of it. Someone arriving on the twelfth day does not know what happened before.

Hence our idea: a travel log that writes itself, day after day, from what is said, what is seen and what the audience picked out.

720 hours of video, more than 2.3 million messages and more than 17,000 clips: no human can reread it all, and no language model can take it all in at once.

So we have to cut it up (into 10-minute slices), extract what matters in each source (who speaks, what is said, chat peaks, clips), and only then have a model write, and measure what it produces. That is the programme for the nine episodes that follow.

30 days × 24 hours

720 h

of livestream to follow, without a break.

1Summary

What to remember

  • On Twitch, you watch people live, unedited, all at the same time.
  • The audience writes in the chat, and the streamer replies.
  • Viewers cut the best moments into clips; replays keep everything, for a while.
  • A computer can read all of this: that is what makes our project possible.
  • RTMP ingest, HLS distribution in segments: a livestream is recorded the way a player watches it.
  • Chat over IRC (or EventSub), with rich tags: a signal that can be used without AI.
  • Clips via Helix, to be queried hour by hour; replays kept for 7 to 60 days, useful for filling gaps.
  • The volume forces us to cut up and extract before having a model write.
Episode 2 of 10 Dakar → Paris hitchhiking: 30 days live for a film

Who Nico is, why this journey, and what we wanted to do with it.

Do you want to analyse your videos, calls or meetings?

The same building blocks can summarise hours of recordings in a company. Write to me: we will look together at what is feasible.

Let's talk about your project