From 8c4fbcc4a81e1e22599732cf5caa135363ba92ff Mon Sep 17 00:00:00 2001 From: Michael Campagnaro Date: Wed, 1 Oct 2025 01:16:23 -0400 Subject: [PATCH] Update aliases --- .aliases | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/.aliases b/.aliases index 1af1ba1..fab6e61 100644 --- a/.aliases +++ b/.aliases @@ -437,8 +437,8 @@ download_youtube_vid() { return fi - printf "${BOLD}${RED}USING TEMP FIX FOR YOUTUBE FORMAT ISSUES BY SETTING THE CLIENT TO tv_simply. SEE https://github.com/yt-dlp/yt-dlp/issues/13930\n\n${NORMAL}" - opts+=" --extractor-args youtube:player-client=default,tv_simply" + #printf "${BOLD}${RED}USING TEMP FIX FOR YOUTUBE FORMAT ISSUES BY SETTING THE CLIENT TO tv_simply.\nWAS FIXED (SEE https://github.com/yt-dlp/yt-dlp/issues/13930)\nBUT THE NEW VERSION IS DOWNLOADING LOWER BITRATE VIDS\nTHAN THIS FIX, SO THE PATCH STAYS FOR NOW!\n\n${NORMAL}" + #opts+=" --extractor-args youtube:player-client=default,tv_simply" if [[ $shortname == "1" || $transcribe == "1" ]]; then printf "${BOLD}Downloading Youtube vid " @@ -693,6 +693,10 @@ download_twitch_chat() { # To extract a portion of a video, you have to first download the entire file and then use the # `trim-video` or `compress-video' with a time range. # +# To download the portion of a stream: +# +# yt-dlp -f "b" --external-downloader ffmpeg --external-downloader-args "ffmpeg_i:-ss 5:25:38.00 -to 5:56:50.00" URL +# download_twitch_vid() { local format="$1" local shortname="$2" @@ -712,12 +716,15 @@ download_twitch_vid() { # It's a two step process because streamlink cannot pass the formatted filename to ffmpeg. # We fallback to yt-dlp when it's a subscriber VOD because we don't have an easy way to access it with streamlink. - local subscriber_vod=0 + local use_ytdlp=0 + local split_opts=($opts) - if [[ ${split_opts[0]} == "--cookies" ]]; then - subscriber_vod=1 - printf "${BOLD}Subscriber VOD. Will use yt-dlp to download.${NORMAL}\n" - fi + for i in "${split_opts[@]}"; do + if [[ $i == "--cookies" ]]; then + use_ytdlp=1 + printf "${BOLD}Subscriber VOD. Will use yt-dlp to download.${NORMAL}\n" + fi + done if [[ $shortname == "1" || $compress == "1" || $transcribe == "1" ]]; then printf "${BOLD}Downloading Twitch vid " @@ -764,14 +771,13 @@ download_twitch_vid() { printf "filename: $filename\n" # Download the video. - if [[ $subscriber_vod == "0" ]]; then - printf "${YELLOW}${BOLD}\nUsing streamlink to download...${NORMAL}\n" - local cmd="streamlink.exe --twitch-low-latency --twitch-disable-ads --twitch-disable-hosting --force --progress=force $opts $url $streamlink_format -O | ffmpeg -i pipe:0 -c copy \"$filename\"" - else + if [[ $use_ytdlp == "1" ]]; then printf "${YELLOW}${BOLD}\nUsing yt-dlp to download...${NORMAL}\n" opts+=" --embed-thumbnail --embed-metadata" - local cmd="yt-dlp.exe -f $yt_dlp_format -o \"$filename\" $opts $url" + else + printf "${YELLOW}${BOLD}\nUsing streamlink to download...${NORMAL}\n" + local cmd="streamlink.exe --twitch-low-latency --twitch-disable-ads --twitch-disable-hosting --force --progress=force $opts $url $streamlink_format -O | ffmpeg -i pipe:0 -c copy \"$filename\"" fi eval $cmd # Need to eval in order to preserve the quotes wrapping the filename format string. @@ -1273,6 +1279,13 @@ alias nv='normalize-volume' alias na='normalize-volume' alias tv='echo can just do a cv with a time range...' #trim-video-vbr' +function compress_and_normalize_volume() { + local final_name="$1" + compress-video f.mp4 ff ; normalize-volume ff.mp4 "$final_name" +} + +alias cvn='compress_and_normalize_volume' + #################################################################################################### # Git ####################################################################################################