HandBrake / HandBrake/HandBrake

Subtitles Stretched/Incorrectly Scaled When Resizing Video from Non-Standard Resolution with Non-Square Pixels (Regression in 1.6.1+)

Open
#7,343 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
C
Stars
24.4k
Forks
1.7k
Avg merge
5d 1h
Merged PRs (30d)
8

Description

Problem Description

Burned-in subtitles are being incorrectly scaled/stretched horizontally when encoding a video with a non-standard storage resolution but a standard Display Aspect Ratio (DAR), specifically when forcing a resolution limit (like 1080p) in HandBrake. This issue began in version 1.6.1 and persists in all newer versions. It was not present in version 1.6.0.

Details
  • Source Video Properties:

    Width (Storage): 1920 pixels
    Height (Storage): 1280 pixels
    Display Aspect Ratio (DAR): 16:9
    Note: This requires non-square pixels to achieve the 16:9 DAR.

  • Encoding Action:

    The subtitle track is selected and the "Burn In" option is enabled.
    The resolution limit is set to 1080p (e.g., using the "Resolution Limit: 1080p HD" settings, or manually setting the output height to 1080).
    The goal is to store the video at 1920x1080 pixels (1:1 square pixels, 16:9 DAR).

  • Resulting Issue:

    The output video's burned-in subtitles appear stretched (wider) compared to the source and the output from version 1.6.0.
    This suggests the subtitle rendering/compositing step is not correctly accounting for the aspect ratio conversion when resizing the non-square-pixel source (1920x1280 @ 16:9) to the square-pixel target (1920x1080 @ 16:9).

Screenshots Illustrating the Issue
  • Encoded with Handbrake 1.6.0

  • 1.6.0
  • Encoded with Handbrake 1.6.1 (or any newer)

  • 1.6.1
Suggested Fix / Root Cause

This regression is strongly suspected to be caused by code changes in the following commit:
Commit URL: https://github.com/HandBrake/HandBrake/commit/d56ec51e26dcac5dc82c6f2466a18bad6be69627

The commit appears to have removed the critical logic that calculated and passed the Pixel Aspect Ratio (PAR) information to the subtitle renderer. This is essential for correctly scaling subtitles when moving from a non-square-pixel source to a square-pixel target while maintaining the video's aspect ratio. Reverting or revising this logic should resolve the stretching.

Reproduction Steps
  • Obtain a source video file with the characteristics mentioned above (1920x1280 @ 16:9 DAR).
  • Open the video in HandBrake 1.6.1 or newer.
  • Go to the Dimensions tab. Set Resolution Limit to 1080p HD.
  • Go to the Subtitles tab, select a track, and ensure the "Burn In" box is checked.
  • Start the encode.
  • Playback the resulting video and observe the subtitles—they will be horizontally stretched.
Activity Log, Crash Log or any other details
HandBrake Activity Log does not explicitly show a relevant error; the issue is the visual output (stretched subtitles) after the encode completes.
What Operating System are you running?

Windows 10, Linux (Debian)
This issue is reproducible across multiple operating systems.

What version of HandBrake are you running?

Affected versions: 1.6.1 through the latest nightly/release.
Last working version: 1.6.0.

Where did you download HandBrake from?

handbrake.fr, github

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing commit d56ec51e26dcac5dc82c6f2466a18bad6be69627 and the subtitle rendering path involved in burned-in subtitles. Reproduce the case with a 1920x1280, 16:9-DAR source, a 1080p resolution limit, and burned-in subtitles, comparing the result with HandBrake 1.6.0. Done means subtitles are no longer horizontally stretched in newer versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
audio-video-rtc
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.