Qt qml MediaPlayer/Video 仅再现声音(无视频)

Posted

技术标签:

【中文标题】Qt qml MediaPlayer/Video 仅再现声音(无视频)【英文标题】:Qt qml MediaPlayer/Video reproduces only Sound (without Video) 【发布时间】:2018-10-04 14:35:02 【问题描述】:

我在 QML 中使用播放器,安装了 k-lite-codec 包并尝试播放 mp4 和 avi 视频格式,但它不播放它们,只播放声音。 为什么是这样? 怎么了?

关闭应用程序后,我得到这个调试日志:

D3D11 WARNING: Process is terminating. Using simple reporting. Please call ReportLiveObjects() at runtime for standard reporting. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Producer at 0x03DBE8CC, Refcount: 8. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x03E35D18, Refcount: 2. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x03DBF780, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x03CE68C4, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x03DC56FC, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x03DC58D4, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x03DC5ACC, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x03DC5CC4, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x03DC6184, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x03DC6734, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING:  Live Object at 0x03DC6CE4, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live                         Object :     10 [ STATE_CREATION WARNING #0: UNKNOWN]
DXGI WARNING: Live Producer at 0x03D1C814, Refcount: 3. [ STATE_CREATION WARNING #0: ]
DXGI WARNING:   Live Object at 0x03D4DCA0, Refcount: 3. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live                         Object :      1 [ STATE_CREATION WARNING #0: ]

【问题讨论】:

我用的是标准的例子,我自己的代码和结果都是一样的。标准代码示例:qmlvideo(多媒体)或在我自己的代码中使用:MediaPlayer 和 VideoOutput 或 Video(相同) 【参考方案1】:

由于您提到了 k-lite-codec,我假设您使用的是 Windows。检查是否可以在 Windows Media Player 中播放。如果不是(只有声音),那么您的系统中缺少必要的编解码器。

【讨论】:

以上是关于Qt qml MediaPlayer/Video 仅再现声音(无视频)的主要内容,如果未能解决你的问题,请参考以下文章

Qt和Qt Quick QML,

Qt/QML - 在 C++ 中注册 QML 类型会使 QML 代码不起作用

创建单个 ui.qml 文件的标准(Qt)方法是啥?

QT/QML 数据模型

Qt (QML) 虚线圆

Qt 5.12 QML,在javascript中通过var选择QML对象