From 24a8ae421f4a64ac3acfc51117cb2855955cd9ca Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 21 Mar 2012 23:25:24 +0100 Subject: [PATCH] compare audio channels to highest audio stream --- pandora_client/extract.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandora_client/extract.py b/pandora_client/extract.py index 911410e..ff2c280 100644 --- a/pandora_client/extract.py +++ b/pandora_client/extract.py @@ -148,7 +148,10 @@ def video_cmd(video, target, profile, info): if info['audio']: audio_settings = ['-ar', str(audiorate), '-aq', str(audioquality)] - if audiochannels and 'channels' in info['audio'][0] and info['audio'][0]['channels'] > audiochannels: + ac = 1 + for a in info['audio']: + ac = max(ac, a.get('channels', 1)) + if audiochannels and ac >= audiochannels: audio_settings += ['-ac', str(audiochannels)] if audiobitrate: audio_settings += ['-ab', audiobitrate]