Finally fixed the issue I was having with my ffmpeg incantation to crop a PocketCast clip. When I was uploading the clip to Micro.blog, the video wasn’t showing up. The audio was fine, but all I got for the visuals was a blank void1.

For those that are unaware, clips from PocketCast are always generated as vertical videos. You can change how the artwork is presented between vertical, horizontal, or square; but that doesn’t change the dimensions of the video itself. It just centers it in a vertical video geared towards TikTok, or whatever the equivalent clones are.

This, I did not care for. So I wanted to find a way to crop the videos to dimensions I find more reasonable (read: horizontal).

Here’s the ffmpeg command I’m using to do so. This takes a video of the “horizontal” PocketCast clip type and basically does a crop at the centre to produce a video with the 16:9 aspect ratio. This post shows how the cropped video turns out.

ffmpeg -i <in-file> \
  -vf "crop=iw:iw*9/16:(iw-ow)/2:(ih-oh)/2, scale=640:360" \
  -vcodec libx264 -c:a copy <out-file>

Anyway, back to the issue I was having. I suspect the cause was that the crop was producing a video with an uneven width. When I upload the cropped video to Micro.blog, I’ve saw in the logs that Micro.blog was downscaling video to a height of 360. This was using a version of the command that didn’t have the scale filter, and the original clip was 1920 x 1080. If you downscale it while maintaining the original 15:9 aspect ratio, the new dimensions should be 640 x 360. But for some reason, the actual width of the cropped video was 639 instead.

I’m not sure if this was the actual problem. I had no trouble playing the odd-width video in QuickTime. The only hint I had that this might be a problem was when I tried downscaling in ffmpeg myself, and ffmpeg threw up an error complaining that the width was not divisible by two. After forcing the video size to 640 x 360, and uploading it to Micro.blog, the video started coming through again. So there might be something there.

Anyway, it’s working now. And with everything involving ffmpeg, once you get something working, you never touch it again. 😄


  1. Not that there’s much to see. It’s just the podcast artwork. Not even a rendered scrubber. ↩︎