gaetanlhf / rtp2webrtc

A low latency WebRTC server in the form of a simple API for broadcasting RTP streams
GNU General Public License v3.0
1 stars 0 forks source link

Absence of the output stream #1

Open Gesterezi opened 3 months ago

Gesterezi commented 3 months ago

Hello!

I tried your tool (setting up a WebRTC server is quite challenging when you're a rookie in this field, so your repo is very helpful). However, I’m not sure what I’m doing wrong. I launched your application with the example configuration.

# IP on which rtp2webrtc should be reachable
serve-ip: 127.0.0.1
# Port on which rtp2webrtc should be reachable
serve-port: 8080
# IP of the device sending the RTP streams
rtp-host: 127.0.0.1
# If you want to retrieve a video stream (true/false)
enable-video: true
# If you want to retrieve an audio stream (true/false)
enable-audio: false
# Port on which the video stream is to be received
rtp-video-port: 9903
# Port on which the audio stream is to be received
rtp-audio-port: 9904
# Video track name
video-track-name: default
# Video track name
audio-track-name: default
# Video codec (must be the same as the video RTP stream, either video/H264 or video/VP8)
video-codec: video/H264
# Audio codec (must be the same as the audio RTP stream, audio/opus)
audio-codec: audio/opus
# A list of ICE servers that can be used for the server
ice-servers:
  - ice-server: stun:stun.l.google.com:19302
# Customisable API endpoint
api-location: /rtp2webrtc/api/v1/offer
# To enable support for cross origin requests (for testing purposes for example)
allow-cross-origin: false.

I ran your app with only video mode (video + audio also does't work):

2024/08/18 02:10:47 Starting rtp2webrtc  build on 2024-08-18T01:28:52+0400
2024/08/18 02:10:47 Loading configuration file located at ./config.yaml
2024/08/18 02:10:47 Serving API on 127.0.0.1:8080
2024/08/18 02:10:47 Listening for UDP RTP packets (video) on 127.0.0.1:9903

I also started a fake stream using this command:

ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 -vcodec libx264 -f rtp rtp://127.0.0.1:9903

I can see that your tool receives the stream, but when I check the output on port 8080, the page is blank:

Снимок экрана 2024-08-18 в 02 07 44

The output of your logs is also blank:

Снимок экрана 2024-08-18 в 02 08 31

Do I need any additional dependencies? I tried it on my MacOS and Ubuntu server

Thank you!

gaetanlhf commented 1 month ago

Hello @Gesterezi 👋

I apologize for the delay in replying to your issue. I've been very busy lately... 😅

Setting up a WebRTC server is complex, especially as there aren't many ready-to-use resources available...

The problem you're having is that you can't directly access the data sent by rtp2webrtc using your browser. You have to set up a web page, with the necessary JavaScript to retrieve the WebRTC feeds. You'll find an example here: https://github.com/gaetanlhf/rtp2webrtc?tab=readme-ov-file#usage What you'll get in your browser with your fake stream from ffmpeg : image If you're having trouble with CORS, I'd advise you to set up a reverse proxy, as in the example.

Don't hesitate to reply if you have a question, a problem, or if it works! 😄