Search code examples
ffmpeggstreamerhttp-live-streamingmpeg-dash

One liner to create HLS stream


IIUC with HLS or DASH, I can create a manifest and serve the segments straight from my httpd, e.g. python -m http.server.

I have a UVC video feed coming in on /dev/video1 and I'm battling to create a simple m3u8 in either gstreamer or ffmpeg.

I got as far as:

gst-launch-1.0 -e v4l2src device=/dev/video1 ! videoconvert ! x264enc ! mpegtsmux ! hlssink max-files=5

Any ideas?


Solution

    1. Video

    To list video1 device capabilities:

    ffmpeg -f v4l2 -list_formats all -i /dev/video1

    1. Audio (ALSA example)

    To list ALSA devices:

    arecord -L

    1. HLS

    Use two inputs:

     ffmpeg -f alsa -i <alsa_device> -f v4l2 -i /dev/video1 [...] /path/to/docroot/playlist.m3u8
    

    You can find the various HLS parameters in the FFmpeg documentation.

    Further reading:

    FFmpeg H.264 Encoding Guide

    FFmpeg Webcam Capture