QMediaPlayer 绿屏视频

huangapple go评论66阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年4月7日 02:23:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/75952631.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定