gpt4 book ai didi

qt - QVideoWidget没有视频

转载 作者:行者123 更新时间:2023-12-04 19:41:00 25 4
gpt4 key购买 nike

我正在 Qt 5.2 上做带有显示视频的项目。我在显示时遇到问题,没有电影,但声音仍然很好。请帮我解决它。提前致谢

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMediaPlayer>
#include <QVideoWidget>
#include <QUrl>
#include <QMediaPlaylist>
#include <QWidget>
#include <QMediaObject>
#include <QtMultimedia>

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QWidget* widget = new QWidget();

player = new QMediaPlayer;
QMediaPlaylist* m_playlist = new QMediaPlaylist(player);
player->setMedia(QUrl::fromLocalFile("/storage/emulated/0/Bluetooth/video1.mp4"));

m_widgetVideo = new QVideoWidget(widget);
player->setVideoOutput(m_widgetVideo);

setCentralWidget(widget);
widget->show();
m_playlist->setCurrentIndex(0);
player->play();
}

MainWindow::~MainWindow()
{
delete ui;
}

最佳答案

Linux: sudo apt-get install gst123 (安装 GStreamer 依赖项)
Window:安装LAV Filters(安装DirectShow Media Decoders)

关于qt - QVideoWidget没有视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21582396/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com