pion / mediadevices

Go implementation of the MediaDevices API.
https://pion.ly/
MIT License
521 stars 120 forks source link

rtp example problems #499

Open G2G2G2G opened 1 year ago

G2G2G2G commented 1 year ago

https://github.com/pion/mediadevices/tree/master/examples/rtp

gst-launch-1.0 udpsrc port=5000 caps=application/x-rtp,encode-name=H264 \
    ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink

avdec_h264 is widely replaced by openh264 now, which would be openh264dec for gstreamer. image

Run cd mediadevices/examples/archive && go build && ./rtp localhost:5000

this is the wrong path here, it is to the archive example

example doesn't work, can't get working for mpv either

mpv -v --rtsp-transport=udp rtp://localhost:5000
gst-launch-1.0 udpsrc port=5000 caps=application/x-rtp,encode-name=H264 ! rtph264depay ! openh264dec ! videoconvert ! autovideosink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstUDPSrc:udpsrc0: Internal data stream error.
Additional debug info:
../gstreamer/subprojects/gstreamer/libs/gst/base/gstbasesrc.c(3132): gst_base_src_loop (): /GstPipeline:pipeline0/GstUDPSrc:udpsrc0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:18.567873781
Setting pipeline to NULL ...
Freeing pipeline ...
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x264 [info]: profile High, level 3.0, 4:2:0, 8-bit
panic: write udp 127.0.0.1:47689->127.0.0.1:5000: write: connection refused

goroutine 1 [running]:
main.must(...)
    /storage/1/projects/git/mediadevices/examples/rtp/main.go:22
main.main()
    /storage/1/projects/git/mediadevices/examples/rtp/main.go:73 +0x5ba

mpv hangs and unable to see data, as far as I see it isn't sending any data streams except a broken mp3 stream which isn't even listed Why is it such a different code than the https://github.com/pion/mediadevices/blob/master/examples/webrtc/main.go#L86 GetVideoTracks vs GetTracks aren't both sending a stream video? are there any rtp or webrtc that just works out of the box? only one that seems to automatically work without 3rd party requirements is https://github.com/pion/mediadevices/tree/master/examples/http and streaming jpegs is 1990s