PyLivestream icon indicating copy to clipboard operation
PyLivestream copied to clipboard

timout not working for multiple stream

Open mzramna opened this issue 3 years ago • 1 comments

Describe the bug when using multiple stream as shown in test files,timout parameter not work

System Parameters

  • Operating system linux
  • FFmpeg version 4.2.2-1ubuntu1
sites = [ "youtube","facebook",]
TIMEOUT = 5
S = pls.Screenshare(inifn=None, websites=sites, timeout=TIMEOUT)
    for s in S.streams:
        if input != "file":
            assert "-re" not in S.streams[s].cmd
            assert S.streams[s].fps == approx(30.0)
        if int(S.streams[s].res[1]) == 480:
            assert S.streams[s].video_kbps == 500
        elif int(S.streams[s].res[1]) == 720:
            assert S.streams[s].video_kbps == 1800
        print(s.title())
        print(S.streams[s].__dict__)
    S.golive()

with the folowing code the resulting comand executed excludes de '-t' tag: running only with youtube: /usr/bin/ffmpeg -loglevel error -f x11grab -s 640x480 -i :0.0+50,30 -f pulse -i default -codec:v libx264 -pix_fmt yuv420p -preset veryfast -b:v 500k -g 60 -codec:a aac -b:a 128k -ar 44100 -maxrate 500k -bufsize 250k -strict experimental -f flv -t 5 rtmp://a.rtmp.youtube.com/ running with youtube and facebook: /usr/bin/ffmpeg -loglevel error -f x11grab -s 640x480 -i :0.0+50,30 -f pulse -i default -codec:v libx264 -pix_fmt yuv420p -preset veryfast -b:v 500k -g 60 -codec:a aac -b:a 128k -ar 44100 -maxrate 500k -bufsize 250k -strict experimental -f flv -flags:v +global_header -f tee -map 0:v -map 1:a [f=flv]rtmp://a.rtmp.youtube.com/_______________________|[f=flv]rtmps://live-api-s.facebook.com:443/rtmp/

mzramna avatar Jul 11 '20 23:07 mzramna

this code i've made have the same expected output,but with the -t tag included:

cmd=""
    for command in S.streams[list(S.streams.keys())[0]].cmd[:-1]:
        cmd+=command+" "
    cmd+="-flags:v +global_header -f tee"
    print(cmd)
    for site in S.streams:
        if site!=list(S.streams.keys())[0]:
            cmd +="|"
        print(S.streams[site].sink)
        cmd+="[f=flv]"+str(S.streams[site].sink)
    print(cmd)

i think using the folowing line instead of the existing into the main code will fix the issue: for command in S.streams[list(S.streams.keys())[0]].cmd[:-1]:

mzramna avatar Jul 12 '20 01:07 mzramna