- Download mediamtx (ready to use media server) from Releases: https://github.com/bluenviron/mediamtx/releases
- Extract mediamtx files
- Configuration settings can be modified in mediamtx.yaml file. Change the IP address to IP of the host device or localhost (Use ipconfig or ifconfig to find IP)
In MacOS:
- Intall homebrew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Inside homebrew install mediamtx brew install mediamtx
- Run mediamtx.yml /opt/homebrew/opt/mediamtx/bin/mediamtx /opt/homebrew/etc/mediamtx/mediamtx.yml
In Windows:
- Install ffmpeg. Eg: winget install ffmpeg
- To list connected devices, use ffmpeg -list_devices true -f dshow -i dummy. Note the camera name, eg: "Integrated Camera"
- Run the exe file of mediamtx
- In another terminal, run ffmpeg -f dshow -i video="<NAME_OF_CAMERA>" -c:v libx264 -preset ultrafast -b:v 2000k -f rtsp rtsp://<IP_ADDRESS>:8554/camera1/pass1
In Linux:
- Install ffmpeg. sudo apt install ffmpeg
- If required, install v4l-utils. sudo apt-get install v4l-utils
- List connected camera using v4l2-ctl --list-devices in terminal. Note the name of device eg: /dev/video0
- In a terminal, run ./mediamtx
- In another terminal, run ffmpeg -f v4l2 -i /dev/video0 -preset ultrafast -b:v 2000k -f rtsp rtsp://<IP_ADDRESS>:8554/camera1/pass1
In MacOS:
- Install ffmpeg brew install ffmpeg
- Run ffmpeg -f avfoundation -framerate 30 -video_size 1280x720 -pixel_format uyvy422 -i "default" -preset ultrafast -b:v 2000k -f rtsp rtsp://127.0.0.1:8554/camera1/pass1
- To run multiple streams, change as required eg: rtsp://<IP_ADDRESS>:8554/camera2/pass2 and so on.
- To access live video stream on VLC media player: Go to Media > Open Network Stream. Enter URL as rtsp://<IP_ADDRESS>:8554/camera1/pass1. Video should start playing after a few seconds.
- To save the video in mp4 format, run ffmpeg -i rtsp://<IP_ADDRESS>:8554/camera1/pass1 -c copy output1.mp4 on the host
- To save the stream in separate jpg images, create a folder and run ffmpeg -i rtsp://<IP_ADDRESS>:8554/camera1/pass1 -vf "fps=1" output_%03d.jpg
In MacOS:
- Open vlc —>file —>open network—>copy address :rtsp://127.0.0.1:8554/camera1/pass1
- Connect phone to RC. Open DJI app, such as DJI GO4. Check which app is compatible with the model of drone in https://www.dji.com/nl/downloads/djiapp.
- Running mediamtx starts RTMP server in the host.
- In the DJI app, go to Options (usually top right button) > Live Streaming Option > RTMP. Enter RTMP address as rtmp://<IP_ADDRESS>/dji/pass
- When the drone starts streaming, the live stream icon appears on top left and turns blue to show time elapsed. Can click and see stream parameters like fps.