diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-09-02 23:07:50 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-09-02 23:07:50 +0200 |
commit | 8c4e3217bf3e3c675f181c34f79448ba036dfcaf (patch) | |
tree | 687b422783497952452679088f0c3814ffafc300 /src | |
parent | a12c897435e615618b14f5cbdd50c7d01dd291fa (diff) |
Youtube: skip non-default audio tracks, remove subtitle shadow
Diffstat (limited to 'src')
-rw-r--r-- | src/VideoPlayer.cpp | 5 | ||||
-rw-r--r-- | src/plugins/Youtube.cpp | 11 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp index ac18151..04bc27f 100644 --- a/src/VideoPlayer.cpp +++ b/src/VideoPlayer.cpp @@ -146,7 +146,6 @@ namespace QuickMedia { "--no-resume-playback", // TODO: Disable hr seek on low power devices? "--hr-seek=yes", - //"--cache=no", "--force-seekable=yes", "--image-display-duration=5", "--cache-pause=yes", @@ -154,12 +153,8 @@ namespace QuickMedia { "--cache-on-disk=yes", "--cache-secs=86400", // 24 hours "--sub-font-size=40", - //"--sub-font=DejaVuSans-Bold", - //"--sub-bold=yes", "--sub-margin-y=45", "--sub-border-size=1.95", - "--sub-shadow-offset=1.25", - "--sub-shadow-color=0.2/0.9", cache_dir.c_str(), input_conf.c_str(), wid_arg.c_str() 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); |