Skip to content

Latest commit

 

History

History
149 lines (98 loc) · 5.33 KB

README.en.md

File metadata and controls

149 lines (98 loc) · 5.33 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;
  • 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.

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;

In the case of opengl rendering, how to modify the 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?

How to calculate pts from frames obtained by AVAudioFifo?

// 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;

    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

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