Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gst-python gst-python
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 43
    • Issues 43
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GStreamerGStreamer
  • gst-pythongst-python
  • Issues
  • #47
Closed
Open
Issue created Jun 18, 2021 by Alberto Ruiz@arclnx

GstVideo.VideoInfo fails to report width height

The following snippet fails to report width/height (maybe other fields as well) on gstreamer 1.19.1 compared to 1.18:

import gi
gi.require_version('Gst', '1.0')
gi.require_version('Gtk', '3.0')
gi.require_version('GstVideo', '1.0')

from gi.repository import Gst, Gtk, GstVideo, Gio

caps_string = "video/x-raw, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, format=(string)BGRx, colorimetry=(string)1:1:0:0"

if __name__ == '__main__':
    Gst.init(None)
    vinfo = GstVideo.VideoInfo()
    caps = Gst.Caps.from_string(caps_string)
    print(caps.to_string())
    vinfo.from_caps(caps)
    print(vinfo.width, vinfo.height)

In contrast, the equivalent C code does report the right width/height:

#include <glib.h>
#include <glib/gprintf.h>
#include <gst/gst.h>
#include <gst/video/video.h>

#define CAPS_TXT "video/x-raw, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, format=(string)BGRx, colorimetry=(string)1:1:0:0"

int main(int argc, char** argv) {
  gst_init (&argc, &argv);
  
  GstCaps *caps = gst_caps_from_string(CAPS_TXT);
  if (!caps) {
    g_printerr("nocaps\n");
    return -1;    
  }
                                  
  GstVideoInfo *vinfo = gst_video_info_new();
  
  if (!gst_video_info_from_caps (vinfo, caps)) {
    g_printerr("could not create from caps\n");
    return -1;
  }
  
  g_printf("width: %d, height: %d\n", vinfo->width, vinfo->height);
  
  return 0;
}
Assignee
Assign to
Time tracking