Skip to content

Instantly share code, notes, and snippets.

@Noguai
Last active September 7, 2019 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Noguai/1adac1feb37e4342fa9f2e092418a311 to your computer and use it in GitHub Desktop.
Save Noguai/1adac1feb37e4342fa9f2e092418a311 to your computer and use it in GitHub Desktop.
HLS Webcam Streaming with FFmpeg
mkdir /tmp/hls
cd /tmp/hls
python -m SimpleHTTPServer 8900 &
ffmpeg -framerate 24 -video_size 1280x720 -input_format mjpeg -i /dev/video0 -g 12 -sc_threshold 0 -codec h264_omx -f hls -hls_time 0.5 -hls_wrap 3 stream.m3u8
<html>
<head>
<link href="https://vjs.zencdn.net/7.2.3/video-js.css" rel="stylesheet">
</head>
<body>
<video id='hls-example' class="video-js vjs-default-skin" width="400" height="300" controls>
<source type="application/x-mpegURL" src="http://octopi:8900/stream.m3u8">
</video>
<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-hls/5.14.1/videojs-contrib-hls.js"></script>
<script src="https://vjs.zencdn.net/7.2.3/video.js"></script>
<script>
var player = videojs('hls-example');
player.play();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment