From 0a04eded280eb6d09c37393241e31ac155462030 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Wed, 3 Mar 2021 14:30:38 +0100 Subject: [PATCH] Fix unnecessary audio transcoding When I tried to prepare a video so that no transcoding was necessary, I noticed this was impossible, even if I used exactly the same `ffmpeg` call gnomecast was using. I chased this down to an `or` that probably should have been an `and`: we want to transcode if we have an unsupported audio format *and* we can't play the embedded audio stream. --- gnomecast.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnomecast.py b/gnomecast.py index 3bbd7f2..55dc0ec 100644 --- a/gnomecast.py +++ b/gnomecast.py @@ -271,7 +271,7 @@ def __init__(self, cast, fmd, video_stream, audio_stream, done_callback, error_c print('Transcoder', fn) transcode_container = fmd.container not in ('mp4', 'aac', 'mp3', 'wav') self.transcode_video = force_video or not self.can_play_video_codec(video_stream.codec) - self.transcode_audio = force_audio or fmd.container not in AUDIO_EXTS or not self.can_play_audio_stream(self.audio_stream) + self.transcode_audio = force_audio or fmd.container not in AUDIO_EXTS and not self.can_play_audio_stream(self.audio_stream) self.transcode = transcode_container or self.transcode_video or self.transcode_audio self.trans_fn = None