Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
None
-
6.5.0, 6.6.0, 6.7, 6.8
-
Windows 10.0.19044 Build 19044
Lenovo Thinkpad E530
NVIDIA GeForce GT 635M - Intel HD Graphics 4000
-
-
30eb2b241 (dev), b63e9a465 (6.7), fec0682bc (tqtc/lts-6.5)
Description
the requirement is saving a frame of QML media player.
I reported this problem here before but I have some updates and clarifications so decided to make a new one.
first of all there isn't "QOpenGLContext current in a different thread" anymore, But there are kinda tow new error:
damaged.mp4
failed to get textures for frame true D3D11: Removing Device. Failed to map readback staging texture: COM error 0x887a0005: The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action.
crash.mp4
qt.multimedia.ffmpeg.mediadataholder: AVStream duration -9223372036854775808 is invalid. Taking it from the metadata qt.multimedia.ffmpeg.mediadataholder: AVStream duration -9223372036854775808 is invalid. Taking it from the metadata D3D11: Removing Device. Failed to map readback staging texture: COM error 0x887a0005: The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action.
I found out this bug directly depends on what media is playing, so I attached 3 video files with full code of the sample application to be reproduceable :
- good.mp4 : there isn't any problem
- crash.mp4 : app crashes and saved frame is damaged
- damaged.mp4 : app not crash but saved frame is damaged
helper.h
class Helper : public QObject { Q_OBJECT QML_ELEMENT public: explicit Helper(QObject *parent = nullptr); Q_INVOKABLE void setVideoSink(QObject *videoOutput); Q_INVOKABLE void saveCurrentFrame(); private: QVideoSink *m_sink = nullptr; };
helper.cpp
void Helper::setVideoSink(QObject *videoOutput){ m_sink = qvariant_cast<QVideoSink*>(videoOutput->property("videoSink")); } void Helper::saveCurrentFrame(){ m_sink->videoFrame().toImage().save("frame.png"); }
Main.qml
**
Button { text: "save frame" onClicked: { helper.saveCurrentFrame() } } MediaPlayer { id: player audioOutput: AudioOutput {} videoOutput: videoOutput onMediaStatusChanged: { if (player.mediaStatus === MediaPlayer.BufferedMedia) { helper.setVideoSink(videoOutput) } } }
Attachments
Issue Links
- resulted from
-
QTBUG-115308 Fix DirectX texture propagation from FFMPEG to RHI
- Closed
For Gerrit Dashboard: QTBUG-113627 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
554580,16 | Prevent lost D3D11 device with QVideoFrame::toImage() with Qt Quick | dev | qt/qtmultimedia | Status: MERGED | +2 | +1 |
554738,1 | Harden flaky QVideoFrame test | dev | qt/qtmultimedia | Status: ABANDONED | 0 | 0 |
555449,3 | Prevent lost D3D11 device with QVideoFrame::toImage() with Qt Quick | 6.7 | qt/qtmultimedia | Status: MERGED | +2 | 0 |
559035,2 | Prevent lost D3D11 device with QVideoFrame::toImage() with Qt Quick | tqtc/lts-6.5 | qt/tqtc-qtmultimedia | Status: MERGED | +2 | 0 |