Tutorials
Test Your Stream

Test Your Stream

A quick guide to test your RTMP stream setup.

Quick Test with FFmpeg

Step 1: Generate Ingress

curl -X POST https://live-api.block8910.com/api/ingress/generate \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{"roomName": "test-room", "participantName": "Test Stream"}'

Step 2: Create Test Video (Optional)

If you don't have a video file, create a test pattern:

ffmpeg -f lavfi -i testsrc=size=1280x720:rate=30:duration=60 \
  -f lavfi -i sine=frequency=1000:sample_rate=48000:duration=60 \
  -c:v libx264 -preset fast -b:v 2000k \
  -c:a aac -b:a 128k \
  -y test-video.mp4

Step 3: Stream to RTMP

Using the rtmpUrl from Step 1:

ffmpeg -re -i test-video.mp4 \
  -c:v libx264 -preset veryfast -b:v 2000k \
  -c:a aac -b:a 128k \
  -f flv "rtmp://rtmp.block8910.com:1935/x/YOUR_STREAM_KEY"

Test Stream Script

Save this as test-stream.sh:

#!/bin/bash
 
API_KEY="YOUR_API_KEY"
API_URL="https://live-api.block8910.com"
 
echo "Creating ingress..."
RESPONSE=$(curl -s -X POST "$API_URL/api/ingress/generate" \
  -H "Content-Type: application/json" \
  -H "x-api-key: $API_KEY" \
  -d '{"roomName": "test-stream", "participantName": "Test"}')
 
RTMP_URL=$(echo $RESPONSE | grep -o '"rtmpUrl":"[^"]*"' | cut -d'"' -f4)
INGRESS_ID=$(echo $RESPONSE | grep -o '"ingressId":"[^"]*"' | cut -d'"' -f4)
 
echo "RTMP URL: $RTMP_URL"
echo "Ingress ID: $INGRESS_ID"
echo ""
echo "Starting test stream (Ctrl+C to stop)..."
 
# Stream test pattern
ffmpeg -f lavfi -i testsrc=size=1280x720:rate=30 \
  -f lavfi -i sine=frequency=440:sample_rate=48000 \
  -c:v libx264 -preset veryfast -b:v 2000k \
  -c:a aac -b:a 128k \
  -f flv "$RTMP_URL"
 
echo ""
echo "Cleaning up..."
curl -s -X DELETE "$API_URL/api/ingress/$INGRESS_ID" \
  -H "x-api-key: $API_KEY"
echo "Done!"

Run it:

chmod +x test-stream.sh
./test-stream.sh

Verify Stream Status

Check Ingress Status

curl -X GET "https://live-api.block8910.com/api/ingress" \
  -H "x-api-key: YOUR_API_KEY" | jq

Expected response when streaming:

{
  "success": true,
  "data": [
    {
      "ingressId": "IN_xxx",
      "state": {
        "status": "ENDPOINT_PUBLISHING",
        "startedAt": "2024-01-01T00:00:00Z"
      }
    }
  ]
}

Status Values

StatusMeaning
ENDPOINT_INACTIVECreated but not streaming
ENDPOINT_BUFFERINGConnecting/buffering
ENDPOINT_PUBLISHINGActively streaming
ENDPOINT_ERRORStream error

Common Test Scenarios

Test Video Loop

Stream a video in a loop for extended testing:

ffmpeg -stream_loop -1 -re -i example.mp4 \
  -c:v libx264 -preset veryfast -b:v 2000k \
  -c:a aac -b:a 128k \
  -f flv "rtmp://rtmp.block8910.com:1935/x/YOUR_STREAM_KEY"

Test Different Bitrates

Low bitrate (1 Mbps):

ffmpeg -re -i example.mp4 -c:v libx264 -b:v 1000k -c:a aac -b:a 64k \
  -f flv "rtmp://rtmp.block8910.com:1935/x/YOUR_STREAM_KEY"

High bitrate (5 Mbps):

ffmpeg -re -i example.mp4 -c:v libx264 -b:v 5000k -c:a aac -b:a 192k \
  -f flv "rtmp://rtmp.block8910.com:1935/x/YOUR_STREAM_KEY"

Cleanup

Don't forget to delete the ingress when done testing:

curl -X DELETE "https://live-api.block8910.com/api/ingress/IN_xxxxx" \
  -H "x-api-key: YOUR_API_KEY"