Skip to content

Instantly share code, notes, and snippets.

View ericxtang's full-sized avatar

Eric Tang ericxtang

View GitHub Profile

0x1c239caedb281f6784fe2a43cb90c02c4cf777d4bc65f923027418d27da9d04c

@ericxtang
ericxtang / clipping.md
Last active November 15, 2021 20:33
Clipping a live stream with Livepeer

Clipping with Livepeer

Clipping in Livepeer is currently possible, but not yet a well-packaged feature. In order to create a clip, you need to:

1. Turn on recording

Make sure recording is turned on for the stream. Follow this API guide.

2. Ingest into a specific region

@ericxtang
ericxtang / loop.md
Last active August 27, 2021 01:57
Looping one or multiple VoD files into a never ending live stream. Using Livepeer as an example.

Looping VoD

This is a quick tutorial for looping a VoD file as a live stream, using ffmpeg.

Step 1: convert source video to .ts file

In order to loop a video file, you need to convert it into the .ts format. Use this command:

ffmpeg -i input.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts output.ts

Step 2: Loop the .ts video with ffmpeg

Hosting the Community Grants Orchestrator

The community grants orchestrator switched from using a cloud-hosted CPU node to a GPU-based CherryServer node on 12/27/2020.

As a result, the transcoding performance according to the leader board has increased from 15% success rate to over 99% success rate.

We want to share the exact steps we took for the migration.

Step1: Provisioning a CherryServer GPU Machine

<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<link href="https://vjs.zencdn.net/7.8.4/video-js.css" rel="stylesheet" />
<style>
.noSrc {
width: 100%;
height: 100%;
Dec 15 04:27:22 lon-prod-livepeer-broadcaster-2aiqy-99996488f-bgxr7 broadcaster: I1215 12:27:20.314051 1 mediaserver.go:732] Got push request at url=http://lon.livepeer.com/live/af09f6dc-2cfc-413e-91a8-1663aa37356f/1035.ts ua=MistServer/2.18.1-Pro-149-ga73cf844 addr=10.42.0.32:35522 bytes=338776 dur=1400 resolution=1280x720
Dec 15 04:27:22 lon-prod-livepeer-broadcaster-2aiqy-99996488f-bgxr7 broadcaster: I1215 12:27:20.314293 1 broadcast.go:291] Processing segment nonce=5794281187762175624 manifestID=af09f6dc-2cfc-413e-91a8-1663aa37356f seqNo=1035 dur=1.4 bytes=338776
Dec 15 04:27:22 lon-prod-livepeer-broadcaster-2aiqy-99996488f-bgxr7 broadcaster: I1215 12:27:20.314483 1 census.go:925] Logging SourceSegmentAppeared... nonce=5794281187762175624 manifestID=af09f6dc-2cfc-413e-91a8-1663aa37356f seqNo=1035 profile=source
Dec 15 04:27:22 lon-prod-livepeer-broadcaster-2aiqy-99996488f-bgxr7 broadcaster: I1215 12:27:20.320161 1 segment_rpc.go:427] Submitting segment nonce=5794281187762175624 man
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<link href="https://vjs.zencdn.net/7.8.4/video-js.css" rel="stylesheet" />
<style>
.noSrc {
width: 100%;
height: 100%;
Dec 13 12:56:14 rkv-prod-livepeer-broadcaster-6emu-6d7dc44d9d-6rbc7 broadcaster: I1213 20:56:13.114815 1 mediaserver.go:725] Got push request at url=http://rkv.livepeer.com/live/e329dc10-2f8b-4bb2-bac3-c2a529bff4e8/1966.ts ua=MistServer/2.18.1-Pro-149-ga73cf844 addr=10.42.2.84:40692 bytes=646720 dur=2000 resolution=852x480
Dec 13 12:56:14 rkv-prod-livepeer-broadcaster-6emu-6d7dc44d9d-6rbc7 broadcaster: I1213 20:56:13.114959 1 broadcast.go:291] Processing segment nonce=7657608123603856826 manifestID=e329dc10-2f8b-4bb2-bac3-c2a529bff4e8 seqNo=1966 dur=2 bytes=646720
Dec 13 12:56:14 rkv-prod-livepeer-broadcaster-6emu-6d7dc44d9d-6rbc7 broadcaster: I1213 20:56:13.115140 1 census.go:923] Logging SourceSegmentAppeared... nonce=7657608123603856826 manifestID=e329dc10-2f8b-4bb2-bac3-c2a529bff4e8 seqNo=1966 profile=source
Dec 13 12:56:14 rkv-prod-livepeer-broadcaster-6emu-6d7dc44d9d-6rbc7 broadcaster: I1213 20:56:13.120691 1 segment_rpc.go:427] Submitting segment nonce=7657608123603856826 manife
<html>
<head>
<title>Hls.js primary / backup switch demo</title>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/hls.js/0.14.16/hls.js"></script>
Nov 11 19:23:31 mdw-prod-mist-server-0 mist: [2020-11-12 03:23:30] MistProcLivepeer:e0ebw4qldvlofow5→e0ebw4qldvlofow5 (17989) FAIL: Post to https://iad.livepeer.com/live/e0eb4a05-2c2e-4ccc-9c23-f62a7bb722a9/50.ts timed out after 385.78 ms (10.22 ms upload, 226.45 ms wait, 149.12 ms download)
Nov 11 19:23:31 mdw-prod-mist-server-0 mist: [2020-11-12 03:23:30] MistProcLivepeer:e0ebw4qldvlofow5→e0ebw4qldvlofow5 (17989) FAIL: Failed to upload segment https://iad.livepeer.com/live/e0eb4a05-2c2e-4ccc-9c23-f62a7bb722a9/50.ts, picking new broadcaster
Nov 11 19:23:31 mdw-prod-mist-server-0 mist: [2020-11-12 03:23:30] MistProcLivepeer:e0ebw4qldvlofow5→e0ebw4qldvlofow5 (17989) WARN: Switched to broadcaster: https://ord.livepeer.com
Nov 11 19:23:31 mdw-prod-mist-server-0 mist: [2020-11-12 03:23:30] MistProcLivepeer:e0ebw4qldvlofow5→e0ebw4qldvlofow5 (17989) MEDIUM: Uploaded 285196 bytes (time 220999-221699 = 700 ms) to https://iad.livepeer.com/live/e0eb4a05-2c2e-4ccc-9c23-f62a7bb722a9/50.ts in 386.21 ms
Nov 11 19:23:31 mdw