Skip to content

Latest commit

 

History

History
149 lines (98 loc) · 5.28 KB

README.en.md

File metadata and controls

149 lines (98 loc) · 5.28 KB

Qt-Media

This is an audio and video project based on Qt, FFmpeg and mpv, integrating a player and transcoder.

Ffmpeg Player

Requires a powerful opengl and vulkan yuv rendering module

  • Opengl's fragment shader currently supports limited image formats;
  • 在WidgetRender中,尽可能使用QImage::Format_RGB32和QImage::Format_ARGB32_Premultiplied图像格式。如下原因:
    • 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.

AVFrame image adjustment

  • according toAVColorSpacePerform color space conversion;
  • according toAVColorTransferCharacteristicMake adjustments to gamma, PQ, HLG, etc.;
  • according toAVColorPrimariesPerform color gamut conversion;
  • according toAVColorRangeMake color range adjustments;

opengl 渲染的情况下,该怎么样修改shader?

In the case of non-opengl rendering, how to add a filter to achieve image compensation?

zscale=p=709;

How to achieve image quality enhancement when rendering images with OpenGL?

Ffmpeg (5.0) decodes subtitles differently from 4.4.3

Decode subtitles (ffmpeg-n5.0)

0,,en,,0000,0000,0000,,Peek-a-boo!

you have to useass_process_chunkand set pts and duration, and invf_subtitles.cSame as in.

The ASS standard format should be (ffmpeg-n4.4.3)

Dialogue: 0,0:01:06.77,0:01:08.00,en,,0000,0000,0000,,Peek-a-boo!\r\n

useass_process_data;

Issue with subtitle display timing when using subtitle filter

subtitles=filename='%1':original_size=%2x%3

Ffmpeg Transcoder

How to set encoding parameters to get smaller files and better video quality?

如何从AVAudioFifo获取的帧中计算pts?

// fix me?
frame->pts = transcodeCtx->audioPts / av_q2d(transcodeCtx->decContextInfoPtr->timebase())
                     / transcodeCtx->decContextInfoPtr->codecCtx()->sampleRate();
transcodeCtx->audioPts += frame->nb_samples;

Mpv Player

  • 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 usevo=libmpvThe video cannot be displayed normally either;

    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

    currentbrewinstalledmpvmiddle,libmpv.dylibThe 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/

QPlayer

QT-BUG

  • 动态切换Video Render,从opengl切换到widget,还是有GPU 0-3D占用,而且使用量是opengl的2倍!!!QT-BUG?

  • QOpenGLWidget内存泄漏,移动放大和缩小窗口,代码如下

    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));
    }