# scrcpy Video Codecs: H.264 vs H.265 vs AV1 Differences Explained

> Explore scrcpy video codec differences: H.264 vs H.265 vs AV1. Understand latency, compression efficiency, and hardware support to optimize your screen mirroring experience.

- Repository: [Genymobile/scrcpy](https://github.com/Genymobile/scrcpy)
- Tags: deep-dive
- Published: 2026-02-25

---

**scrcpy supports three video codecs—H.264 (AVC), H.265 (HEVC), and AV1—with H.264 as the default for lowest latency, H.265 offering ~50% better compression efficiency, and AV1 providing next-generation efficiency on supported hardware.**

scrcpy, the popular open-source Android screen mirroring tool from Genymobile, streams your device display using hardware-accelerated video encoding. Understanding how **scrcpy video codecs** differ helps you optimize for real-time gaming, bandwidth-constrained remote sessions, or high-quality archival recordings based on your specific hardware capabilities.

## How scrcpy Selects Video Codecs

Codec selection begins in the command-line interface defined in [`app/src/cli.c`](https://github.com/Genymobile/scrcpy/blob/main/app/src/cli.c). The `--video-codec` option accepts `h264`, `h265`, or `av1`, defaulting to H.264 when unspecified【9†L886-L892】.

On the Android device, scrcpy instantiates a `MediaCodec` encoder corresponding to your selection. Qualcomm devices expose hardware encoders like `OMX.qcom.video.encoder.avc` for H.264 and `OMX.qcom.video.encoder.hevc` for H.265【9†L998-L1000】. The encoded bitstream travels to the host, where [`app/src/demuxer.c`](https://github.com/Genymobile/scrcpy/blob/main/app/src/demuxer.c) processes both H.264 and H.265 as "H.26x" streams, merging configuration packets with media data when necessary【10†L26-L30】.

## H.264 (AVC): The Default Codec

H.264 remains the default **scrcpy video codec** because it offers the lowest latency and broadest hardware support. According to source code comments in [`app/src/cli.c`](https://github.com/Genymobile/scrcpy/blob/main/app/src/cli.c), H.264 provides the "lowest latency" among available options【9†L890-L892】.

Virtually every Android device manufactured in the last decade includes a hardware H.264 encoder, making this the safest choice for real-time mirroring. The decoder on the host side uses FFmpeg's `avcodec` via [`app/src/decoder.c`](https://github.com/Genymobile/scrcpy/blob/main/app/src/decoder.c), ensuring efficient software decoding even on older host machines.

## H.265 (HEVC): Better Compression Efficiency

H.265 delivers approximately **50% better compression efficiency** compared to H.264, meaning you can achieve equivalent visual quality at roughly half the bitrate. This makes H.265 ideal for recording high-resolution gameplay or mirroring over limited bandwidth connections.

However, H.265 support depends on newer hardware. The encoder requires devices with HEVC-capable chips, and the source code indicates that latency is slightly higher than H.264 due to more complex prediction algorithms【9†L890-L892】. If your device lacks hardware H.265 support, scrcpy may fall back to software encoding, causing significant CPU load or connection failures.

To enable H.265:

```bash
scrcpy --video-codec=h265 --max-size=1920 --max-fps=60

```

## AV1: Next-Generation Efficiency

AV1 represents the newest **scrcpy video codec** option, offering superior compression efficiency compared to both H.264 and H.265. While the source code includes AV1 as a valid `--video-codec` option alongside H.264 and H.265【9†L886-L892】, hardware encoder availability remains limited to the newest flagship Android devices.

When available, AV1 provides excellent quality at lower bitrates than H.265, making it suitable for archiving recordings or streaming over constrained networks. However, decoding AV1 on the host requires recent FFmpeg builds with AV1 support, and encoding latency may vary based on hardware implementation maturity.

## Recording Formats and the AVI Myth

A common point of confusion involves AVI format support. While scrcpy supports three video codecs, it only records to **MP4** or **MKV** containers. The `--record-format` option in [`app/src/cli.c`](https://github.com/Genymobile/scrcpy/blob/main/app/src/cli.c) explicitly defines these two choices【9†L994-L1000】.

AVI is a legacy container format, not a video codec. scrcpy's recording pipeline in [`app/src/recorder.c`](https://github.com/Genymobile/scrcpy/blob/main/app/src/recorder.c) utilizes FFmpeg's `avformat` API to write MP4 (`mov`) or MKV (`matroska`) files. No code path exists for AVI generation because AVI lacks support for modern features like variable frame rates and metadata required by H.265 and AV1.

If you require AVI files, you must pipe the raw H.26x stream to an external tool:

```bash
scrcpy --no-display --output-format=h264 - --record-format=raw \
  | ffmpeg -f h264 -i - -c copy output.avi

```

## Performance Comparison

| Feature | H.264 | H.265 | AV1 |
|---|---|---|---|
| **Compression** | Good | ~50% better than H.264 | Best efficiency |
| **Latency** | Lowest【9†L890-L892】 | Slightly higher | Variable (newer hardware) |
| **Device Support** | Universal | Newer devices only | Latest flagships only |
| **Host Decoding** | Lightweight | Moderate | Requires recent FFmpeg |
| **Best Use Case** | Live mirroring, gaming | Recording, limited bandwidth | Archiving, future-proofing |

## Summary

- **H.264** remains the default **scrcpy video codec**, offering universal hardware support and the lowest latency for real-time mirroring.
- **H.265** provides approximately 50% better compression efficiency than H.264, making it ideal for high-quality recordings and bandwidth-constrained scenarios, though it requires newer Android hardware.
- **AV1** delivers next-generation compression efficiency but requires the latest flagship devices and recent FFmpeg builds on the host.
- scrcpy records only to **MP4** or **MKV** containers; **AVI** is not supported as it is a legacy container format, not a video codec.
- The codec selection is handled in [`app/src/cli.c`](https://github.com/Genymobile/scrcpy/blob/main/app/src/cli.c), while stream processing occurs in [`app/src/demuxer.c`](https://github.com/Genymobile/scrcpy/blob/main/app/src/demuxer.c) and decoding in [`app/src/decoder.c`](https://github.com/Genymobile/scrcpy/blob/main/app/src/decoder.c).

## Frequently Asked Questions

### What is the default video codec in scrcpy?

**H.264 (AVC)** is the default video codec in scrcpy. According to the CLI definition in [`app/src/cli.c`](https://github.com/Genymobile/scrcpy/blob/main/app/src/cli.c), H.264 provides the lowest latency among available options and works on virtually every Android device with hardware acceleration【9†L886-L892】.

### Can scrcpy record video in AVI format?

**No**, scrcpy cannot record directly to AVI format. The tool only supports **MP4** and **MKV** containers as defined by the `--record-format` option in [`app/src/cli.c`](https://github.com/Genymobile/scrcpy/blob/main/app/src/cli.c)【9†L994-L1000】. AVI is a legacy container format, not a video codec, and scrcpy's recording pipeline in [`app/src/recorder.c`](https://github.com/Genymobile/scrcpy/blob/main/app/src/recorder.c) does not include an AVI code path.

### Does using H.265 in scrcpy reduce video quality?

**No**, H.265 (HEVC) does not reduce video quality compared to H.264. In fact, H.265 achieves approximately **50% better compression efficiency**, meaning you can maintain the same visual quality at roughly half the bitrate, or achieve higher quality at the same bitrate. However, H.265 requires newer Android hardware and may introduce slightly higher latency than H.264【9†L890-L892】.

### Why does scrcpy not support AVI if it supports multiple codecs?

**scrcpy treats codecs and containers separately.** While the tool supports H.264, H.265, and AV1 video codecs, the recording container is limited to MP4 or MKV because these formats support modern features like variable frame rates and metadata required by newer codecs. AVI is a legacy container that lacks support for these modern codec requirements, and scrcpy's FFmpeg-based recording pipeline in [`app/src/recorder.c`](https://github.com/Genymobile/scrcpy/blob/main/app/src/recorder.c) only implements MP4 (`mov`) and MKV (`matroska`) outputs【9†L994-L1000】.