我正在使用显示视频在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;
}
答案 0 :(得分:0)
Linux:sudo apt-get install gst123(安装GStreamer依赖项)
窗口:安装LAV过滤器(安装DirectShow Media Decoders)