Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gst-plugins-base gst-plugins-base
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 645
    • Issues 645
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 88
    • Merge requests 88
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GStreamer
  • gst-plugins-basegst-plugins-base
  • Issues
  • #656

Closed
Open
Created Aug 21, 2019 by Alex@monstasat

glvideomixer: Implicit video scaling behaviour

Both GLVideoMixer and Compositor plugins scale picture size which is set by the user for each pad (GstCompositorPad for Compositor plugin). I've noticed that the scaling behavior differs a lot dependent on the picture size. The code which handles scaling of width and height can be found here.

  if (pad_height % dar_n == 0) {
    pad_width = gst_util_uint64_scale_int (pad_height, dar_n, dar_d);
  } else if (pad_width % dar_d == 0) {
    pad_height = gst_util_uint64_scale_int (pad_width, dar_d, dar_n);
  } else {
    pad_width = gst_util_uint64_scale_int (pad_height, dar_n, dar_d);
  }

Here are two examples to describe the issue. In both cases PAR is 16x11:

Example 1:

  1. Picture size is set to 880x704. Calculated DAR is 20x11
  2. According to the code above, first condition is false, second condition is true (880 / 11 = 80)
  3. The resulting height is (880 * 11 / 20) = 484
  4. The resulting resolution is 880x484

Example 2:

  1. Picture size is set to 880x705 resolution. Calculated DAR is 256/141
  2. According to the code above, we go to the else case
  3. The resulting width is (705 * 256 / 141) = 1280
  4. The resulting resolution is 1280x705

In the first example, video fits into the provided size, but in the second one it overflows. IMO, the resulting video size should not differ so much. Maybe there should be a property to choose the desired behavior. Maybe the video should always fit the provided size. At least I think it is more expected by the user.

Assignee
Assign to
Time tracking