srs WebRTC: RTC推流,transcode失败,端口错误

6uxekuva  于 2022-10-27  发布在  其他
关注(0)|答案(2)|浏览(253)

Description(描述)

使用webrtc推流,,http_server端口设置 18080,webrtc://192.168.3.33:18080/aaa?vhost=sqve1/ccc
rtmp转发的时候,rtmp地址使用的18080端口,而不是rtmp端口

  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;
    # 开启最小延迟模式
    min_latency on;
    play {
        #如果需要最小延迟,则设置为关闭;
        #如果需要客户端快速启动,则设置为on。
        gop_cache on;
        # 最大实时队列长度(秒)。
        queue_length 10;
        # atc                     on;
        # mix_correct             on;
        mw_latency      100;
        # reduce_sequence_header  on;
    }
     publish {
        mr off;
    }
    # 播放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;
    }
    # 播放flv
    http_remux {
        enabled on;
        mount [vhost]/[app]/[stream].flv;
    }
    dvr {
        enabled on;
        # 地址不能使用相对地址,否则回调的地址就是相对地址了,回调接口无法处理
        dvr_path /usr/local/srs/trunk/objs/nginx/html/dvrfile/[vhost]/[app]/[stream]/[timestamp].flv;
        dvr_plan segment;
        dvr_duration 3600; # 1时一个视频
        dvr_wait_keyframe off;
        dvr_apply all;
    }
    http_hooks {
        enabled off;

    }

    #转发 的全部转
    transcode {
        enabled     on;
        # ffmpeg      ffmpeg;
        ffmpeg      /usr/bin/ffmpeg;
        # ffmpeg      ./objs/ffmpeg/bin/ffmpeg;
        engine  { ##没有设置app,全传
            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;
    # 开启最小延迟模式
    min_latency on;
    play {
        #如果需要最小延迟,则设置为关闭;
        #如果需要客户端快速启动,则设置为on。
        gop_cache on;
        # 最大实时队列长度(秒)。
        queue_length 10;
        # atc                     on;
        # mix_correct             on;
        mw_latency      100;
        # reduce_sequence_header  on;
    }
     publish {
        mr off;
    }
    # 播放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;
    }
    # 播放flv
    http_remux {
        enabled on;
        mount [vhost]/[app]/[stream].flv;
    }
    dvr {
        enabled on;
        # 地址不能使用相对地址,否则回调的地址就是相对地址了,回调接口无法处理
        dvr_path /usr/local/srs/trunk/objs/nginx/html/dvrfile/[vhost]/[app]/[stream]/[timestamp].flv;
        dvr_plan segment;
        dvr_duration 3600; # 1时一个视频
        dvr_wait_keyframe off;
        dvr_apply all;
    }
    http_hooks {
        enabled off;
    }
}

Replay(重现)

webrtc进行推流,转发的时候rtmp转推的端口是webrtc推流的端口,而不是srs中配置的rtmp的端口

Expect(期望行为)

transcode的时候,自动识别rtmp的端口进行转发。

lndjwyie

lndjwyie1#

看起来是端口解析和匹配错误,是个Bug。

SRS的transcode是启动的FFmpeg进程,可以先自己启动FFmpeg进程绕过这个问题。

tyu7yeag

tyu7yeag2#

4.0 确实有这个问题,rtmp 推流正常 webrtc推流的时候 transcode 转推rtmp的端口味1990,这个不对

相关问题