Tag: powershell

Splitting MKV files by chapter using ffmpeg

PowerShell Script

Created a small PowerShell scripts to split up MKV files by chapters. I wanted to avoid downloading yet another tool (handbrake or MKVToolNix) and I like the idea that I can use ffmpeg to do everything. For context, I have a DVD of Weird Al's ultimate music video collection that I got in middle school that I want available in Plex. I used MakeMKV to rip the DVD but all the music videos are in a single file, separated by chapters.

Weird Al
# / 2025 / 12 / 30

Set default pipe/redirect encoding in Python

[via] Changing default encoding of Python? - StackOverflow

I ran into an issue using llm today where I was unable to save a response to a file using a pipe

llm llm logs -n 1 | Out-File response.txt
This would give me the error "UnicodeEncodeError: 'charmap' codec can't encode character '\u2192' in position 2831: character maps to <undefined>"

If you set the "PYTHONIOENCODING" environment variable to "utf8", it will fix the issue. This is because Python's default encoding is ASCII. Since the last response I got back from the model contained a non-ASCII character, this error was thrown.

So now, in my PowerShell profile, I've added a line to set the default to utf8, which fixes the issue.

$env:PYTHONIOENCODING = 'utf8'
# / 2025 / 04 / 21

Update all llm plugins

Quick one-liner to update all llm plugins using PowerShell:

llm plugins | ConvertFrom-Json | % { llm install -U $_.name }
# / 2025 / 04 / 21