Skip to content

Instantly share code, notes, and snippets.

@dreness
Created June 24, 2020 05:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dreness/c2defeeceb39caec741be6dcc3a02929 to your computer and use it in GitHub Desktop.
Save dreness/c2defeeceb39caec741be6dcc3a02929 to your computer and use it in GitHub Desktop.
Low Latency HLS test: how low can you go?

local streaming test with HLS low latency tools

Install tools

https://download.developer.apple.com/Developer_Tools/HLS_Low_Latency_Beta_Tools/LowLatency_HLS_Prerelease_Tools73.dmg

Start web server

go run /usr/local/share/llhlstools/ll-hls-origin-example.go -dir /Library/WebServer/Documents -http :8000

Start mediastreamsegmenter

rm /Library/WebServer/Documents/4M/[fpc]*
mediastreamsegmenter -w 499 -t 1 224.0.0.50:9121 -s 16 -D -T -f /Library/WebServer/Documents/4M/

Find a suitable capture device

ffmpeg -f avfoundation -list_devices true -i ""

Start stream input

(in this example, specifying input device #5 for video, and no audio)

ffmpeg -f avfoundation -i "5:" -c:v h264 -fflags nobuffer -tune zerolatency -f mpegts udp://224.0.0.50:9121

Attach a client

http://localhost:8000/4M/prog_index.m3u8

errata

@dreness
Copy link
Author

dreness commented Jun 24, 2020

With this config, latency from the encoded source (local system's screen) to the client (also the local system) is ~3 seconds, as you can see by comparing the clocks in this screenshot of me viewing the stream of my own screen recording:

3 seconds

@dreness
Copy link
Author

dreness commented Jul 3, 2020

(I should mention that the above results were achieved on 10.15.4, so probably not realizing the full benefits of all the new hotness.)

@fastfading
Copy link

which client are you using ? this did not work well on mac/ios native safari.
the delay is big in safari.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment