obs-gstreamer

obs-gstreamer 0.4.1

Burgs

New Member
OK I guess I have an additional question...I'm not sure where to place the Gstreamer pipeline code in order to feed it into OBS? I gather it must be used as a 'source'. Inspection of the 'source' panel in OBS leads me to believe perhaps I would need to select the 'Media Source' tab...and then paste the Gstreamer pipeline code into there (under 'add existing')...? Or perhaps the 'text (GDI)' selection...?
Is it also necessary to open up a console and type the Gstreamer pipeline there as well, as if running Gstreamer in a 'standalone' mode...or is that not necessary in this case (as perhaps OBS serves as an 'emulator')? I thank you in advance for any suggestions. Regards.
 

Tuna

Member
The plugin should show in the sources as "GStreamer source". It will only do so if the installation is successful. That means the plugin is installed and the GStreamer SDK is installed. This varies from platform to platform (the documentation on how to do that is lacking). If you have figured that out you will set the pipeline in its property page.

See https://github.com/fzwoch/obs-gstreamer/issues/3 for an Image of the plugin properties.

https://github.com/fzwoch/obs-gstreamer/issues/13#issuecomment-464958004 in brief tells how to install on Windows.
 
Last edited:

sebastinus

New Member
Hello everybody,

First of all many thanks to Tuna for developing this plugin, I hope it will solve my issues when recording rtsp-streams over a longer period of time (2-3 hours) without getting errors.

Recording rtsp-streams by selecting the mediasoucre of obs, isnt´t working properly.
But I have a problem to get the rtsp-stream working with the gstreamer-plugin. Maybe there is somebody out there, who could give me a hint why.

The gstreamer command which is working via the commandline would be this:

gst-launch-1.0 -e rtspsrc location=rtsp://10.200.7.130/axis-media/media.amp protocols=udp ! rtph264depay ! h264parse ! mp4mux ! filesink location=test.mp4

In the github readme-file of the plugin is an example for a rtsp-stream included:

uridecodebin uri=rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov name=bin ! queue ! video. bin. ! queue ! audio.

This is not working for me in obs and my idea of getting my commad working would be:

uridecodebin uri=rtsp://10.200.7.130/axis-media/media.amp name=bin ! queue ! video. bin. ! queue ! audio.

Sadly, this is also not working.

Any help is welcome, maybe somebody could post his working rtsp-command for the gstreamer-plugin.

thanks in advance for your help,
sebastinus
 

Tuna

Member
Hi,

1) The RTSP stream URL may have changed or is currently down? Even with gst-play-1.0 I could not get to play at the moment.

2) Do these Axis cameras provide audio? You are connecting the audio path too which you haven't in your working example. When you also connect the audio path it may actually expect and wait for it indefinitely. Try removing it.

> uridecodebin uri=rtsp://10.200.7.130/axis-media/media.amp name=bin ! queue ! video.

3) Make sure you actually have a H.264 decoder installed. Try "gst-play-1.0 rtsp://10.200.7.130/axis-media/media.amp". The ffmpeg decoders for GStreamer usually are in an extra package names "gstreamer1.0-libav" or similar.

4) Start OBS from a terminal like "GST_DEBUG=3 obs" and you will get some more messages on the console on what may be wrong.
 

adalbert

New Member
Hello,

i already have a working setup with Raspberry Pi 4 (+ USB3 HDMI capture card) transmitter and VLC Video Source (OBS) receiver. It provides good quality and smooth video, but there is over 1 second of latency, which is not constant, even though i am using UDP protocol. So i would like to replace VLC Video Source with GStreamer source, but i have some problems.

My current, known good setup:
RPi 4 transmitter:
gst-launch-1.0 -vv -e v4l2src device=/dev/video0 ! videoconvert ! "video/x-raw,width=1280,height=720,framerate=60/1" ! omxh264enc target-bitrate=2000000 control-rate=1 ! "video/x-h264,profile=high" ! h264parse ! queue max-size-bytes=10000000 ! mpegtsmux ! rtpmp2tpay ! udpsink host=192.168.1.230 port=5000

OBS VLC Video Source:
Playlist: rtp://@:5000
Network Caching: 100ms


Media Source also works: udp://0.0.0.0:5000

I like that setup because it always resumes the connection when it's interrupted, even after I reboot the RPi or turn the wifi off/on. I would like to achieve the same result, but with lower latency, ideally with a constant latency.

I tried this command with GStreamer source in OBS:
udpsrc port=5000 ! rtpmp2tdepay ! tsdemux ! h264parse ! decodebin ! video.

But it doesn't output anything. Tried various other commands, but with no success. I only managed it to work with TCP connection on both sides, but that causes latency problems. I would really appreciate any help on this issue.

----
BTW currently i am having good results with a small workaround... Game Capture source, capturing output of mpv player running in background with such parameters:

mpv --no-cache --untimed --no-demuxer-thread --no-border --window-scale=1 --keepaspect --no-window-dragging --video-unscaled=yes --video-sync=audio --no-osc --vd-lavc-threads=1 udp://0.0.0.0:5000
 
Last edited:

Tuna

Member
You wrap an MPEG TS stream into RTP.

1. You should be able to remove the RTP layer completely and send MPEG TS over UDP. (RTP may be a good idea if you want to use RTP specific features like re-sending packets etc. which your current example does not)

2. If you use RTP you need to tell the receiving side some more info - which is usually transferred via SDP:

udpsrc port=5000 ! application/x-rtp, clock-rate=90000, encoding-name=MP2T-ES ! rtpmp2tdepay ! ..

Or something similar (just came up with that from memory)
 

adalbert

New Member
Thanks for the suggestion, I tried that pipeline, i also tried various other modification, but had no success. Anyway i found obs-gstreamer useful, because the way I work now is to run two separate gstreamer instances on Raspberry Pi: first one transmits the video only, and second one transmits PCM audio over UDP. I can receive the video with Game Source + screencap of MPV player, and receive audio only in OBS Gstreamer Source without problems.

audio transmit with RPi:
gst-launch-1.0 -v alsasrc "device=hw:1,0" ! audioconvert ! rtpL24pay ! udpsink host=192.168.4.9 port=6000
OBS: udpsrc uri=udp://0.0.0.0:6000 caps="application/x-rtp,channels=(int)2,format=(string)S16LE,media=(string)audio,payload=(int)96,clock-rate=(int)44100,encoding-name=(string)L24" ! rtpL24depay ! audioconvert ! audioresample ! audio.

By the way MPV allows me to save raw copy of the UDP video stream in .ts container.
 
Last edited:

adalbert

New Member
Hello, I've been doing some exercises with gstreamer recently to understand it better, I found out that bad-plugins package wasn't installed and I didn't have tsdemux. Now the video works fine with this pipeline:

Receiver (OBS):
udpsrc port=5000 caps=application/x-rtp ! rtpjitterbuffer latency=50 ! rtpmp2tdepay ! tsdemux ! h264parse ! avdec_h264 ! videoconvert ! video.

Transmitter:
gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! videorate ! "video/x-raw,width=1280,height=720,framerate=60/1" ! omxh264enc target-bitrate=5000000 control-rate=1 periodicty-idr=15 ! "video/x-h264,profile=high" ! mpegtsmux ! rtpmp2tpay ! udpsink host=192.168.0.1 port=5000 sync=true


With parameters: unchecked Use pipeline time stamps, unchecked Sync appsinks to clock I have very low latency, around 100msec.
But there is a problem: video is not buttery smooth - I am transmitting 60 fps, but it feels like 20-30 fps in OBS.

I can fix stuttering video by checking the option: Sync appsinks to clock. I am getting perfect 60fps then, but there is a second or two of delay added.

I also noticed some weird behavior with Use pipeline time stamps checked. Video plays smooth with fairly low latency, but every ~8 seconds it skips half a second of video (it looks like the video is playing a tiny bit too slow and resynchronizing every x seconds).

Do you know if it is possible to keep both the low latency and stutter-free video?

---update:
udpsrc port=5000 caps=application/x-rtp ! rtpjitterbuffer latency=20 ! rtpmp2tdepay ! tsdemux ! h264parse ! avdec_h264 ! videoconvert ! videorate ! video/x-raw,framerate=60/1 ! video.

This and Use pipeline time stamps checked causes latency of 200 to 500ms (it is different every time you restart the pipeline), but outputs smooth video. Ideally the latency should stay consistent.
 
Last edited:

Tuna

Member
Latency and smoothness is a general video codec / transmission thing. I recommend to read something on VBV buffer model to understand why things happen in certain ways and why it requires some manual tuning depending on your use case for optimal results.
 

Tuna

Member
Tuna updated obs-gstreamer with a new update entry:

v0.1.0

- added encoder plugin (experimental)

This is high experimental as it is not yet well tested. Basically this update adds an encoder plugin to OBS. That means you can make use of GStreamer supported H.264 encoders for streaming and recording.

Upon loading the plugin queries installed video encoders - so supported codecs depend on your system and GStreamer installation.

Currently available are x264, NVENC, OpenMAX (Tegra), OpenMAX (RaspberryPi), VA-API and VTENC (Apple hardware). Some of...

Read the rest of this update entry...
 

Farango

New Member
Hello everyone !

I tried for 2 hours to install the plugin in OBS Studio but i can't manage to have the "gstream" source.

I've installed gstream 1.0 and have tried to put the "obs-gstreamer.dll" everywhere, without success.

What Am i suppose to do to make it appear ?

Thanks for the help!
 

Tuna

Member
My bet is on that you need to add the directory of the GStreamer binaries to you $PATH variable. I don't think the GStreamer installer is doing that for you.
 

ancer

New Member
Hello and thank you for very useful plugin.

I'm consuming RTMP source and it works for video without any problem. But I have problems with audio.

rtmpsrc location="rtmp://---:1935/obs/wbc live=1" ! decodebin name=src src. ! audioconvert ! audio. src. ! videoconvert ! video.

I have both video and audio. But audio is incorrectly sampled. I hear high pitch voice instead of normal.

If instead of "audio." I use "directsoundsink" the sound is as expected. But in this case obs-gstreamer produces audio directly to output and OBS cannot control that audio source.

Please help what I need additionally to tell obs-gstreamer so it generates audio correctly.

Thanks in advance.
 

Tuna

Member
Maybe you can save the audio into .wav file to check tthe audio properties. Perhaps open a github issue in that case. This sounds like a bug where I send wrong audio propertied to OBS.
 

Farango

New Member
My bet is on that you need to add the directory of the GStreamer binaries to you $PATH variable. I don't think the GStreamer installer is doing that for you.
Gstream variables are already installed in PATH.
 

Attachments

  • caraible.png
    caraible.png
    4.5 KB · Views: 195

gmesmer

New Member
Hello, I'm using the gstreamer plugin as both a source and as an encoder using the OpenMAX(Tegra). Could anyone explain what the extra encoder options are? I'm wordering if its possible to change between h264 and h265 for the future.
 
Top