Liquidsoap + gstream with restream

时间:2016-03-24 23:40:01

标签: liquidsoap

我尝试用Liquidsoap和gstream将我的频道重新播放到另一个频道。我想这样做是因为后备并使用另一个来源,如果第一个没有使用它。我得到了:

set("frame.video.width", 1920)
set("frame.video.height", 1080)
#set("frame.video.samplerate", 30)
set("gstreamer.add_borders", false)
set("clock.allow_streaming_errors",false)

s = single("rtmp://link_to_rtmp_stream/test")
s = fallback([s, blank()])

output.gstreamer.audio_video(
  video_pipeline=
    "videoconvert ! x264enc bitrate=4000 ! video/x-h264,profile=baseline ! queue ! mux.",
  audio_pipeline=
    "audioconvert ! voaacenc bitrate=128000 ! queue ! mux.",
  pipeline=
    "flvmux name=mux ! rtmpsink location=\"rtmp://wherewewhantstream.com live=1\"",
  s)

我遇到了一个问题..识别第一个流..脚本不想识别它,因为它认为它是文件。如何识别rtmp流并对其进行解码?

1 个答案:

答案 0 :(得分:1)

试试这个:

set("frame.video.width", 1920)
set("frame.video.height", 1080)
#set("frame.video.samplerate", 30)
set("gstreamer.add_borders", false)
set("clock.allow_streaming_errors",false)

def gstreamer.rtmp(~id="",uri) =
  pipeline = "rtmpsrc location=#{uri} ! tee name=t"
  audio_pipeline = "t. ! queue"
  video_pipeline = "t. ! queue"
  input.gstreamer.audio_video(id=id, pipeline=pipeline, audio_pipeline=audio_pipeline, video_pipeline=video_pipeline)
end

s = gstreamer.rtmp("rtmp://link_to_rtmp_stream/test")
s = fallback([s, blank()])

output.gstreamer.audio_video(
  video_pipeline=
    "videoconvert ! x264enc bitrate=4000 ! video/x-h264,profile=baseline ! queue ! mux.",
  audio_pipeline=
    "audioconvert ! voaacenc bitrate=128000 ! queue ! mux.",
  pipeline=
    "flvmux name=mux ! rtmpsink location=\"rtmp://wherewewhantstream.com live=1\"",
  s)