In this tutorial, we will set up an RTMP server and stream a movie trailer locally using ffmpeg to stream an MP4 file. Then, we will use VLC to connect to the stream and watch the trailer.
Prerequisites:
- Download Docker
- VLC Media player
- Open command terminals
- video file
Run the RTMP server locally
docker pull alfg/nginx-rtmp
docker run -it -p 1935:1935 -p 8080:80 --rm alfg/nginx-rtmp

References:
Send video stream to RTMP server to tmp://127.0.0.1:1935/stream/<anything>
# Send data to streaming server
ffmpeg -re -i video.mp4 -r 30 -c:v libx264 -x264-params keyint=60:scenecut=0 -preset fast -b:v 5M -maxrate 6M -bufsize 3M -threads 4 -f flv rtmp://127.0.0.1:1935/stream/app

Test the stream with VLC Media Player
File -> Open network and paste this url rtmp://127.0.0.1:1935/stream/app

During my research, I discovered that RTMP cannot be read directly from HTML. For that reason, we need to use HLS to read the stream from html. HLS stands for HTTP Live Streaming.
You can access an example page directly from this link http://localhost:8080/players/hls_hlsjs.html

Early in my career, I specialized in the Python language. Python has been a constant in my professional life for over 10 years now. In 2018, I moved to London where I worked at companies of various sizes as a Python developer for five years. In parallel, I developed my activity as a Mentor, to which I now dedicate myself full-time.