Details
-
Suggestion
-
Resolution: Fixed
-
Not Evaluated
-
None
-
6.5.0
Description
At this moment (6.5.0) QMediaPlayer will not load the cover image from an audio file (windows, ffmpeg).
But the QMediaMetaData object will have a video codec (e.g. MotionJPEG) and when loaded in the "video widget example" the cover is indeed visible in the video output.
Would it not be consistent to get the cover as QImage in the MediaMetaData object also directly?
This is possible with ffmpeg, for example:
extern "C" { #include <libavformat/avformat.h> } QImage coverArt; QString data = song->path(); QByteArray ba = data.toUtf8(); const char *path = ba.constData(); AVFormatContext *format_song = NULL; result = avformat_open_input(&format_song, path, NULL, NULL); if(result < 0){ qInfo() << "File could not be opend"; } else { for (int i = 0; i < format_song->nb_streams; ++i) { AVStream *stream = format_song->streams[ i ]; if (stream->disposition & AV_DISPOSITION_ATTACHED_PIC) { AVPacket pkt = stream->attached_pic; coverArt = QImage::fromData( ( uchar* )pkt.data, pkt.size ); break; } } }
Thanks for consideration. Best wishes and happy coding.
Attachments
Issue Links
- duplicates
-
QTBUG-116324 Request to implement thumbnail realization for multimedia FFMPEG backend
-
- Closed
-