如何在 Qt 中呈现自定义视频数据? [英] How to render custom video data in Qt ?

查看:59
本文介绍了如何在 Qt 中呈现自定义视频数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从未做过 Qt 视频应用程序 - 这方面的新手.我有一个使用 Qt 渲染的自定义视频文件格式.视频文件格式是 256 字节的头,然后是像素数据,然后是 256 字节的头,然后是像素数据等等.标头包括宽度、像素高度、每像素字节数、帧速率等信息,像素数据采用拜耳 (GBRG) 格式.我可能需要在显示之前处理数据 - 比如转换为 RGB(还不确定).我看到有很多视频相关的类,比如 QGL*、QMovie、QVideo*……不知道从哪里开始?我看过 mandelbrotwidget 示例,它看起来是一个不错的起点,但仍然需要一些建议.另外,我是否必须为 Bayer 模式编写 Qt Image 插件?

I have never done a Qt video application - newbie in this area. I have a custom video file format to render using Qt. The video file format is 256-byte header, then pixel data, then 256-byte header, then pixel data and so on. The header consist info like width, height in pixels, bytes per pixels, frame rate etc and the pixel data is in Bayer (GBRG). I may have to process data before display - like convert to RGB (not sure yet). I see there are lot of video related classes like QGL*, QMovie, QVideo* ... don't know where to start ? I have seen mandelbrotwidget example which looks like a good place to start but still need some advice. Also, do I have to write a Qt Image plugin for Bayer pattern?

谢谢.

推荐答案

开始的最佳位置是学习 Qt 中自定义绘图的基础知识.简而言之,一个非常简单的实现需要您:

The best place to start is by learning the basics of custom drawing in Qt. In short, a very simple implementation would require you to:

  1. 创建自定义QWidget子类
  2. 覆盖paintEvent()方法
  3. 使用 QPainter/QImage 将原始视频数据解码为图像数据并在屏幕上绘制
  1. Create a custom QWidget subclass
  2. Override the paintEvent() method
  3. Use a QPainter/QImage to decode your raw video data into image data and draw it on screen

Qt 有很多很好的示例代码可以帮助您入门,例如:

Qt has lots of good sample code to get you started, such as:

http://qt-project.org/doc/qt-4.8/examples-painting.html

一旦您启动并运行了一个简单的实现,并且基本掌握了 Qt 概念/类,然后您就可以准备分析、优化和使用更高级的 Qt 功能(GL,视频)根据需要.

Once you have a simple implementation up and running, and a basic grasp of Qt concepts/classes, then you'll be ready to profile, optimize, and make use of more advanced Qt functionality (GL, video) as needed.

这篇关于如何在 Qt 中呈现自定义视频数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆