【问题标题】:GStreamer - swap color channels of RGB-videoGStreamer - 交换 RGB 视频的颜色通道
【发布时间】:2016-01-27 01:24:57
【问题描述】:

我是 GStreamer 的新手,我尝试交换 RGB 视频的颜色通道。 (例如红色到蓝色)。如何使用 gst-launch 做到这一点?

我浏览了这个列表,但我找不到一个元素来做到这一点:http://gstreamer.freedesktop.org/documentation/plugins.html

【问题讨论】:

  • 不确定这在 gst-launch 中是否可行,当然可以通过编程方式实现。您可以使用 gst-launch-1.0 videotestsrc ! videoconvert ! coloreffects preset=yellowblue ! videoconvert ! autovideosink 更改一些颜色 .. 但这不是您想要的 - 但它很有趣
  • 也许你可以用故障上限欺骗 videoconvert 让它认为它是例如 BGRA 格式但真正的格式是 RGBA .. 但我不知道你是否能做到 - 它只是一个黑客

标签: gstreamer color-channel


【解决方案1】:

我现在写了我自己的元素。我使用“Colorflip”作为我的基本元素,将名称更改为“ChannelFlip”(您必须将所有方法从 gst_video_flip_bla 重命名为 gst_channel_flip_bla 并重命名结构)。 然后我就可以注册我的元素了:

gst_element_register(NULL, "channelflip", GST_RANK_NONE, GST_TYPE_CHANNEL_FLIP);

然后我将我的枚举添加到GstChannelFlipMethod,并将我的属性添加到_GstChannelFlip。将大写更改为“RGB”并将我的代码添加到 gst_channel_flip_packed_simple 并在 gst_channel_flip_transform_frame 而不是 videoflip->process (videoflip, out_frame, in_frame); 中调用它:

GST_OBJECT_LOCK (videoflip);
    //videoflip->process (videoflip, out_frame, in_frame);
    gst_channel_flip_packed_simple(videoflip, out_frame, in_frame);
GST_OBJECT_UNLOCK (videoflip);

【讨论】:

    【解决方案2】:

    您实际上可以通过更换大写字母来欺骗 GStreamer:

    gst-launch-1.0 -v videotestsrc !视频/x-raw,格式=RGBx! capsetter replace=true caps="video/x-raw, format=(string)BGRx, width=(int)320, height=(int)240, framerate=(fraction)30/1, multiview-mode=(string)单声道,像素纵横比=(分数)1/1,隔行模式=(字符串)渐进式“!视频转换! ximagesink

    请注意:

    "width=(int)320, height=(int)240, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace -mode=(string)progressive"

    videotestsrc 的默认设置。例如,如果您想要另一个解决方案,则需要声明两次:

    gst-launch-1.0 -v videotestsrc !视频/x-raw,格式=RGBx,宽度=640,高度=480! capsetter replace=true caps="video/x-raw, format=(string)BGRx, width=(int)640, height=(int)480, framerate=(fraction)30/1, multiview-mode=(string)单声道,像素纵横比=(分数)1/1,隔行模式=(字符串)渐进式“!视频转换! ximagesink

    当然,为了支持适当的动态上限协商,拥有一个专用元素是更好的解决方案。

    【讨论】:

      猜你喜欢
      • 2023-03-19
      • 1970-01-01
      • 1970-01-01
      • 2014-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-08
      相关资源
      最近更新 更多