Skip to content

Scan: keep the 3D layout of a source that declares it only in the frame packing SEI #8286

Open

Description

@danielcamposramos

Description of the feature or enhancement you'd like to see in HandBrake

Hello,

This follows #5826 and #8100.

Some 3D sources declare their layout only inside the video stream, with the frame packing SEI, and have nothing in the container (no st3d box, no Matroska StereoMode).
The scan reads only the container's declaration, so for these sources the title has no 3D layout and the output is written as plain 2D: no mark in the container and no SEI from x264.

The decoder already gives the layout on the frames the scan decodes for the previews (AV_FRAME_DATA_STEREO3D).
The change reads it there and fills the title's layout only when the container gave none.
It is 8 lines in libhb/decavcodec.c, with no extra decoding, and a container declaration still wins.

The commit, on top of master 95b94af: Sparky-OS@9f2217a

May I open the pull request?
The patch was made with AI assistance and I tested it myself, as below. I will say so in the pull request, as the contribution guide asks.

What Operating System are you running?

Debian testing

What version of HandBrake are you running?

master 95b94af (2026-11-20), and the same with the commit above

Where did you download HandBrake from?

Built from source (GitHub), with the contribs and the configure switches of the Linux workflow

Activity Log, Crash Log or any other details

Test files: two seconds each, made with ffmpeg. H.264 from x264 with frame-packing=3 and 4, HEVC with the SEI inserted, all in MP4 with no st3d box, plus a 2D control.

master 95b94afe3
  sbs-h264-sei-only.mp4   no "scan: stereo 3d" line
  tab-h264-sei-only.mp4   no "scan: stereo 3d" line
  sbs-hevc-sei-only.mp4   no "scan: stereo 3d" line
  tab-hevc-sei-only.mp4   no "scan: stereo 3d" line
  control-2d.mp4          no "scan: stereo 3d" line
  x264 encode of sbs-h264-sei-only.mp4 to MP4: no stereo mark in the container, no frame packing SEI

with the commit
  sbs-h264-sei-only.mp4   scan: stereo 3d: side by side
  tab-h264-sei-only.mp4   scan: stereo 3d: top and bottom
  sbs-hevc-sei-only.mp4   scan: stereo 3d: side by side
  tab-hevc-sei-only.mp4   scan: stereo 3d: top and bottom
  control-2d.mp4          no "scan: stereo 3d" line
  x264 encode of sbs-h264-sei-only.mp4 to MP4 and MKV: container says side by side, frame packing SEI in the stream
  x264 encode of tab-hevc-sei-only.mp4 to MP4 and MKV: container says top and bottom, frame packing SEI in the stream
  x264 encode of control-2d.mp4 to MP4 and MKV: no mark

The five test files: https://github.com/Sparky-OS/HandBrake/tree/order742-sei-only-samples/samples/sei-only-scan

Thanks,
Daniel

Activity

  1. github-actions commented on Nov 20, 2026

    @github-actions

    Hello, and welcome to the HandBrake repository.

    This is an automated message from the HandBrake Bot.

    Important

    Please make sure you have completed the issue template and provide all the requested information.

    Warning

    Be cautious of replies asking you to download DLLs or other files from third-party websites, particularly from users who are not members of the HandBrake team. These downloads may be malicious.
    HandBrake team members have a “Member” label beside their comments.

    Tip

    See the HandBrake documentation for guidance and troubleshooting. Please also follow our Code of Conduct.

    Thank you,
    The HandBrake Bot

  2. galad87 commented on Nov 23, 2026

    @galad87
    Contributor

    I guess, but probably it would be better to not create such files in the first place.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions