Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

Video Output and OpenGL

Lee, Byoung-young edited this page Feb 20, 2015 · 1 revision

Video output

Some users ask me how they can change the video output(vo) method. Because bomi is based on mpv, it's reasonable for them to expect bomi has similar vos. The answer is, no you can't.

bomi can use only one vo: opengl-cb. This vo is not for end users. It's designed to work with OpenGL context of client. What happened to other vos? If you are interested in the detail circumstances, keep reading.

OpenGL

OpenGL is an Open standard Graphics Library which is also royalty-free and supported in multiple platforms. With proper driver support, every OpenGL calls are performed on GPU, that is, hardware-accelerated. OpenGL is used for 3D graphics mainly but it also can be used to accelerate rendering 2D graphics.

Rendering video frames in tens of framerate requires numerous calculations even for simple color space conversion. This cannot be done in real-time through CPU, that is, software rendering. That's why most video player using some kind of hardware-accelerated rendering method, such as OpenGL, DirectX or X Video. Various vos in mpv supports various method to accelerate these processes.

Qt Quick

Then, why only OpenGL in bomi? That's because bomi is integrated with Qt Quick module in Qt5. Qt Quick is a library to develop applications using QML which is similar with javascript. There are lots of pros for Qt Quick, the main reason bomi using it is because it makes the UI code much more flexible. This also makes it possible for bomi to support various skins.

When integrating mpv with Qt Quick, I gave up mpv's vos. Usually, a front end of mpv uses mpv's vo which renders video frames directly on the window in front end. However, in order to work with Qt Quick, I have to render the video frame by myself inside of Qt's rendering thread, otherwise mpv and Qt Quick will overdraw the contents from each other.

In previous CMPlayer, I wrote a custom vo to retrieve video frame from mpv and render it inside Qt scene graph. In that time, CMPlayer did not use mpv's vo at all. However, after mpv devs released new vo opengl-cb which makes it possible to integrate external OpenGL context, bomi is using opengl-cb only.

Pros and Cons

This approach has both of pros and cons.

  • Pros: Qt Quick integration is the sole and ultimate pros for this.
  • Cons: Cannot use some mpv's features in some vos. In order to overcome this, I still keep the modified fork of mpv to integrate such features into bomi
Clone this wiki locally