Multi-DJ livestream toolkit
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

52 lines
1.9 KiB

def output.rtmp(~id="",
~video_bitrate=2000,
~video_opts="byte-stream=false key-int-max=60 bframes=0 aud=true tune=zerolatency",
~video_encoder="x264enc",
~video_type="video/x-h264,profile=main",
~audio_bitrate=192000,
~audio_opts="",
~audio_encoder="faac",
~audio_type="audio/mpeg,mpegversion=4",
~url,
source) =
output.gstreamer.audio_video(source,
video_pipeline="videoconvert ! \
#{video_encoder} bitrate=#{video_bitrate} #{video_opts} ! \
#{video_type} ! queue ! mux.",
audio_pipeline = "audioconvert ! \
#{audio_encoder} bitrate=#{audio_bitrate} #{audio_opts} ! \
#{audio_type} ! queue ! mux.",
pipeline="flvmux streamable=true name=mux ! rtmpsink location=\"#{url}\""
)
end
def list.join(sep, l)
s = list.fold(fun (x, e) -> x ^ e ^ sep, "", l)
string.sub(s, start=0, length=string.length(s) - string.length(sep))
end
def output.rtmp.multi(~id="",
~video_bitrate=2000,
~video_opts="byte-stream=false key-int-max=60 bframes=0 aud=true tune=zerolatency",
~video_encoder="x264enc",
~video_type="video/x-h264,profile=main",
~audio_bitrate=192000,
~audio_opts="",
~audio_encoder="faac",
~audio_type="audio/mpeg,mpegversion=4",
~urls,
source) =
rtmp_pipelines = list.map(fun (url) ->
"rtmp. ! queue ! rtmpsink location=\"#{url}\"",
urls
)
output.gstreamer.audio_video(source,
video_pipeline="videoconvert ! \
#{video_encoder} bitrate=#{video_bitrate} #{video_opts} ! \
#{video_type} ! queue ! mux.",
audio_pipeline = "audioconvert ! \
#{audio_encoder} bitrate=#{audio_bitrate} #{audio_opts} ! \
#{audio_type} ! queue ! mux.",
pipeline="flvmux streamable=true name=mux ! tee name=rtmp " ^ list.join(" ", rtmp_pipelines)
)
end