Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transcode: Fail to detect the loop transcoding in SRS 5 #3516

Open
litianyu313 opened this issue Apr 17, 2023 · 3 comments
Open

Transcode: Fail to detect the loop transcoding in SRS 5 #3516

litianyu313 opened this issue Apr 17, 2023 · 3 comments
Assignees
Labels
Bug It might be a bug. Codec HEVC, FFmpeg for ingesting, trascoding or codec. TransByAI Translated by AI/GPT.

Comments

@litianyu313
Copy link

litianyu313 commented Apr 17, 2023

Note: Please read FAQ before file an issue, see #2716

Description

Please description your issue here

  1. SRS Version: 5.0.152

  2. SRS Log:

child process error, code=3030(FFmpegLog)(Open log file failed for FFmpeg) : redirect stdout : open process 1 ./objs/ffmpeg-encoder-test.com-live-livestream_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo-logo.log failed
thread [29378][411wp6kx]: redirect_io() [./src/app/srs_app_process.cpp:163][errno=63]
thread [29378][411wp6kx]: srs_redirect_output() [./src/app/srs_app_process.cpp:142][errno=63]
[2023-04-17 17:41:35.680][INFO][28052][411wp6kx] fored process, pid=29378, bin=/usr/local/bin/ffmpeg, stdout=./objs/ffmpeg-encoder-test.com-live-livestream_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo-logo.log, stderr=./objs/ffmpeg-encoder-test.com-live-livestream_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo-logo.log, argv=/usr/local/bin/ffmpeg -f flv -i rtmp://127.0.0.1:1935/live?vhost=test.com/livestream_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo -i ./doc/ffmpeg-logo.png -filter_complex overlay=10:10 -vcodec libx264 -b:v 300000 -r 20.00 -s 768x320 -aspect 768:320 -threads 2 -profile:v baseline -preset superfast -acodec copy -f flv -y rtmp://127.0.0.1:1935/live/livestream_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo?vhost=test.com
[2023-04-17 17:41:35.680][INFO][28052][411wp6kx] process pid=29378 terminate, please restart it.
[2023-04-17 17:41:36.710][INFO][28052][3g295d48] SIGKILL stop process pid=28456 ok.
[2023-04-17 17:41:36.711][INFO][28052][3g295d48] cleanup when unpublish
[2023-04-17 17:41:36.712][INFO][28052][3g295d48] TCP: before dispose resource(RtmpConn)(0x11cfea500), conns=83, zombies=0, ign=0, inz=0, ind=0
[2023-04-17 17:41:36.712][WARN][28052][3g295d48][4] client disconnect peer. ret=1007
[2023-04-17 17:41:36.712][INFO][28052][501kgp85] TCP: clear zombies=1 resources, conns=83, removing=0, unsubs=0
[2023-04-17 17:41:36.712][INFO][28052][3g295d48] TCP: disposing #0 resource(RtmpConn)(0x11cfea500), conns=83, disposing=1, zombies=0
[2023-04-17 17:41:36.712][INFO][28052][281374ty] TCP: before dispose resource(RtmpConn)(0x102813d30), conns=82, zombies=0, ign=0, inz=0, ind=0
[2023-04-17 17:41:36.712][WARN][28052][281374ty][54] client disconnect peer. ret=1007
[2023-04-17 17:41:36.713][INFO][28052][375p9089] send SIGTERM to pid=28457
[2023-04-17 17:41:36.713][INFO][28052][501kgp85] TCP: clear zombies=1 resources, conns=82, removing=0, unsubs=0
[2023-04-17 17:41:36.713][INFO][28052][281374ty] TCP: disposing #0 resource(RtmpConn)(0x102813d30), conns=82, disposing=1, zombies=0
[2023-04-17 17:41:36.732][INFO][28052][2g3fet66] Hybrid cpu=0.00%,0MB, cid=14,2, timer=59,0,0, clock=1,33,9,1,1,1,1,0,0, free=1, objs=(pkt:0,raw:0,fua:0,msg:7994,oth:0,buf:0)
[2023-04-17 17:41:37.779][INFO][28052][375p9089] SIGKILL stop process pid=28457 ok.
[2023-04-17 17:41:37.781][INFO][28052][375p9089] cleanup when unpublish
[2023-04-17 17:41:37.781][INFO][28052][375p9089] TCP: before dispose resource(RtmpConn)(0x11cf81510), conns=81, zombies=0, ign=0, inz=0, ind=0
[2023-04-17 17:41:37.781][WARN][28052][375p9089][4] client disconnect peer. ret=1007
[2023-04-17 17:41:37.781][INFO][28052][501kgp85] TCP: clear zombies=1 resources, conns=81, removing=0, unsubs=0
[2023-04-17 17:41:37.781][INFO][28052][375p9089] TCP: disposing #0 resource(RtmpConn)(0x11cf81510), conns=81, disposing=1, zombies=0
[2023-04-17 17:41:37.782][INFO][28052][57n9kle5] TCP: before dispose resource(RtmpConn)(0x11cf0cf00), conns=80, zombies=0, ign=0, inz=0, ind=0
[2023-04-17 17:41:37.782][WARN][28052][57n9kle5][54] client disconnect peer. ret=1007
[2023-04-17 17:41:37.782][INFO][28052][6r7k60u0] send SIGTERM to pid=28459
[2023-04-17 17:41:37.782][INFO][28052][501kgp85] TCP: clear zombies=1 resources, conns=80, removing=0, unsubs=0
[2023-04-17 17:41:37.782][INFO][28052][57n9kle5] TCP: disposing #0 resource(RtmpConn)(0x11cf0cf00), conns=80, disposing=1, zombies=0
[2023-04-17 17:41:37.791][INFO][28052][8b348v10] Process: cpu=0.00%,0MB, threads=2
  1. SRS Config:
vhost test.com {
    transcode {
        enabled on;
        ffmpeg /usr/local/bin/ffmpeg;
        engine logo {
            enabled on;
            vfilter {
                i ./doc/ffmpeg-logo.png;
                filter_complex      'overlay=10:10';
            }
            vcodec libx264;
            vbitrate 300;
            vfps 20;
            vwidth 768;
            vheight 320;
            vthreads 2;
            vprofile baseline;
            vpreset superfast;
            vparams {
            }
            acodec copy;
            oformat flv;

            output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
        }
    }
}

Replay

Please describe how to replay the bug?

Step 1: get srs 5.0.152

Step 2:
config file of transcode like this

vhost test.com {
    transcode {
        enabled on;
        ffmpeg /usr/local/bin/ffmpeg;
        engine logo {
            enabled on;
            vfilter {
                i ./doc/ffmpeg-logo.png;
                filter_complex      'overlay=10:10';
            }
            vcodec libx264;
            vbitrate 300;
            vfps 20;
            vwidth 768;
            vheight 320;
            vthreads 2;
            vprofile baseline;
            vpreset superfast;
            vparams {
            }
            acodec copy;
            oformat flv;

            output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
        }
    }
}

Step 3: run srs
push stream rtmp://127.0.0.1:1935/live/livestream by obs, and then more and more ffmpeg process start by ps -ef|grep ffmpeg.
And output url become long and long like :rtmp://127.0.0.1:1935/live?vhost=test.com/livestream_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo_logo

Expect

In the early version, it ran okay, but in bug version 5, it seems to have some problems.

TRANS_BY_GPT3

@NangenX
Copy link

NangenX commented Apr 29, 2023

add the ff_log_dir ./objs; to your config file

@winlinvip winlinvip self-assigned this May 1, 2023
@winlinvip winlinvip changed the title transcode have some problem in version 5 Transcode: Fail to detect the loop transcoding in SRS 5 May 1, 2023
@winlinvip winlinvip added Bug It might be a bug. Codec HEVC, FFmpeg for ingesting, trascoding or codec. labels May 1, 2023
@winlinvip
Copy link
Member

Seems a bug.

@mpisat
Copy link

mpisat commented Jun 30, 2023

There is a way to get out of this loop if you push transcode to another vhost
and disable transcode on that vhost
example with exec

listen              19356;
max_connections     1000;

http_api {
    enabled     on;
    listen      1985;  # Specify the desired port for the HTTP API
    crossdomain     on;
    raw_api {
        enabled             off;
        allow_reload        off;
        allow_query         off;
        allow_update        off;
    }
}

vhost __defaultVhost__ {
    exec {
        enabled     on;
        publish     /usr/local/bin/ffmpeg -hide_banner -loglevel error -fflags nobuffer -flags low_delay -i [url] -c:v libx264 -b:v 2000k -vf 'scale=1280:720:force_original_aspect_ratio=decrease' -async 1 -vsync 1 -c:a aac -b:a 96k -f flv rtmp://127.0.0.1:[port]/[app]?vhost=transcode.local/[stream]_720p -c:v libx264 -b:v 1200k -vf 'scale=960:540:force_original_aspect_ratio=decrease' -c:a aac -b:a 96k -f flv rtmp://127.0.0.1:[port]/[app]?vhost=transcode.local/[stream]_540p -c:v libx264 -b:v 550k -vf 'scale=640:360:force_original_aspect_ratio=decrease' -c:a aac -b:a 96k -f flv rtmp://127.0.0.1:[port]/[app]?vhost=transcode.local/[stream]_360p;
    }
}

vhost transcode.local {
exec {
        enabled     off;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug It might be a bug. Codec HEVC, FFmpeg for ingesting, trascoding or codec. TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

4 participants