Skip to content

Add your first channel and watch it ​

In this tutorial you add a live channel in the panel, test its source, give a client line access to it, and watch it in VLC.

You need the server from Install your first server, with its node showing in Nodes.

1. Start a test source ​

You need something to stream. Bitstream ships a legal test source: a moving test pattern with a tone, made by ffmpeg. On the server, in its own terminal, run:

bash
/opt/bitstream/bin/bs-node dev-source -listen 127.0.0.1:9000 \
  -ffmpeg /opt/bitstream/ffmpeg/latest/bin/ffmpeg

It prints dev source on http://127.0.0.1:9000/stream.ts. Leave it running.

In real life the source is the URL your provider or encoder gives you. Never use TV channels you do not have the rights to, not even for a test.

2. Add the channel ​

In the panel, open Live streams and click Add channel. The form has a few sections. Fill in:

  • Basics. Name: Test channel. Leave Category empty for now. Apps show categories as groups, and you can add them later under Categories.
  • Sources. Stream URL: http://127.0.0.1:9000/stream.ts. The first source is the main one. More sources are fallbacks, tried in order.
  • Delivery mode. Keep FFmpeg. It runs ffmpeg in copy mode and never re-encodes. LLOD reads HTTP MPEG-TS sources without ffmpeg, and Direct sends clients straight to the source.
  • On demand. Start only when someone watches is on by default. The channel starts when the first viewer arrives and stops 60 seconds after the last one leaves (Stop after (seconds)). See On-demand channels.
  • Servers. Your node is already checked under Run on, because it is the only one.

Click Create channel.

3. Test the source ​

On the channel page, click Test next to the source. The node runs ffprobe on it. After a few seconds you see the video (h264, 1280x720), the audio (aac) and the time it took to open. If the test fails, the source is not reachable from the node. Fix that first.

If the panel says no server is online, go back to Nodes and check that your node is connected.

4. Put the channel in a bouquet ​

A client line only sees what is in its bouquets. A bouquet is a pack of channels, like "Sports" or "Kids".

  1. Open Bouquets and click Create bouquet. Name it Test.
  2. On the Live tab, use Add one to pick Test channel.
  3. Save.

5. Make a package and a line ​

A line (one client account) is always created from a package.

  1. Open Packages and click New package. Name it 1 month, 1 screen. Set Lasts to 1 month, Cost in credits to 1 and Screens at the same time to 1. Under Channel bouquets, check Test. Under Who can sell it, check Resellers. Click Create package.
  2. Open Lines and click New line. Pick the plan you just made. Bitstream makes up the username and password. Click Create line.

The access dialog opens with the server, username and password. Keep it open.

6. Watch it ​

Open VLC, choose Media, Open Network Stream, and type this address with the values from the access dialog:

http://203.0.113.10:8080/live/<username>/<password>/<id>.ts

Use your server address, and the channel id from the address bar of the channel page (/streams/1 means 1). The test pattern appears after a second or two. That is on-demand at work: the node started ffmpeg when VLC connected. Use .m3u8 instead of .ts for HLS.

Close VLC and wait a minute. In Live streams the channel goes back to grey Idle.

Testing with curl

Viewers usually get a 302 redirect to the node, at /s/<token>/stream.ts. VLC follows it. With curl, add -L, or you only get a short "Found" page:

bash
curl -sL -o /dev/null -w '%{http_code} %{size_download}\n' --max-time 5 \
  http://203.0.113.10:8080/live/<username>/<password>/<id>.ts

The node on the control machine uses the proxy delivery mode, so it streams through the panel address with no redirect. -L does no harm there.

Automate it ​

Everything above goes through the admin API, so you can script it. You need curl and jq on your computer (sudo apt install jq on Ubuntu or Debian). Sign in and keep the access token:

bash
PANEL=http://203.0.113.10:8080/api/v1
TOKEN=$(curl -s -X POST $PANEL/auth/login \
  -H 'Content-Type: application/json' \
  -d '{"username":"admin","password":"your password"}' | jq -r .access_token)

The token is valid for 15 minutes. Then create the channel. node_ids puts it on your node (it is 1 on a fresh install). The API leaves on_demand off unless you send it, while the panel form turns it on:

bash
curl -s -X POST $PANEL/streams \
  -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
  -d '{
    "name": "Test channel",
    "mode": "ffmpeg",
    "on_demand": true,
    "node_ids": [1],
    "sources": [{"url": "http://127.0.0.1:9000/stream.ts"}]
  }' | jq '{id, name}'

Bouquets, packages and lines have their own endpoints (POST /bouquets, POST /packages, POST /lines). All of them are in the admin API reference.

What you learned ​

  • Every channel has an ordered list of sources, a delivery mode and the servers it runs on.
  • On-demand channels cost nothing while nobody watches.
  • A line sees only the channels in its bouquets, and gets them through a package.

Next ​

Become a reseller: create and send a client.

Bitstream documentation