Issues working with HLS and Electra Player

I’ve had some luck generating and playing a live stream with Electra (UE 4.27.2), overall it seems like it requires some specific settings, so, if you cannot control the generation of the stream, you may be out of luck.

To create a stream from your Webcam (command is for linux, tested on Ubuntu 20.04, your Ffmpeg input (-I and -f) will be different on Windows/Mac)

ffmpeg \
    -f v4l2 -video_size 640x480 \
    -i /dev/video0 \
    -c:v libx264 -crf 21 -preset veryfast \
    -b:v 2000k -b:a 128k \
    -f hls -hls_list_size 4  -hls_init_time 1 -hls_time 0.5 -g 0.5 \
    -vf format=yuv420p \
    -hls_flags independent_segments+delete_segments+program_date_time \
    -hls_segment_type fmp4 \
    -hls_segment_filename data%02d.m4s \
    -master_pl_name master.m3u8 out1

Now the chunks are being generated, you can create a web server using Python to make them accessible over the network by running the following in the directory where the chunks are generated:

python3 -m http.server 8080

(python3 command may not work for you, if python3 is not found try replacing it with “python” or “py”)

You can then play the stream at the following url: http://[COMPUTER_IP]:8080/master.m3u8 where [COMPUTER_IP] is your computer’s ip.

Some things I noticed about the Electra Player:

  • Chunks cannot be in .ts format and must be in mp4 (.mp4 or .m4v) format (set with -hls_segment_type fmp4 in Ffmpeg)
  • EXT-X-PROGRAM-DATE-TIME must be present for each chunk (set in -hls_flags independent_segments+delete_segments+program_date_time line, specifically program_date_time)
  • A master playlist is required
  • In addition, the stream must conform with every line in the Variant stream restrictions documentation.

Note that these tests were performed on Windows 10 and Oculus Quest 2 (Android)

4 Likes