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.84k stars 5.39k forks source link

ingree config ffmpeg rtsp_transport tcp cause the exec ffmpeg cli log part has error, and cause whole cli failed #4137

Closed jiangxizhanzhi closed 3 months ago

jiangxizhanzhi commented 3 months ago

!!! Before submitting a new bug report, please ensure you have searched for any existing bugs and utilized the Ask AI feature at https://ossrs.io or https://ossrs.net (for users in China). Duplicate issues or questions that are overly simple or already addressed in the documentation will be removed without any response.

Describe the bug A clear and concise description of what the bug is.

  1. this is the log ffmpeg-ingest-defaultVhost-live-camera_1.log main content。

    process binary=./objs/ffmpeg/bin/ffmpeg -rtsp_transport tcp, cli: ./objs/ffmpeg/bin/ffmpeg -rtsp_transport tcp -loglevel info -re -i rtsp://admin:Xctfoj01@10.100.27.1:6000/h264/ch1/main/ -vcodec copy -acodec copy -f flv -y rtmp://10.100.27.1:1935/live/camera_1 1 > ./objs/ffmpeg-ingest-__defaultVhost__-live-camera_1.log 2 > ./objs/ffmpeg-ingest-__defaultVhost__-live-camera_1.log
    process actual cli: ./objs/ffmpeg/bin/ffmpeg -rtsp_transport tcp -loglevel info -re -i rtsp://admin:Xctfoj01@10.100.27.1:6000/h264/ch1/main/ -vcodec copy -acodec copy -f flv -y rtmp://10.100.27.1:1935/live/camera_1

    redirect error and normal output to the log file 。 but the cli grammar has wrong。there shouldn't has space between '1' and '>', '2' and '>'

  2. this is my srs.conf。 I start the srs server by docker。

# 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__ {

        http_hooks {
        enabled         on;
        on_publish      http://bc:8080/ojj/cs/callback/srs/;
        on_unpublish    http://bc:8080/ojj/cs/callback/srs/;
    }

    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;
    }

    play{
        gop_cache_max_frames 2500;
    }

    ingest camera_1 {
        # whether enabled ingest features
        # default: off
        enabled      on;
        # input file/stream/device
        # @remark only support one input.
        input {
            # the type of input.
            # can be file/stream/device, that is,
            #   file: ingest file specifies by url.
            #   stream: ingest stream specifeis by url.
            #   device: not support yet.
            # default: file
            type    stream;
            # the url of file/stream.
            url     rtsp://admin:Xctfoj01@10.100.27.1:6000/h264/ch1/main/;
        }
        # the ffmpeg
        ffmpeg      './objs/ffmpeg/bin/ffmpeg -rtsp_transport tcp';
        # the transcode engine, @see all.transcode.srs.com
        # @remark, the output is specified following.
        engine {
            # @see enabled of transcode engine.
            # if disabled or vcodec/acodec not specified, use copy.
            # default: off.
            enabled          false;
            perfile {
                rtsp_transport tcp;
            }
            # output stream. variables:
            # [vhost] current vhost which start the ingest.
            # [port] system RTMP stream port.
            output          rtmp://10.100.27.1:[port]/live?vhost=[vhost]/camera_1;
        }
    }
}

Version my srs server version is 5.0.210

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

jiangxizhanzhi commented 3 months ago

i find the reason。 there have the same error inssue #975

to enable ffmpeg rtsp_transport tcp, I modify ingest part "ffmpeg ./objs/ffmpeg/bin/ffmpeg " to "ffmpeg './objs/ffmpeg/bin/ffmpeg -rtsp_transport tcp' "

this cause the final ffmpeg command has grammer error。

Why i convert "ffmpeg ./objs/ffmpeg/bin/ffmpeg " to "ffmpeg './objs/ffmpeg/bin/ffmpeg -rtsp_transport tcp' "? Because when I only add "rtsp_transport tcp" in the ingest engine part, it doesn't work。 I see the final ffmpeg command don't contain "rtsp_transport tcp"。

the engine config like this (I get from the wiki):

 engine {
            # @see enabled of transcode engine.
            # if disabled or vcodec/acodec not specified, use copy.
            # default: off.
            enabled          false;
            perfile {
                rtsp_transport tcp;
            }
            # output stream. variables:
            # [vhost] current vhost which start the ingest.
            # [port] system RTMP stream port.
            output          rtmp://10.100.27.1:[port]/live?vhost=[vhost]/camera_1;
        }

but if I modify to this:

engine {
            # @see enabled of transcode engine.
            # if disabled or vcodec/acodec not specified, use copy.
            # default: off.
            enabled on;
            perfile {
                rtsp_transport tcp;
            }
            vcodec copy;
            acodec copy;

            # output stream. variables:
            # [vhost] current vhost which start the ingest.
            # [port] system RTMP stream port.
            output          rtmp://127.0.0.1:[port]/live?vhost=[vhost]/fucktx;
        }

the perfile config content worked。so I don't need modify "ffmpeg ./objs/ffmpeg/bin/ffmpeg " to "ffmpeg './objs/ffmpeg/bin/ffmpeg -rtsp_transport tcp' " and bypass the bug I describe upper.

the inssue #975 has the same problem, but was closed。

winlinvip commented 3 months ago

Seems no need to fix.