ossrs / srs

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181.
https://ossrs.io
MIT License
25.69k stars 5.38k forks source link

After configuring the HTTP callback, the streaming error 10053 occurred. #3244

Closed JakeWoki closed 1 year ago

JakeWoki commented 1 year ago

Configuration

# main config for srs.
# @see full.conf for detail config.

listen              1935;
max_connections     1000;
#srs_log_tank        file;
#srs_log_file        ./objs/srs.log;
daemon              on;
http_api {
    enabled         on;
    listen          1985;
}
http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}
rtc_server {
    enabled on;
    listen 8000; # UDP port
    # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
    candidate $CANDIDATE;
}
vhost __defaultVhost__ {
    hls {
        enabled         on;
    }
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
    rtc {
        enabled     on;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
        rtmp_to_rtc off;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
        rtc_to_rtmp off;
    }
    dvr {
        enabled             on;
        dvr_path            ./objs/nginx/html/[app]/[stream]/[2006]/[01]/[02]/[15].[04].[05].[999].flv;
        dvr_plan            segment;
        dvr_duration        30;
        dvr_wait_keyframe   on;
    }
    http_hooks {
        enabled         on;
        on_publish      http://127.0.0.1:19752/live/publish;
        on_unpublish    http://127.0.0.1:19752/live/unpublish;
        on_play         http://127.0.0.1:19752/live/play;
        on_stop         http://127.0.0.1:19752/live/stop;
        on_dvr          http://127.0.0.1:19752/live/dvr;
    }
}

Kotlin callback, response 0

@RestController
@RequestMapping("/live")
@Transactional
class LiveController {

    @GetMapping(value = ["/test"])
    fun test(): ResponseResult<String> {
        return ResponseResult("test")
    }

    @RequestMapping("/publish")
    fun publish(request: HttpServletRequest): Int {
        println("666666666publish")
        return 0
    }

    @RequestMapping("/unpublish")
    fun unpublish(request: HttpServletRequest): Int {
        println("666666666unpublish")
        return 0
    }

    @RequestMapping("/play")
    fun play(request: HttpServletRequest): Int {
        println("666666666play")
        return 0
    }

    @RequestMapping("/stop")
    fun stop(request: HttpServletRequest): Int {
        println("666666666stop")
        return 0
    }

    @RequestMapping("/dvr")
    fun dvr(request: HttpServletRequest): Int {
        println("666666666dvr")
        return 0
    }
}

Callback test response as follows:

GET http://192.168.71.129:19752/live/publish

HTTP/1.1 200 
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Type: application/json
Transfer-Encoding: chunked
Date: Fri, 18 Nov 2022 07:21:59 GMT
Keep-Alive: timeout=60
Connection: keep-alive

0

Response code: 200; Time: 84ms; Content length: 1 bytes

FFmpeg streaming: ffmpeg.exe -re -i inputfile.flv -c copy -f flv -y rtmp://192.168.71.129:1935/live/livestream Error:

ffmpeg version 2022-09-05-git-2ed5925e26-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.0 (Rev2, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      57. 36.101 / 57. 36.101
  libavcodec     59. 42.104 / 59. 42.104
  libavformat    59. 30.100 / 59. 30.100
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 48.100 /  8. 48.100
  libswscale      6.  8.104 /  6.  8.104
  libswresample   4.  9.100 /  4.  9.100
  libpostproc    56.  7.100 / 56.  7.100
Input #0, flv, from 'inputfile.flv':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:02:13.74, start: 0.000000, bitrate: 3370 kb/s
  Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 3728 kb/s, 25 fps, 25 tbr, 1k tbn
  Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s
Output #0, flv, to 'rtmp://192.168.71.129:1935/live/livestream':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf59.30.100
  Stream #0:0: Video: h264 (High) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 3728 kb/s, 25 fps, 25 tbr, 1k tbn
  Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
av_interleaved_write_frame(): Unknown errortime=00:00:00.00 bitrate=N/A speed=   0x
Error muxing a packet for output file #0
[flv @ 0000016d8673ea80] Failed to update header with correct duration.
[flv @ 0000016d8673ea80] Failed to update header with correct filesize.
Error writing trailer of rtmp://192.168.71.129:1935/live/livestream: Error number -10053 occurred
frame=    1 fps=0.0 q=-1.0 Lsize=       0kB time=00:00:00.06 bitrate=  61.5kbits/s speed=1.22x
video:19kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

May I know what this error is?

TRANS_BY_GPT3

JakeWoki commented 1 year ago

Okay, the callback is set to post, and the CSRF cross-domain interception is enabled.

TRANS_BY_GPT3