{% if 'Translated-2' in audio_tracks %} -map 0:a:2 -b:a:2 96k -metadata:s:a:2 language="Translated-2" {% endif %} -f dash -window_size 201 -extra_window_size 10 -seg_duration 3 -dash_segment_type webm -init_seg_name 'init_$RepresentationID$.webm' -media_seg_name 'segment_$RepresentationID$_$Number$.webm' -adaptation_sets '{{ adaptation_sets | join(" ") }}' {{ dash_write_path }}/{{ stream }}/manifest.mpd """) fanout_utils.call(command) if __name__ == "__main__": parser = fanout_utils.setup_argparse(name="dash") parser.add_argument('--dash_write_path', metavar='PATH', type=str, help='Path to write the DASH-Pieces and Manifest to') args = parser.parse_args() fanout_utils.mainloop(name="hls", transcoding_stream="vpx", calback=fanout_dash, args=args)
command = fanout_utils.format_and_strip( context, """ ffmpeg -v warning -nostats -nostdin -y -i {{ pull_url }} -map 0:v:0 -c:v copy -an -f image2 -update 1 {{ thumbnail_write_path }}/{{ stream }}/poster.jpeg -map 0:v:1 -c:v copy -an -f image2 -update 1 {{ thumbnail_write_path }}/{{ stream }}/thumb.jpeg """) fanout_utils.call(command) if __name__ == "__main__": parser = fanout_utils.setup_argparse(name="thumbnails") parser.add_argument('--thumbnail_write_path', metavar='PATH', type=str, help='Path to write the thumbnails to') args = parser.parse_args() fanout_utils.mainloop(name="thumbnail", transcoding_stream="thumbnail", calback=fanout_thumbnail, args=args)
def fanout_youtube(context): command = """ ffmpeg -v warning -nostats -nostdin -y -analyzeduration 3000000 -i {{ pull_url }} -c:v copy -c:a copy -map 0:v:0 -map 0:a:0 -f flv rtmp://a.rtmp.youtube.com/live2/{{ youtube_stream_key }} """ if __name__ == "__main__": parser = fanout_utils.setup_argparse(name="youtube") parser.add_argument( "--youtube_stream_key", metavar="KEY", type=str, help="Stream-Key creatd in the YouTube Creator Studio Web-UI") args = parser.parse_args() fanout_utils.mainloop(name="youtube", transcoding_stream="h264", calback=fanout_youtube, args=args)
def fanout(c): command = fanout_utils.format_and_strip(c, """ ffmpeg -v warning -nostats -nostdin -y -analyzeduration 3000000 -i {{ pull_url }} -c:v copy -c:a copy {{ maps | join("\n\t") }} -hls_time 6 -hls_list_size 200 -hls_segment_filename "{{ hls_write_path }}/{{ stream }}/{{ starttime }}-%d_%v.ts" -hls_flags +delete_segments+omit_endlist+independent_segments -var_stream_map '{{ varmaps | join(" ") }}' "{{ hls_write_path }}/{{ stream }}/chunks_%v.m3u8" """) fanout_utils.call(command) if __name__ == "__main__": parser = fanout_utils.setup_argparse(name="hls") parser.add_argument('--hls_write_path', metavar='PATH', type=str, help='Path to write the HLS-Pieces and Master-Playlists to') args = parser.parse_args() fanout_utils.mainloop(name="hls", transcoding_stream="h264", calback=fanout_hls, args=args)
-map 0:a:{{ 4 if codec == 'mp3' else 5 }} {% endif %} -f {{ codec }} -content_type {{ 'audio/mpeg' if codec == 'mp3' else 'audio/ogg' }} -password {{ icecast_password }} icecast://{{ push_endpoint }}/{{ stream }}_{{ audio_track | lower }}.{{ codec }} {% endfor %} {% endfor %} """) fanout_utils.call(command) if __name__ == "__main__": parser = fanout_utils.setup_argparse(name="audio") parser.add_argument( "--push_endpoint", metavar="PUSH", type=str, help= "Icecast-Endpoint to push the faned out Audio-Streams to (ie. 'live.ber.c3voc.de:8000/')" ) parser.add_argument( "--icecast_password", metavar="PWD", type=str, help="Password to login as 'source' on the Icecast-Server")
-map 0:a:0 {% elif audio_track == 'Translated' %} -map 0:a:1 {% elif audio_track == 'Translated-2' %} -map 0:a:2 {% endif %} -f webm -cluster_size_limit 3M -cluster_time_limit 3500 -content_type video/webm -password {{ icecast_password }} icecast://{{ push_endpoint }}/{{ stream }}_{{ audio_track | lower }}_{{ video_track | lower }}.webm {% endfor %} {% endfor %} """) fanout_utils.call(command) if __name__ == "__main__": parser = fanout_utils.setup_argparse(name="webm") parser.add_argument("--push_endpoint", metavar="PUSH", type=str, help="Icecast-Endpoint to push the faned out Video-Streams to (ie. 'live.ber.c3voc.de:8000/')") parser.add_argument("--icecast_password", metavar="PWD", type=str, help="Password to login as 'source' on the Icecast-Server") args = parser.parse_args() fanout_utils.mainloop(name="webm", transcoding_stream="vpx", calback=fanout_webm, args=args)