Skip Home Changes Edit Add Diff Upload

2025-01-11 ffmpeg and fish, yt-dlp

If you know, you know. The ffmpeg command line options. 🤨

Let me collect some function definitions on this page. I’ll be adding more over the years to come, for sure.

function video-resolution
    ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of default=nw=1 $argv
end

# download audio only
yt-dlp --extract-audio --audio-format mp3 URL

# extract audio without converting
ffmpeg -i input.mp4 -vn -acodec copy output.aac

# convert to mp3
ffmpeg -i input.mp4 output.mp3

# ensure that the files are not too big to play on the MNT Pocket Reform
yt-dlp -S res:720 URL

also suggested:

you can also limit the framerate and bitrate, like this: -f bestvideo[vbr<=?2500][height<=?1080][fps<=?30]+bestaudio/best

#ffmpeg #fish #diff #ssh #zip #git

2025-03-14. Some functions. Create or edit using funced xxx --save.

function ediff --description 'Compare two files using Emacs'
    emacs -nw --eval "(ediff \"$argv[1]\" \"$argv[2]\")"
end

function ssh-copy --description 'Copy text to the local clipboard'
    read -z -l input
    printf "\033]52;c;"
    printf "%s" $input | base64
    printf "\a"
end

2025-08-27. More functions.

function diff-zip --description 'Compare two zip files'
    if test (count $argv) != 2
        echo Usage: diff-zip ARCHIVE-1 ARCHIVE-2
        return
    end
    diff -y (unzip -qql $argv[1]|sort -k4|psub) (unzip -qql $argv[2]|sort -k4|psub)
end

2025-09-10. A while ago I added the ls alias to my git config so that git ls prints something that looks like what I get in magit with l b.

[alias]
        ls = log --format=\"%C(auto)%h %d %<|(120,trunc)%s %Cred%<|(140,trunc)%an%Creset %ad\" --graph --date-order --all --date=human

2025-09-20. Encoding videos for the homepage.

function video-encode-for-web --description 'To 1280×720 MP4'
    for f in $argv
        ffmpeg -i $f -s 1280x720 (string split . -m1 -r $f|head -n1).mp4
    end
end