diff options
author | Christian Pointner <equinox@spreadspace.org> | 2012-10-01 00:53:24 +0200 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2012-10-01 00:53:24 +0200 |
commit | 46aea5a8182e7147be52251ea86b116b05534f86 (patch) | |
tree | 7cb1d1d99516fe3aba4216218f1e68f8e609cd7a | |
parent | cleanup (diff) |
generate encoder and muxer automatically
-rwxr-xr-x | src/flufigut.py | 129 | ||||
-rw-r--r-- | src/test.json | 24 |
2 files changed, 68 insertions, 85 deletions
diff --git a/src/flufigut.py b/src/flufigut.py index becb727..83ab005 100755 --- a/src/flufigut.py +++ b/src/flufigut.py @@ -117,8 +117,9 @@ for property in config['input'].keys(): flow['input']['raw-input']['properties'][property] = config['input'][property] resolutions = [ ] -for encoder in config['encoder']['video'].keys(): - for resolution in config['encoder']['video'][encoder].keys(): +for format in config['transcode'].keys(): + for profile in config['transcode'][format]: + resolution = config['globals']['profiles'][profile]['video'] if resolution not in resolutions: if config['input']['resolution'] != resolution: if config['globals']['resolutions'][resolution]['rate'] != config['globals']['resolutions'][config['input']['resolution']]['rate']: @@ -139,11 +140,10 @@ for resolution in resolutions: } - samplerates = [ ] -for encoder in config['encoder']['audio'].keys(): - for audiorate in config['encoder']['audio'][encoder]: - samplerate = config['globals']['audiorates'][audiorate]['samplerate'] +for format in config['globals']['formats'].keys(): + if 'samplerate' in config['globals']['formats'][format]: + samplerate = config['globals']['formats'][format]['samplerate'] if samplerate not in samplerates: if config['input']['samplerate'] != samplerate: samplerates.append(samplerate) @@ -159,70 +159,65 @@ for samplerate in samplerates: }, } - -### generate encoder components ################################# +### generate encoder and muxer components ####################### flow['encoder'] = {} - -for encoder in config['encoder']['video'].keys(): - for resolution in config['encoder']['video'][encoder].keys(): - if resolution == config['input']['resolution']: - feeder = 'raw-input:video' - else: - feeder = 'resize-%s' % resolution - - flow['encoder']['encode-%s-%s' % (encoder, resolution)] = { - 'type': '%s-encode' % encoder, - 'desc': "%s encoder for %sx%s" % (encoder, config['globals']['resolutions'][resolution]['width'], config['globals']['resolutions'][resolution]['height']), - 'worker': 'encoder-%s' % encoder, - 'feeder': feeder, - 'properties': { - 'bitrate': config['encoder']['video'][encoder][resolution], - }, - } - - -for encoder in config['encoder']['audio'].keys(): - for audiorate in config['encoder']['audio'][encoder]: - if config['globals']['audiorates'][audiorate]['samplerate'] == config['input']['samplerate']: - feeder = 'raw-input:audio' - else: - feeder = 'resample-%s' % config['globals']['audiorates'][audiorate]['samplerate'] - - flow['encoder']['encode-%s-%s' % (encoder, audiorate)] = { - 'type': '%s-encode' % encoder, - 'desc': "%s encoder for %i kbit/s @ %i Hz" % (encoder, config['globals']['audiorates'][audiorate]['bitrate'], config['globals']['audiorates'][audiorate]['samplerate']), - 'worker': 'encoder-%s' % encoder, - 'feeder': feeder, - 'properties': { - 'bitrate': config['globals']['audiorates'][audiorate]['bitrate'], - }, - } - - -### generate muxer components ################################### flow['muxer'] = {} -for format in config['muxer'].keys(): - muxer = config['globals']['formats'][format]['muxer'] - - for profile in config['muxer'][format]: - resolution = config['globals']['profiles'][profile]['video'] - arate = config['globals']['profiles'][profile]['audio'] - - feeder_audio = 'encoder-%s-%s' % (config['globals']['formats'][format]['audio'], arate) - if 'video' in config['globals']['formats'][format]: - feeder_video = 'encoder-%s-%s' % (config['globals']['formats'][format]['video'], resolution) - else: - feeder_video = 'none' - - flow['muxer']['muxer-%s-%s' % (muxer, profile)] = { - 'type': '%s-mux' % muxer, - 'desc': "%s muxer profile %s" % (format, profile), - 'worker': 'muxer-%s' % muxer, - 'feeder_audio': feeder_audio, - 'feeder_video': feeder_video, - 'properties': {}, - } +# for encoder in config['encoder']['video'].keys(): +# for resolution in config['encoder']['video'][encoder].keys(): +# if resolution == config['input']['resolution']: +# feeder = 'raw-input:video' +# else: +# feeder = 'resize-%s' % resolution + +# flow['encoder']['encode-%s-%s' % (encoder, resolution)] = { +# 'type': '%s-encode' % encoder, +# 'desc': "%s encoder for %sx%s" % (encoder, config['globals']['resolutions'][resolution]['width'], config['globals']['resolutions'][resolution]['height']), +# 'worker': 'encoder-%s' % encoder, +# 'feeder': feeder, +# 'properties': { +# 'bitrate': config['encoder']['video'][encoder][resolution], +# }, +# } + +# for encoder in config['encoder']['audio'].keys(): +# for audiorate in config['encoder']['audio'][encoder]: +# if config['globals']['audiorates'][audiorate]['samplerate'] == config['input']['samplerate']: +# feeder = 'raw-input:audio' +# else: +# feeder = 'resample-%s' % config['globals']['audiorates'][audiorate]['samplerate'] + +# flow['encoder']['encode-%s-%s' % (encoder, audiorate)] = { +# 'type': '%s-encode' % encoder, +# 'desc': "%s encoder for %i kbit/s @ %i Hz" % (encoder, config['globals']['audiorates'][audiorate]['bitrate'], config['globals']['audiorates'][audiorate]['samplerate']), +# 'worker': 'encoder-%s' % encoder, +# 'feeder': feeder, +# 'properties': { +# 'bitrate': config['globals']['audiorates'][audiorate]['bitrate'], +# }, +# } + +# for format in config['muxer'].keys(): +# muxer = config['globals']['formats'][format]['muxer'] + +# for profile in config['muxer'][format]: +# resolution = config['globals']['profiles'][profile]['video'] +# arate = config['globals']['profiles'][profile]['audio'] + +# feeder_audio = 'encoder-%s-%s' % (config['globals']['formats'][format]['audio'], arate) +# if 'video' in config['globals']['formats'][format]: +# feeder_video = 'encoder-%s-%s' % (config['globals']['formats'][format]['video'], resolution) +# else: +# feeder_video = 'none' + +# flow['muxer']['muxer-%s-%s' % (muxer, profile)] = { +# 'type': '%s-mux' % muxer, +# 'desc': "%s muxer profile %s" % (format, profile), +# 'worker': 'muxer-%s' % muxer, +# 'feeder_audio': feeder_audio, +# 'feeder_video': feeder_video, +# 'properties': {}, +# } ### generate streamer components ################################ diff --git a/src/test.json b/src/test.json index 2a389ef..f4aad1c 100644 --- a/src/test.json +++ b/src/test.json @@ -10,14 +10,8 @@ "480p25": { "width": 854, "height": 480, "rate": "25/1" }, "360p25": { "width": 640, "height": 360, "rate": "25/1" } }, - "audiorates": { - "160@44": { "bitrate": 160, "samplerate": 44100 }, - "96@44": { "bitrate": 96, "samplerate": 44100 }, - "160@48": { "bitrate": 160, "samplerate": 48000 }, - "96@48": { "bitrate": 96, "samplerate": 48000 } - }, "formats": { - "flash": { "muxer": "flv", "video": "h264", "audio": "aac" }, + "flash": { "muxer": "flv", "video": "h264", "audio": "aac", "samplerate": 44100 }, "webm": { "muxer": "webm", "video": "vp8", "audio": "vorbis" }, "ogg-audio": { "muxer": "ogg", "audio": "vorbis" } }, @@ -26,6 +20,10 @@ "medium": { "video": "480p25", "audio": 160 }, "low": { "video": "360p25", "audio": 96 } }, + "bitrates": { + "h264": { "720p25": 2048, "480p25": 1024, "360p25": 600 }, + "vp8": { "720p25": 2048, "480p25": 1024, "360p25": 600 } + }, "machines": { "titan": [ "input", "encoder-vorbis", "encoder-aac", "muxer-flv", "muxer-webm", "muxer-ogg", "streamer0" ], "calypso": [ "encoder-h264" ], @@ -40,17 +38,7 @@ "resolution": "720p25", "samplerate": 48000 }, - "encoder": { - "video": { - "h264": { "720p25": 2048, "480p25": 1024, "360p25": 600 }, - "vp8": { "720p25": 2048, "480p25": 1024, "360p25": 600 } - }, - "audio": { - "aac": [ "160@44", "96@44" ], - "vorbis": [ "160@48", "96@48" ] - } - }, - "muxer": { + "transcode": { "flash": [ "high", "medium", "low" ], "webm": [ "high", "medium", "low" ], "ogg-audio": [ "high" ] |