【问题标题】:How can I save VoD recordings without stopping streaming?如何在不停止流式传输的情况下保存 VoD 录音?
【发布时间】:2021-01-27 11:50:41
【问题描述】:

如何在不停止流的情况下停止间隔录制以将 Ant Media Server 中的 VoD 保存在我的流源和 IP 摄像机中?

【问题讨论】:

    标签: ant-media-server


    【解决方案1】:

    您可以使用 python 脚本来实现。假设你已经安装了 python3 和 pip。 以下脚本以用户定义的间隔停止并再次开始录制:

    import sys
    import sched, time
    try:
        import requests
        print("requests library already installed!")
    except ImportError:
        try:
            import pip
            print("requests library is being installed")
            pip.main(['install', '--user', 'requests'])
            import requests
        except ImportError:
            print("pip is not installed, so it needs to be installed first to proceed further.\nYou can install pip with the following command:\nsudo apt install python3-pip")
    slp=sched.scheduler(time.time,time.sleep)
    def startStopRecording(s):
        print("Stopping the recording of "+sys.argv[2])
        response=requests.put(sys.argv[1]+"/rest/v2/broadcasts/"+sys.argv[2]+"/recording/false")
        if response.json()["success"]:
            print("recording of "+sys.argv[2]+" stopped successfully")
            print(response.content)
            print("starting the recording of "+sys.argv[2])
            response=requests.put(sys.argv[1]+"/rest/v2/broadcasts/"+sys.argv[2]+"/recording/true")
            print(response.content)
            if response.json()["success"]:
                print("recording of "+sys.argv[2]+" started successfully")
                s.enter(int(sys.argv[3]),1,startStopRecording,(s,))
            else:
                print("Couldn't start the recording of "+sys.argv[2])
                print("content of the response:\n"+response.content)
                sys.exit()
    
        else:
            print("Couldn't stop the recording of "+sys.argv[2])
            print("content of the response:")
            print(response.content)
            sys.exit()
        
    slp.enter(int(sys.argv[3]),1,startStopRecording,(slp,))
    slp.run()
    

    示例用法如下:python3 file.py https://domain/{Application} streamId 间隔

    第一个参数是您要使用的域,例如:https://someexample.com:5443/WebRTCAppEE

    第二个参数是您要使用的流 id。前任。流 123。

    第三个参数是你想要重新开始录制的时间间隔。持续时间单位是秒。所以 60 等于 1 分钟。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-20
      • 1970-01-01
      • 2017-11-11
      • 2022-10-08
      • 1970-01-01
      • 2014-06-29
      相关资源
      最近更新 更多