diff options
author | Toby Vincent <tobyv@tobyvin.dev> | 2024-09-06 14:44:17 -0500 |
---|---|---|
committer | Toby Vincent <tobyv@tobyvin.dev> | 2024-09-06 14:44:47 -0500 |
commit | 525df6522fb89b89940e37f67d9846a59c79d536 (patch) | |
tree | 82c4eb561195a26888879a1f0c4050a65368fb0d | |
parent | 6e02f366c9c852401d51fe1b6458e7418073c180 (diff) |
fix(mpv): add profile for mjpeg
-rwxr-xr-x | mpv/.config/mpv/mpv.conf | 27 | ||||
-rwxr-xr-x | sway/.local/bin/sway-mpv | 16 |
2 files changed, 35 insertions, 8 deletions
diff --git a/mpv/.config/mpv/mpv.conf b/mpv/.config/mpv/mpv.conf index ceff2a1..3dee90c 100755 --- a/mpv/.config/mpv/mpv.conf +++ b/mpv/.config/mpv/mpv.conf @@ -30,11 +30,30 @@ cache=yes demuxer-max-bytes=20M demuxer-max-back-bytes=1200M -[stream] -profile-desc=Enable better performance for streaming live video -profile-cond=p.path:match("twitch.tv/") ~= nil or get("media-title", ""):match("twitch.tv/") ~= nil or filename:match("[.]m3u8$") ~= nil -demuxer-max-bytes=8192k +[stdin] +profile-desc=reading from stdin +profile-cond=filename=="-" +save-position-on-quit=no +resume-playback=no +write-filename-in-watch-later-config=no + +[twitch] +profile-desc=streaming live video +profile-cond=path:find("twitch%.tv/") or get("media-title", ""):find("twitch%.tv/") or filename:find("%.m3u8$") save-position-on-quit=no +resume-playback=no write-filename-in-watch-later-config=no +taskbar-progress=no +demuxer-max-bytes=8192k + +[mjpeg] +profile-desc=streaming mjpeg video +profile-cond=video_format=='mjpeg' +profile=low-latency +cache=no +untimed=yes +correct-pts=no +container-fps-override=30 +save-position-on-quit=no resume-playback=no taskbar-progress=no diff --git a/sway/.local/bin/sway-mpv b/sway/.local/bin/sway-mpv index 67ec133..a586cb0 100755 --- a/sway/.local/bin/sway-mpv +++ b/sway/.local/bin/sway-mpv @@ -1,14 +1,22 @@ #!/bin/sh +# shellcheck disable=SC2011,SC2012,SC2016 if [ ! -t 0 ]; then set -- "$@" "$(cat)" elif [ $# -eq 0 ]; then - grep -Po '# title: \K.*' "$XDG_STATE_HOME"/mpv/watch_later/* | while IFS=: read -r file match; do - grep -Pom1 '# \K.*' "$file" | tr -d '\n' - printf ': %s\n' "$match" + ls -t -1 "$XDG_STATE_HOME"/mpv/watch_later/* | while read -r file; do + awk -f - "$file" <<-"EOF" + NR == 1 && /^# / && !/^# redirect entry/ { url = $0 } + END { + if (NR > 1 && sub(/^# /, "", url) && sub(/^# title: /, "")) { + printf "%s: %s\n", url, $0 + } + } + EOF done + exit 0 fi # shellcheck disable=SC2068 -swaymsg exec -- mpv --msg-level=all=no "${1%*:*}" +swaymsg exec -- mpv --msg-level=all=no "${1%: *}" |