[PR #3052] fix(server): h264 and hevc not respecting max bitrate #9833

Closed
opened 2026-02-05 14:11:30 +03:00 by OVERLORD · 0 comments
Owner

Original Pull Request: https://github.com/immich-app/immich/pull/3052

State: closed
Merged: Yes


Description

H.264 and HEVC ignore -maxrate unless -bufsize is also specified. This PR adds -bufsize to the command when constraining bitrate with these codecs. The common suggestion is to set -bufsize to twice the max bitrate to allow budgeting more bandwidth for difficult frames. The max bitrate is then the max rolling average over any 2 second period.

Fixes #3050

Testing

  1. Set the target codec to h264 and set the max bitrate to a positive number.
  2. Transcode a video.
  3. Inspect the bitrate of this transcode. It should be very similar to the max bitrate or below it.
**Original Pull Request:** https://github.com/immich-app/immich/pull/3052 **State:** closed **Merged:** Yes --- ## Description H.264 and HEVC ignore `-maxrate` unless `-bufsize` is also specified. This PR adds `-bufsize` to the command when constraining bitrate with these codecs. The common suggestion is to set `-bufsize` to twice the max bitrate to allow budgeting more bandwidth for difficult frames. The max bitrate is then the max rolling average over any 2 second period. Fixes #3050 ## Testing 1. Set the target codec to `h264` and set the max bitrate to a positive number. 2. Transcode a video. 3. Inspect the bitrate of this transcode. It should be very similar to the max bitrate or below it.
OVERLORD added the pull-request label 2026-02-05 14:11:30 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#9833