aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-09-02 23:07:50 +0200
committerdec05eba <dec05eba@protonmail.com>2021-09-02 23:07:50 +0200
commit8c4e3217bf3e3c675f181c34f79448ba036dfcaf (patch)
tree687b422783497952452679088f0c3814ffafc300 /src/plugins
parenta12c897435e615618b14f5cbdd50c7d01dd291fa (diff)
Youtube: skip non-default audio tracks, remove subtitle shadow
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Youtube.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp
index 6a96595..34fd250 100644
--- a/src/plugins/Youtube.cpp
+++ b/src/plugins/Youtube.cpp
@@ -2590,7 +2590,7 @@ R"END(
codecs_p += 8;
const char *codecs_sep_p = strchr(codecs_p, ',');
const char *codecs_end_p = strchr(codecs_p, '"');
- has_embedded_audio = (codecs_sep_p != nullptr && (!codecs_end_p || codecs_sep_p < codecs_end_p));
+ has_embedded_audio = (codecs_sep_p && (!codecs_end_p || codecs_sep_p < codecs_end_p));
}
YoutubeVideoFormat video_format;
@@ -2619,6 +2619,15 @@ R"END(
video_formats.push_back(std::move(video_format));
} else if(strncmp(youtube_format_base.mime_type.c_str(), "audio/", 6) == 0) {
+ // Some youtube videos have multiple audio tracks and sometimes the audio tracks are in the same language
+ // and one audio track may be descriptive/commentary. We only want the original audio for now
+ const Json::Value &audio_track_json = format["audioTrack"];
+ if(audio_track_json.isObject()) {
+ const Json::Value &audio_is_default_json = audio_track_json["audioIsDefault"];
+ if(audio_is_default_json.isBool() && !audio_is_default_json.asBool())
+ continue;
+ }
+
YoutubeAudioFormat audio_format;
audio_format.base = std::move(youtube_format_base);