diff options
author | Christian Pointner <equinox@spreadspace.org> | 2012-10-17 00:40:07 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2012-10-17 00:40:07 +0200 |
commit | a6645325476c17ba7a532cf81c07be56e70e9959 (patch) | |
tree | f27fe3a1c790caaebff5dd297e66bb9a8cb386e5 | |
parent | first part of multi source support (diff) |
added resample and resize
-rwxr-xr-x | src/flufigut.py | 117 | ||||
-rw-r--r-- | src/test2.json | 5 |
2 files changed, 57 insertions, 65 deletions
diff --git a/src/flufigut.py b/src/flufigut.py index a3759a5..44ebddc 100755 --- a/src/flufigut.py +++ b/src/flufigut.py @@ -107,69 +107,60 @@ elif master > 1: raise SystemExit("You have configured multiple master clock devices!") - -# samplerates = [ ] -# resolutions = [ ] -# for format in transcode.keys(): -# if 'samplerate' in globals['formats'][format]: -# samplerate = globals['formats'][format]['samplerate'] -# if samplerate not in samplerates: -# if input_samplerate != samplerate: -# samplerates.append(samplerate) -# for profile in transcode[format]: -# if 'video' in globals['profiles'][profile]: -# if input_resolution == "": -# raise SystemExit("format definition needs video but no video input given") -# resolution = globals['profiles'][profile]['video'] -# if resolution not in resolutions: -# if input_resolution != resolution: -# if globals['resolutions'][resolution]['rate'] != globals['resolutions'][input_resolution]['rate']: -# raise SystemExit("ERROR: video rate conversion is not yet supported!!!") -# resolutions.append(resolution) - -# for resolution in resolutions: -# if 'resize' not in worker: -# worker['resize'] = -1 -# else: -# worker['resize'] = 1 -# if input_type == 'av': -# feeder = '%s:%s' % (input_name, "video") -# elif input_type == 'vo': -# feeder = '%s' % (input_name) -# else: -# raise SystemExit("format definition needs video but no video input given") -# flow['input']['resize-%s' % resolution] = { -# 'type': 'video-resize', -# 'desc': "resize video to %sx%s" % (globals['resolutions'][resolution]['width'], globals['resolutions'][resolution]['height']), -# 'worker': 'resize', -# 'feeder': feeder, -# 'properties': { -# 'width': globals['resolutions'][resolution]['width'], -# 'height': globals['resolutions'][resolution]['height'], -# }, -# } - -# for samplerate in samplerates: -# if 'resample' not in worker: -# worker['resample'] = -1 -# else: -# worker['resample'] = 1 - -# if input_type == 'av': -# feeder = '%s:%s' % (input_name, "audio") -# elif input_type == 'ao': -# feeder = '%s' % (input_name) -# else: -# raise SystemExit("format definition needs audio but no audio input given") -# flow['input']['resample-%s' % samplerate] = { -# 'type': 'audio-resample', -# 'desc': "resample audio to %s Hz" % samplerate, -# 'worker': 'resample', -# 'feeder': feeder, -# 'properties': { -# 'samplerate': samplerate, -# }, -# } +samplerates = [] +for mux_name in mux.keys(): + for format in mux[mux_name]['formats'].keys(): + if 'audio' in mux[mux_name]: + source = mux[mux_name]['audio'].split(':')[0] + input_samplerate = input[source]['properties']['samplerate'] + if 'samplerate' in globals['formats'][format]: + samplerate = globals['formats'][format]['samplerate'] + if samplerate not in samplerates: + if samplerate != input_samplerate: + + worker_name = 'resample-%s' % (source) + if worker_name not in worker: + worker[worker_name] = -1 + else: + worker[worker_name] = 1 + feeder = 'input-%s' % (mux[mux_name]['audio']) + flow['input']['resample-%s-%s' % (source, samplerate)] = { + 'type': 'audio-resample', + 'desc': "resample audio from %s to %s Hz" % (source, samplerate), + 'worker': 'resample', + 'feeder': feeder, + 'properties': { + 'samplerate': samplerate, + }, + } + + if 'video' in mux[mux_name]: + source = mux[mux_name]['video'].split(':')[0] + input_resolution = input[source]['properties']['resolution'] + for profile in mux[mux_name]['formats'][format]: + if 'video' in globals['profiles'][profile]: + if input_resolution == "": + raise SystemExit("format definition needs video but no video input given") + resolution = globals['profiles'][profile]['video'] + if input_resolution != resolution: + if globals['resolutions'][resolution]['rate'] != globals['resolutions'][input_resolution]['rate']: + raise SystemExit("ERROR: video rate conversion is not yet supported!!!") + worker_name = 'resize-%s' % (source) + if worker_name not in worker: + worker[worker_name] = -1 + else: + worker[worker_name] = 1 + feeder = 'input-%s' % (mux[mux_name]['video']) + flow['input']['resize-%s-%s' % (source, resolution)] = { + 'type': 'video-resize', + 'desc': "resize video from %s to %sx%s" % (source, globals['resolutions'][resolution]['width'], globals['resolutions'][resolution]['height']), + 'worker': 'resize', + 'feeder': feeder, + 'properties': { + 'width': globals['resolutions'][resolution]['width'], + 'height': globals['resolutions'][resolution]['height'], + }, + } ### generate encoder and muxer components ####################### flow['encoder_video'] = {} diff --git a/src/test2.json b/src/test2.json index 5e78dc9..310232d 100644 --- a/src/test2.json +++ b/src/test2.json @@ -31,8 +31,9 @@ "vp8": { "720p25": 2048, "480p25": 1024, "360p25": 600 } }, "machines": { - "calypso": [ "input-sdi-av", "input-alsa", "resample", "resize", "encoder-vorbis-160", "encoder-aac-160", "encoder-aac-128", "encoder-aac-96", - "muxer-flash-high", "muxer-flash-medium", "muxer-flash-low", "muxer-ogg-high", "streamer-local1" ], + "calypso": [ "input-sdi-av", "resize-sdi-av", "resample-sdi-av", "input-alsa", "resample-alsa", + "encoder-vorbis-160", "encoder-aac-160", "encoder-aac-128", "encoder-aac-96", + "muxer-flash-high", "muxer-flash-medium", "muxer-flash-low", "muxer-ogg-high", "streamer-local1" ], "telesto": [ "encoder-h264-720p25", "encoder-h264-480p25", "encoder-h264-360p25" ] } }, |