英文:
QMediaPlayer green-screen video
问题
我正在尝试使用 QMediaPlayer 和 QVideoWidget 播放视频,一切正常,但视频只显示一个绿色屏幕。
我已经尝试过其他视频,但问题依然存在。
我的代码:
player = new QMediaPlayer;
player->setSource(QUrl::fromLocalFile("E:\\gd.mp4"));
vw = new QVideoWidget;
player->setVideoOutput(vw);
connect(player, &QMediaPlayer::errorChanged, this, &Widget::catchError);
connect(player, &QMediaPlayer::durationChanged, this, &Widget::getDuration);
vw->show();
player->play();
英文:
I'm trying to run a video with QMediaPlayer && QVideoWidget,
everything is okay but the video is only shows a green screen,
I have tried another videos and the same issue
my code:
player = new QMediaPlayer;
player->setSource(QUrl::fromLocalFile("E:\\gd.mp4"));
vw = new QVideoWidget;
player->setVideoOutput(vw);
connect(player, &QMediaPlayer::errorChanged, this, &Widget::catchError);
connect(player, &QMediaPlayer::durationChanged, this, &Widget::getDuration);
vw->show();
player->play();
答案1
得分: -1
Qt 6.5.0 切换至 ffmpeg 后端。尝试设置环境变量 QT_MEDIA_BACKEND 为 "windows",如文档中所述,以使用先前的后端。
英文:
Qt 6.5.0 moved to the ffmpeg backend. Try to set the env variable QT_MEDIA_BACKEND to "windows" as reported in the docs to use the previous backend.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论