Skip to content

Shell alias for macOS w/ IINA : full example #37

@Write

Description

@Write

Here's my script to use twitch-hls-client on macOS with IINA player.
It automatically creates a record folder based on twitch username and put all records here.

It's also completely hide the output and disown the process, so it's as detached as it can be from your terminal after the command is run.

This make it very easy to open a twitch stream by simply typing tw twitchusername in your console.

IINA Player

tw() {
    path_friendly_date=$(date +'%Y-%m-%d_%H-%M-%S')
    mkdir -p ~/twitch/"$@"/
    nohup ~/.cargo/bin/twitch-hls-client -s https://lb-eu5.cdn-perfprod.com/live/\[channel\] "$@" best -p /Applications/IINA.app/Contents/MacOS/iina-cli -r ~/twitch/"$@"/"$path_friendly_date".mp4 < /dev/null > /dev/null 2>&1 &
    disown
}

alias tw=tw

MPV

You can gain anywhere from 1 to 2 seconds with the help of "low-latency" params in MPV, which you would need to install trough brew install mpv

tw() {
    path_friendly_date=$(date +'%Y-%m-%d_%H-%M-%S')
    mkdir -p ~/twitch/"$@"/
    nohup ~/.cargo/bin/twitch-hls-client -s https://lb-eu5.cdn-perfprod.com/live/\[channel\] "$@" best -p /opt/homebrew/bin/mpv -r ~/twitch/"$@"/"$path_friendly_date".mp4 -a '- --profile=low-latency --no-cache' < /dev/null > /dev/null 2>&1 &
    disown
}

alias tw=tw

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions