Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Meta Engineering 5 min read Case study mediumAdept

Reducing Instagram’s basic video compute time by 94 percent

Instagram cut the compute cost of its basic adaptive bit rate (ABR) video encodings by 94 percent by reusing the frames from its progressive encodings and repackaging them into a DASH-capable file structure instead of transcoding from the original upload. Both encoding types used the same H.264 codec with only minor profile and preset differences, so repackaging with MP4Box takes about 0.36s of CPU time versus 86s for a full ffmpeg transcode. The tradeoff is worse compression efficiency for basic ABR. An A/B framework that replicated traffic across equal-capacity test and control pools showed the freed compute raised advanced-encoding watch time coverage by 33 percent, which more than made up for the loss.

Related posts

  • How Facebook encodes your videos

    Meta Engineering mediumAdept

    Facebook prioritizes advanced video encodings (VP9, slower H264 recipes) by a Benefit/Cost score instead of hard-coded rules. Benefit is relative compression efficiency at fixed quality, measured by Minutes of Video at High Quality per GB (MVHQ), multiplied by effective predicted watch time adjusted for device codec support. Cost is the normalized compute needed to finish the missing lanes of an encoding family, so priority rises as a family nears deliverability. Next-hour watch time comes from two ML models, one at upload time using creator history and one at view time using the video's watch trajectory. These are trained on rebalanced event data and evaluated with RMSE, MAPE, per-category metrics and threshold-based false positive/negative rates.

  • How Meta brought AV1 to Reels

    Meta Engineering mediumAdept

    Meta deployed AV1 encoding and delivery for Facebook and Instagram Reels, using SVT-AV1 for encoding and the dav1d software decoder on iOS and Android because most phones lack AV1 hardware decoders. Encoding uses a two-stage hybrid ABR pipeline: a fast hardware AVC pass at upload builds a convex hull of resolution/CRF points, and videos whose projected watch time crosses a threshold get a second software encode with AVC, VP9 or AV1 at the selected points. On Android, Meta ran a small on-device benchmark to score phone capability for A/B gating, mixed hardware VP9 and software AV1 decoding for ABR lane switches, and prefetched videos to hide decoder startup latency. On iPhone, AV1 cut average Reels bit rate by 12% and raised playback FB-MOS by about 0.6 points.

  • Enhancing HDR on Instagram for iOS With Dolby Vision

    Meta Engineering mediumAdept

    Instagram for iOS now preserves iPhone HDR metadata (ambient viewing environment and Dolby Vision) end to end, after FFmpeg-based server transcoding had been discarding it and degrading the image at low screen brightness. Meta upstreamed amve support to FFmpeg, implemented Dolby Vision Profile 8.4 to AV1 Profile 10.4 transcoding with fixes in libaom, SVT-AV1, dav1d and Shaka packager, and on the client extracts Dolby Vision metadata from its own AV1 decode path to feed AVSampleBufferDisplayLayer. A first A/B test showed lower watch time because the metadata added about 100 kbps and slowed loading. Switching to a compressed metadata format cut that to about 25 kbps, which required an FFmpeg bitstream filter and roughly 2000 lines of client-side decompression, and a second test showed increased time in app.

  • Scaling robotics datasets with video encoding

    Hugging Face mediumAdept

    LeRobot stores the camera frames of robotics datasets as AV1 video instead of per-frame PNGs. That cuts datasets to about 14% of their original size on average and as little as 0.2% at best, while keeping them usable for training. An FFmpeg benchmark across four datasets measured codec, pixel format, GOP size and CRF against size, decoding time, quality (MSE, PSNR, SSIM) and browser compatibility, using frame-access patterns typical of policy training. The chosen settings are libsvtav1 with yuv420p, g=2 and crf=30. With them, a single-frame load is about as fast as loading a PNG, and loading several consecutive frames takes 25–50% of the PNG time.

  • Adopting AV1 for Real-Time Communication (RTC) at Scale

    Meta Engineering mediumAdept

    Meta now runs AV1 for real-time video calls on most mobile devices in Messenger and WhatsApp. AV1 gives at least a 20% bitrate reduction over H.264/AVC on low-end and mid-range phones, which matters most below 100 kbps. Getting there took an internal low-complexity encoder with an ultra-low preset comparable to H.264, the dav1d decoder chosen for power efficiency, and binary-size cuts such as trimming the quantization-matrix tool. An ML-based rtc_score model decides which Android devices are eligible, while runtime encode/decode-latency monitoring adjusts presets, falls back to H.264, and allows asymmetric codecs, alongside further rate control and error resilience work.

The quest for software engineering knowledge.

Look:
Layout: