This gist comprises several Gstreamer send-recv examples through an RTSP server.
- Tmuxinator
apt install tmuxinator - Tmux
apt install tmux - Gstreamer fat install
apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-rtsp gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio
- Mediamtx
- Either use docker and run with
docker run(samples are written for this) - If you really cannot use docker, download the latest binary from the repo and tune the given scripts
- Either use docker and run with
Clone this gist with: git clone https://gist.github.com/pabsan-0/26407985ba3ba33d2b062247cdb89720
To run the samples:
tmuxinator start -p sample1.yml
sample2.yml
sample3.yml
sample4.yml
sample5.yml
sample6.yml
Use the autocompletion script if you like via . completion.sh.
To detach from a tmux session, press ^b then d. The samples are written so the active window will be closed on detach.
Samples:
sample1.yml: Videotest source jpeg encoded + rtp packetized.sample3.yml: Video from webcam (/dev/video0) and streamed as x264 encoded + rtp packetized.sample2.yml: Video from webcam (/dev/video0) and streamed as x265 encoded + rtp packetized. Camera read as jpeg because mine yields higher fps this way.sample4.yml: Video from camera, three separate consumers. Note the use ofsync asyncsink properties for real-time video.
CLI pipeline structure:
gst-launch-1.0 <args> <source_element> ! <cap>,<caps>,<caps> ! <element> <property> <property> <property> ! <element> ! <sink_element>
gst-inspect-1.0 <element>: See details of an elementgst-device-monitor-1.0: See details of plugged hardware- Command line helpers:
gst-launch-1.0 -v <pipe>: Verbosegst-launch-1.0 -e <pipe>: Safely handle EOS, useful when saving video to fileGST_DEBUG=5 gst-launch-1.0 <pipe>: Sets a debug level for the running gstreamer pipeline or application
queue: Besides from queueing data buffers towards time-wise buffering, opens up multiprocessing for downstream elementsdecodebin: a magic Gstreamer element that will automatically try to decode your video- Use with verbose ON to get the caps (codec, size, needed steps to decode by hand) of unknown video
- Not guaranteed to work all of the time