FFmpeg transcoding for the Web

Not really Fedora specific especially since my build of FFmpeg isn’t Fedora’s (or RPMfusion’s) build so I thought water cooler was as good a place as any.

As I’ve mentioned before, I work with a cat rescue. Tonight while cleaning the kennels at Petco (our rescue uses foster homes, not kennels, but cats for adoption through Petco are in kennels there—a necessary evil) two of the cats were doing something really cute and I used my Pixel 9 to take a 15 second video.

The video is 67.3 MB and is 1920x1080.

Just as an experiment, I used FFmpeg to make a VP9 transcode:

ffmpeg -i input.mp4 -c:v libvpx-vp9 -an output-vp9.webm

It came out really well, just under 15MB, much better file size if I want to put it on the web, and the quality is much better than I thought it would be. Camera phones have come a long way. So as another experiment, I tried AV1:

ffmpeg -i input.mp4 -c:v libaom-av1 -crf 30 -an output-av1.webm

It’s been running for almost an hour now, if I am reading things right, it looks like a little over four seconds have been encoded. I’m curious to see the file size when done, and how -crf 30 compares with VP9.

Reason it’s taking so long is likely that my CPU is kind of old at this point (Xeon E3 series) and I have no hardware acceleration. I don’t think AV1 is suitable for web content yet as it seems some browsers only display it if there is hardware assisted decoding (same is true with H.265) but I wanted to try it anyway.

Anyway, I know generally people use H.264 to upload services like YouTube but is it okay to just upload as VP9? Is there anything different I should do with my ffmpeg command for VP9 sans audio? I’m thinking about maybe running a YouTube channel for the rescue where videos of our cats doing absolutely adorable things can be posted because anything to get adopters is a good thing.

The AV1 encoding finally finished!

frame=  976 fps=0.1 q=0.0 Lsize=    9364KiB time=00:00:16.93 bitrate=4529.9kbits/s speed=0.00131x elapsed=3:34:40.38

The quality is either the same or a tad bit better and the filesize is smaller (9.6 MB verses 14.7 MB), roughly 2/3 the file size. AV1 is amazing but hardware assisted encoding is clearly a must for anything serious. Decoding at least at 1080p seems to work just fine without hardware assistance (both this video and others around web I tested).