Eyevinn / srt-whep

SRT to WHEP (WebRTC)
Apache License 2.0
80 stars 10 forks source link

Need to support different video profiles #36

Closed Wkkkkk closed 1 year ago

Wkkkkk commented 1 year ago

Some existing problems are:

Wkkkkk commented 1 year ago

To solve the problem, one possible way is to transcode the video from the SRT stream before connection. To do that, we can use commands:

## Generate a video stream of high profile
gst-launch-1.0 -v videotestsrc ! clockoverlay ! video/x-raw, height=360, width=640 ! videoconvert ! \
    x264enc tune=zerolatency ! video/x-h264, profile=high ! \
    mpegtsmux ! srtsink uri="srt://127.0.0.1:1234?mode=listener" wait-for-connection=false

## Transcode the stream into supported profile (e.g., constrained-baseline for Safari)
gst-launch-1.0 srtsrc uri="srt://127.0.0.1:1234?mode=caller" ! queue ! decodebin ! queue ! videoconvert ! \
    x264enc tune=zerolatency ! video/x-h264, profile=constrained-baseline ! \
    mpegtsmux ! srtsink uri="srt://127.0.0.1:1235?mode=listener" wait-for-connection=false

## Connect 
GST_DEBUG=1 cargo run --release -- -i 127.0.0.1:1235 -o 127.0.0.1:8888 -p 8000 -s caller | bunyan

## Play with WebRTC player, URL: 
http://localhost:8000/channel

This approach, however, does not apply to H265 video on Mac as 'x265enc' is not shipped into GStreamer SDK (on Mac).