diff options
author | Xiao Pan <gky44px1999@gmail.com> | 2023-09-26 02:19:22 -0700 |
---|---|---|
committer | Xiao Pan <gky44px1999@gmail.com> | 2023-09-26 02:19:22 -0700 |
commit | bb2a25c3e7c4c0d60a00770fb969957ccb123b35 (patch) | |
tree | f1a6282cf0db57d8c498da175719cc1f553283f6 /home/xyz/.local | |
parent | c04219410d8848c6638b5ae126a2be4880a39d40 (diff) |
I choose to use `--trim-filenames 54` locally at mpvy instead of globally in .config dir. Because some Scott Buckley music has some long name but does not exceed limit, for backward compatibility reason I do not want to change.
Diffstat (limited to 'home/xyz/.local')
-rwxr-xr-x | home/xyz/.local/bin/mpvy | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/home/xyz/.local/bin/mpvy b/home/xyz/.local/bin/mpvy index 97f92ffd..42d6014f 100755 --- a/home/xyz/.local/bin/mpvy +++ b/home/xyz/.local/bin/mpvy @@ -29,13 +29,15 @@ if [ -z "$format" ]; then format="bestvideo$vformat+bestaudio/best$vformat" fi + case $flag in # here if use --write-sub, mpv doesn't recognize subtitles? # --embed-subs is a little bit better, but still worse then direct streaming # --sponsorblock-remove will make audio/video goes out of sync, need --force-keyframes-at-cuts which need re-encode which is slow, more see comments at the bottom of https://github.com/yt-dlp/yt-dlp/issues/871 # another way is using mpv-sponsorblock-minimal-git for streaming and sponsorblock-mpv-local for local videos - A) yt-dlp -f "$format" --embed-subs -P "${download_dir:-"$XDG_DOWNLOAD_DIR/mpvy/"}" --sponsorblock-remove default --sponsorblock-mark default "$url";; - a) yt-dlp -f "$format" --embed-subs -P "${download_dir:-"$XDG_DOWNLOAD_DIR/mpvy/"}" --sponsorblock-remove default --sponsorblock-mark default "$url" --exec 'mpv --fs --speed=2';; + # I use `--trim-filenames 54` because: linux max filename length is 255 bytes, UTF-8 1 character max 4 byptes, yt-dlp and aria2c will add about max 38 chars behind video name, for example: ' [EXF4g-2jOJo].f616.mp4.part.frag.urls', (255-38)/4==54. Not sure `mpvy -s` direct mpv method need this or not, I'll change if it meet issues in the future. + A) yt-dlp --trim-filenames 54 -f "$format" --embed-subs -P "${download_dir:-"$XDG_DOWNLOAD_DIR/mpvy/"}" --sponsorblock-remove default --sponsorblock-mark default "$url";; + a) yt-dlp --trim-filenames 54 -f "$format" --embed-subs -P "${download_dir:-"$XDG_DOWNLOAD_DIR/mpvy/"}" --sponsorblock-remove default --sponsorblock-mark default "$url" --exec 'mpv --fs --speed=2';; s) mpv --ytdl-format="$format" --ytdl-raw-options='write-sub=' --fs --speed=2 "$url";; esac # not sure if this is the best practice, but it seems working ;) |