Example #1
0
def fanout(c):
    command = fanout_utils.format_and_strip(
        c, """
ffmpeg -v warning -nostats -nostdin -y -analyzeduration 50000000
	-i {{ pull_url }}

	-c:a copy
	-c:v copy

	-map 0:v:0 -b:v:0 2800k
{% if 'SD' in video_tracks %}
	-map 0:v:1 -b:v:1 800k
{% endif %}
{% if 'Slides' in video_tracks %}
	-map 0:v:2 -b:v:2 100k
{% endif %}

	-map 0:a:0 -b:a:0 96k -metadata:s:a:0 language="Untranslated"
{% if 'Translated' in audio_tracks %}
	-map 0:a:1 -b:a:1 96k -metadata:s:a:1 language="Translated"
{% endif %}
{% 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)
Example #2
0
def fanout_webm(context):
    command = fanout_utils.format_and_strip(
        context, """
ffmpeg -v warning -nostats -nostdin -y -analyzeduration 3000000
	-i {{ pull_url }}

	{% for audio_track in audio_tracks %}
		{% for codec in ['mp3', 'opus'] %}
			-c:v copy
			-c:a copy

			{% if audio_track == 'Native' %}
				-map 0:a:{{ 0 if codec == 'mp3' else 1 }}
			{% elif audio_track == 'Translated' %}
				-map 0:a:{{ 2 if codec == 'mp3' else 3 }}
			{% elif audio_track == 'Translated-2' %}
				-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)
Example #3
0
def fanout(context):
    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)
Example #4
0
File: hls.py Project: fkusei/cm
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)
Example #5
0
File: webm.py Project: voc/cm
def fanout_webm(context):
	command = fanout_utils.format_and_strip(context, """
ffmpeg -v warning -nostats -nostdin -y -analyzeduration 3000000
	-i {{ pull_url }}

	{% for audio_track in audio_tracks %}
		{% for video_track in video_tracks %}
			-c:v copy
			-c:a copy

			{% if video_track == 'HD' %}
				-map 0:v:0
			{% elif video_track == 'SD' %}
				-map 0:v:1
			{% elif video_track == 'Slides' %}
				-map 0:v:2
			{% endif %}

			{% if audio_track == 'Native' %}
				-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)