Skip to content

[video] Add averageBitrate and peakBitrate for video tracks#41532

Merged
behenate merged 2 commits intomainfrom
@behenate/video/separate-bitrate-fields
Dec 11, 2025
Merged

[video] Add averageBitrate and peakBitrate for video tracks#41532
behenate merged 2 commits intomainfrom
@behenate/video/separate-bitrate-fields

Conversation

@behenate
Copy link
Copy Markdown
Member

Why

Currently we provide the bitrate field, which behaves the same as the bitrate field in ExoPlayer - it reports peak bitrate or average if peak is unavailable.

There are currently a few issues with this:

  1. There is no way to know which of those is reported.
  2. On iOS we weren't able to read peak bitrate for sources in MPEG-4 container at all since the AVKit doesn't provide this information
  3. I decided that i really don't like this ambiguous way of reporting bitrate

How

Add averageBitrate and peakBitrate fields for much clearer bitrate reporting.

On iOS use the metadata fields to find the btrt box, which contains bitrate information. This is not the most reliable solution, but should work for most common sources where the source actually reports the peak bitrate (for our test sources we have parity with ExoPlayer peak bitrate reporting).

I also marked the bitrate field as deprecated

Test Plan

Tested in BareExpo and Android

@github-actions
Copy link
Copy Markdown
Contributor

Subscribed to pull request

File Patterns Mentions
docs/** @amandeepmittal
packages/expo-video/** @lukmccall, @aleqsio

Generated by CodeMention

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Dec 10, 2025
@behenate behenate force-pushed the @behenate/video/separate-bitrate-fields branch from 20c065d to e181c97 Compare December 10, 2025 11:35
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Dec 10, 2025
@expo-bot
Copy link
Copy Markdown
Collaborator

expo-bot commented Dec 10, 2025

The Pull Request introduced fingerprint changes against the base commit: dcbb313

Fingerprint diff
[
  {
    "op": "changed",
    "beforeSource": {
      "type": "dir",
      "filePath": "../../packages/expo-video/android",
      "reasons": [
        "expoAutolinkingAndroid"
      ],
      "hash": "aaa8c285db73e770d84b7cd8566eede93b069405"
    },
    "afterSource": {
      "type": "dir",
      "filePath": "../../packages/expo-video/android",
      "reasons": [
        "expoAutolinkingAndroid"
      ],
      "hash": "049483bf0a0d5776fdc48b29f3d872033f36d705"
    }
  },
  {
    "op": "changed",
    "beforeSource": {
      "type": "dir",
      "filePath": "../../packages/expo-video/ios",
      "reasons": [
        "expoAutolinkingIos"
      ],
      "hash": "2a27dec09277e07b57e4773e36c3d02ede152da4"
    },
    "afterSource": {
      "type": "dir",
      "filePath": "../../packages/expo-video/ios",
      "reasons": [
        "expoAutolinkingIos"
      ],
      "hash": "88b7a9893d5d99d672da77cb9385c5b21276dca8"
    }
  }
]

Generated by PR labeler 🤖

@behenate behenate force-pushed the @behenate/video/separate-bitrate-fields branch from b5974c1 to 264e5d4 Compare December 11, 2025 11:05
@behenate behenate merged commit 4415091 into main Dec 11, 2025
11 of 12 checks passed
@behenate behenate deleted the @behenate/video/separate-bitrate-fields branch December 11, 2025 11:07
aleqsio pushed a commit that referenced this pull request Dec 22, 2025
# Why

Currently we provide the `bitrate` field, which behaves the same as the
`bitrate` field in `ExoPlayer` - it reports peak bitrate or average if
peak is unavailable.

There are currently a few issues with this: 
1. There is no way to know which of those is reported.
2. On iOS we weren't able to read peak bitrate for sources in MPEG-4
container at all since the AVKit doesn't provide this information
3. I decided that i ***really*** don't like this ambiguous way of
reporting bitrate

# How

Add `averageBitrate` and `peakBitrate` fields for much clearer bitrate
reporting.

On iOS use the metadata fields to find the `btrt` box, which contains
bitrate information. This is not the most reliable solution, but should
work for most common sources where the source actually reports the peak
bitrate (for our test sources we have parity with ExoPlayer peak bitrate
reporting).

I also marked the bitrate field as deprecated

# Test Plan

Tested in BareExpo and Android
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot: fingerprint changed bot: passed checks ExpoBot has nothing to complain about

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants