Skip to content

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

Meta Engineering 9 min read Case study mediumAdept

Bringing HDR video to Reels

Facebook and Instagram Reels now accept HDR uploads from phone camera rolls and play them back in full HDR, which required handling HLG and PQ formats across a fragmented device landscape. Early on, HDR uploads were tone mapped to SDR on the client: Apple's native APIs on iOS, and on Android custom shaders that read the transfer function from metadata and convert YUV frames to BT.709. The server pipeline now keeps the original HDR and produces both HDR and SDR encodings using a tuned Hable tone mapping operator, doubling compute for HDR videos, which the Meta Scalable Video Processor absorbs. Because iOS dims SDR content next to HDR, Explore grids tone map videos on the fly, while Reels applies a brightness multiplier so SDR overlays render at HDR brightness and white text stays legible.

Related posts

  • 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.

  • 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.

  • Better video for mobile RTC with AV1 and HD

    Meta Engineering mediumAdept

    Meta improved 1:1 mobile RTC video in Messenger, Instagram and WhatsApp by moving from H.264 to software AV1 for low-bandwidth calls (under 300 Kbps). AV1's palette mode, intra-block copy and reference picture resampling help with screen content and avoid key frames on resolution changes, and custom scalers plus face-based region-of-interest encoding add further gains. The costs are roughly 3x encoder CPU, a 5-6% battery increase and more out-of-memory crashes. Meta handles these with a hybrid encoder that switches to H.264 mid-call based on CPU, battery or encode time, and by disabling AV1 on low-memory devices. A lightweight in-product PSNR estimate showed about 2 dB gain over H.264, and an HD mode (720p, 30 fps, 3.5 Mbps) for high-end networks required better congestion detection, including ISP throttling detection.

  • What the iPhone Duo means for web development

    Mux mediumAdept

    Safari on the foldable iPhone Duo exposes the Device Posture API and Viewport Segments API behind WebKit feature flags. They let pages detect a folded posture via `navigator.devicePosture` or `@media (device-posture: folded)` and position content per screen segment with `env(viewport-segment-*)` variables. Using these plus a flagged Fullscreen API, a Netflix-style folded video player was built from Video.js v10 components, with video on the top half and tiled controls on the bottom. A blurred, mirrored reflection is drawn by copying frames to a small canvas via requestVideoFrameCallback, since -webkit-box-reflect doesn't work on video in iOS Safari. In practice it needs three feature flags on iOS, and Chromium on a Pixel Fold clips fullscreen content to the top half, so the design isn't shippable today.

  • Why xHE-AAC is being embraced at Meta

    Meta Engineering mediumAdept

    Meta has deployed the xHE-AAC codec across Facebook and Instagram (including Reels and Stories) for two main capabilities: client-side loudness management and seamless adaptive bitrate audio. Rather than burning a target loudness and DRC profile into the encode, Meta keeps the original audio and ships MPEG-D DRC loudness metadata so each client applies a target level and DRC effect suited to headphones, speakers or noisy environments. Audio ABR works by placing immediate playout frames (IPFs) at the start of each aligned DASH segment, keeping sample rate and channel configuration constant across lanes, and giving each lane a unique stream ID; this reduced playback stalls on Facebook for Android. Encoding uses Fraunhofer's SDK in two-pass mode, which measures loudness first and enables loudness range control DRC to avoid pumping artifacts, with shaka-packager producing the DASH output.

The quest for software engineering knowledge.

Look:
Layout: