Skip to content

WebRTC: Transcode port is invalid for RTC publisher. Failed to transcode RTC stream, port error. #3144

@ziyue7575

Description

@ziyue7575

Description

Using webrtc for streaming, set the http_server port to 18080, webrtc://192.168.3.33:18080/aaa?vhost=sqve1/ccc
When forwarding rtmp, use port 18080 for the rtmp address instead of the rtmp port.

  1. SRS Version: xxxxxx

  2. SRS Log:

ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[tcp @ 0x55f529e3dac0] Connection to tcp://127.0.0.1:18080 failed: Connection refused
[rtmp @ 0x55f529e3d180] Cannot open connection tcp://127.0.0.1:18080
rtmp://127.0.0.1:18080/aaa?vhost=sqve1/ccc: Connection refused

  1. SRS Config:
vhost save1 {
    tcp_nodelay on;
    # Enable minimum latency mode
    min_latency on;
    play {
        # If minimum latency is required, set it to off;
        # If fast client startup is required, set it to on.
        gop_cache on;
        # Maximum real-time queue length (in seconds).
        queue_length 10;
        # atc                     on;
        # mix_correct             on;
        mw_latency      100;
        # reduce_sequence_header  on;
    }
     publish {
        mr off;
    }
    # Play webrtc
    rtc {
        enabled     on;
        rtmp_to_rtc on;
        rtc_to_rtmp on;
        stun_timeout 5;
        stun_strict_check on;
        nack on;
        twcc on;
         pli_for_rtmp 0.5;
    }
    # Play flv
    http_remux {
        enabled on;
        mount [vhost]/[app]/[stream].flv;
    }
    dvr {
        enabled on;
        # The address cannot use relative address, otherwise the callback address will also be a relative address, and the callback interface cannot handle it.
        dvr_path /usr/local/srs/trunk/objs/nginx/html/dvrfile/[vhost]/[app]/[stream]/[timestamp].flv;
        dvr_plan segment;
        dvr_duration 3600; # 1 hour per video
        dvr_wait_keyframe off;
        dvr_apply all;
    }
    http_hooks {
        enabled off;
    
      
    }

    # Forward all forwarding
    transcode {
        enabled     on;
        # ffmpeg      ffmpeg;
        ffmpeg      /usr/bin/ffmpeg;
        # ffmpeg      ./objs/ffmpeg/bin/ffmpeg;
    engine { ## No app set, pass all
            enabled         on;
            perfile {
                re;
                rtsp_transport tcp;
            }
             iformat         off;
            vcodec          copy;
            vfps            25;
            acodec          copy;
            # acodec          libfdk_aac;
            # aparams {
            # }
            output          rtmp://127.0.0.1:1935/[app]?vhost=save2/[stream];
        }
    }
}
vhost save2 {
    tcp_nodelay on;
    # Enable minimum latency mode
    min_latency on;
    play {
        # If minimum latency is required, set it to off;
        # If fast client startup is required, set it to on.
        gop_cache on;
        # Maximum real-time queue length (in seconds).
        queue_length 10;
        # atc                     on;
        # mix_correct             on;
        mw_latency      100;
        # reduce_sequence_header  on;
    }
     publish {
        mr off;
    }
    # Play webrtc
    rtc {
        enabled     on;
        rtmp_to_rtc on;
        rtc_to_rtmp on;
        stun_timeout 5;
        stun_strict_check on;
        nack on;
        twcc on;
         pli_for_rtmp 0.5;
    }
    # Play flv
    http_remux {
        enabled on;
        mount [vhost]/[app]/[stream].flv;
    }
    dvr {
        enabled on;
        # The address cannot use relative address, otherwise the callback address will also be a relative address, and the callback interface cannot handle it.
        dvr_path /usr/local/srs/trunk/objs/nginx/html/dvrfile/[vhost]/[app]/[stream]/[timestamp].flv;
        dvr_plan segment;
        dvr_duration 3600; # 1 hour per video
        dvr_wait_keyframe off;
        dvr_apply all;
    }
    http_hooks {
        enabled off;
    }
}

Replay (重现)

When using WebRTC for streaming, the port used for forwarding the stream is the same as the one used for WebRTC streaming, rather than the RTMP port configured in SRS.

Expect (Desired Behavior)
When transcoding, automatically detect the RTMP port for forwarding.

TRANS_BY_GPT3

Metadata

Metadata

Assignees

Labels

TransByAITranslated by AI/GPT.WebRTCWebRTC, RTC2RTMP or RTMP2RTC.good first issueEasy to fix issues, good for newcomershelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions