This is an audio and video project based on Qt, FFmpeg and mpv, integrating a player and transcoder.
- Opengl's fragment shader currently supports limited image formats;
- In WidgetRender, use the QImage::Format_RGB32 and QImage::Format_ARGB32_Premultiplied image formats whenever possible. The following reasons:
- Avoid most rendering directly to most of these formats using QPainter. Rendering is best optimized to the Format_RGB32 and Format_ARGB32_Premultiplied formats, and secondarily for rendering to the Format_RGB16, Format_RGBX8888, Format_RGBA8888_Premultiplied, Format_RGBX64 and Format_RGBA64_Premultiplied formats.
- according to
AVColorSpace
Perform color space conversion; - according to
AVColorTransferCharacteristic
Make adjustments to gamma, PQ, HLG, etc.; - according to
AVColorPrimaries
Perform color gamut conversion; - according to
AVColorRange
Make color range adjustments;
- referenceMPV video_shaders;
zscale=p=709;
0,,en,,0000,0000,0000,,Peek-a-boo!
you have to useass_process_chunk
and set pts and duration, and invf_subtitles.cSame as in.
Dialogue: 0,0:01:06.77,0:01:08.00,en,,0000,0000,0000,,Peek-a-boo!\r\n
useass_process_data
;
subtitles=filename='%1':original_size=%2x%3
How to set encoding parameters to get smaller files and better video quality?
- referenceHandBrake encavcodec
// fix me?
frame->pts = transcodeCtx->audioPts / av_q2d(transcodeCtx->decContextInfoPtr->timebase())
/ transcodeCtx->decContextInfoPtr->codecCtx()->sampleRate();
transcodeCtx->audioPts += frame->nb_samples;
- New BING’s video transcoding recommendations
- SwsContext is great! Compared to QImage Convert to and Scale**
-
When using 4K video in the preview window, it will occupy a lot of memory because an additional mpv instance is opened and the memory is double;
-
MacOS seems to only be able to useQOpenglWidgetrendering;
[vo/gpu] opengl cocoa backend is deprecated, use vo=libmpv instead
But use
vo=libmpv
The video cannot be displayed normally;Using opengl version greater than 3 has better performance;
QSurfaceFormat surfaceFormat; surfaceFormat.setVersion(3, 3); surfaceFormat.setProfile(QSurfaceFormat::CoreProfile); QSurfaceFormat::setDefaultFormat(surfaceFormat);
**Note:**When setting Qt::AA_ShareOpenGLContexts, it is strongly recommended to place the call to this function before the construction of the QGuiApplication or QApplication. Otherwise format will not be applied to the global share context and therefore issues may arise with context sharing afterwards.
-
It seems that it can only be used under UbuntuQOpenglWidgetrendering
qt.dbus.integration: Could not connect "org.freedesktop.IBus" to globalEngineChanged(QString)
-
MacOS packaging requirementsinstall_name_tool, the dependency copy script file comes fromthere;
current
brew
installedmpv
middle,libmpv.dylib
The dependency is@loader_path/
, so some modifications were made to the script;./mac/change_lib_dependencies.rb "$(brew --prefix)" "$(brew --prefix mpv)/lib/libmpv.dylib"
Dependencies will be copied topacket/Qt-Mpv.app/Contents/Frameworks/
;
- referenceMedia Player Example
-
Dynamically switching Video Render, switching from opengl to widget, still consumes GPU 0-3D, and the usage is twice that of opengl! ! ! QT-BUG?
-
QOpenGLWidget memory leaks, moves to zoom in and out the window, the code is as follows
int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { setCentralWidget(new QOpenGLWidget(this)); }