But first, I'd need to shave a yak.
You see, the slam-dunk tool for doing something like this is ffmpeg. The only problem is that you can't just download ffmpeg from the macOS app store. You can get it from homebrew, but if you're going to trust some janky package off the internet, well, you might as well go all-in and build it from source. At least then you know what's in it.
What's not in it is a few necessary libraries. I'd need one to handle the MP3 encoding. And for that I'd need pkg-config. And at least I already had Xcode and its command-line utilities installed, so that yak was already shaved. Here's what I ran on the command-line to get it all working.
Step 1, build and install pkg-config on a Silicon Mac:
As of this writing, the latest version is 0.29.2. You should probably pop over to the releases site in a browser and see what the current version is. But here's what works for 0.29.2.
cd /tmp
curl -OL https://pkg-config.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
tar -xzf pkg-config-0.29.2.tar.gz
cd pkg-config-0.29.2
CFLAGS="-Wno-int-conversion" CXXFLAGS="-Wno-int-conversion" \
./configure --with-internal-glib
make
sudo make install
pkg-config --version # should return 0.29.2
cd ..
Step 2, build and install LAME (for MP3 support)
As of this writing, LAME is version 3.100, so that's what I used. Go double-check there's not a newer one.
curl -OL https://sourceforge.net/projects/lame/files/lame/3.100/lame-3.100.tar.gz
tar -xzf lame-3.100.tar.gz
cd lame-3.100
sed -i -e "/lame_init_old/d" include/libmp3lame.sym
./configure
make
sudo make install
lame --version # Should say 3.100
cd ..
Step 3, build and install H.264 support (optional, but I wanted it)
This will grab the latest no matter what.
git clone https://code.videolan.org/videolan/x264.git
cd x264
./configure --enable-static
make
sudo make install
h264 --version # Should show a version and that you just built it
cd ..
Step 4, build and install ffmpeg (finally)
They'd just released version 8 so that's what I went with. As before, check my version numbers against whatever's current and modify these commands as appropriate.
curl -OL https://ffmpeg.org/releases/ffmpeg-8.0.tar.gz
tar -xzf ffmpeg-8.0.tar.gz
cd ffmpeg-8.0
./configure --prefix=/usr/local --enable-gpl \
--enable-nonfree --enable-libmp3lame --enable-libx264 \
--enable-shared
make
sudo make install
ffmpeg # Should show version and usage information
cd ..
Step 5, try it out
My original goal was to strip the audio out of an mp4 and have an mp3 as the result. Here's an ffmpeg command that does that, assuming you have a file called test-clip.mp4 in the current working directory and want to produce a file called test-clip.mp3.
ffmpeg -i test-clip.mp4 -vn -codec:a libmp3lame test-clip.mp3
Works on my laptop! (tm)
Hopefully this saves someone some time. If you try this on your own Sequoia system on Silicon and find you have to change anything, please let me know!