Fixing Mastodon 'Error processing thumbnail for uploaded media' video uploading

For a while now, I have been unable to upload video files to Mastodon.

This wasn’t a big deal for me, but it annoys me when something doesn’t work properly.

The error

When I tried to upload a video file, whatever client I used, the client showed me:

Error processing thumbnail for uploaded media

I am using systemd, so using journalctl -xf -u mastodon-*, I could check for errors:

Dec 31 10:46:40 nuc3 bundle[1821133]: I, [2023-12-31T10:46:40.440676 #1821133]  INFO -- : [3f36f4e6-7590-48f8-a3fe-8702c948e75a] [paperclip] Trying to link /tmp/RackMultipart20231231-1821133-6sjqks.mp4 to /tmp/a8d3d90cc8e90dcfdc8488e73d3f488320231231-1821133-wqoboq.mp4
Dec 31 10:46:40 nuc3 bundle[1821133]: I, [2023-12-31T10:46:40.441711 #1821133]  INFO -- : [3f36f4e6-7590-48f8-a3fe-8702c948e75a] [paperclip] Trying to link /tmp/a8d3d90cc8e90dcfdc8488e73d3f488320231231-1821133-wqoboq.mp4 to /tmp/eedc39f29c5a065e7e145dd0507a679c20231231-1821133-xhtbdm.mp4
Dec 31 10:46:40 nuc3 bundle[1821133]: I, [2023-12-31T10:46:40.442215 #1821133]  INFO -- : [3f36f4e6-7590-48f8-a3fe-8702c948e75a] Command :: file -b --mime '/tmp/eedc39f29c5a065e7e145dd0507a679c20231231-1821133-xhtbdm.mp4'
Dec 31 10:46:40 nuc3 bundle[1821133]: E, [2023-12-31T10:46:40.811935 #1821133] ERROR -- : [3f36f4e6-7590-48f8-a3fe-8702c948e75a] Paperclip::Error: Error while transcoding /tmp/a8d3d90cc8e90dcfdc8488e73d3f488320231231-1821133-wqoboq.mp4: unsupported file

I raised an issue, but no luck so far.

The fix

I removed ffmpeg, with:

apt remove ffmpeg

I then put static binaries of ffmpeg and ffprobe into /usr/local/bin/, which was already in my mastodon user’s $PATH:

cd /tmp
wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz
tar -xvf ffmpeg-git-amd64-static.tar.xz
cp ffmpeg-git-20231229-amd64-static/ffmpeg /usr/local/bin/
cp ffmpeg-git-20231229-amd64-static/ffprobe /usr/local/bin
chmod +x /usr/local/bin/ffmpeg
chmox +x /usr/local/bin/ffprobe

And it worked.

I can now upload images.

Why did this fix it?

I don’t know.

I wish I did.

I’d have thought that the stock Debian version of ffmpeg, installed through apt, should have been fine.