Play H.264 Elementary Stream
-
The documentation for QVideoFrame seems to indicate that it is used to hold the pixels from a decoded frame, whereas I would like to feed in H.264-encoded frames. I could put an external decoder in front of the QVideoFrame, but I am curious whether there is a solution for this purely within Qt.
-
Qt does not know how to decode h.264.
It uses an "OS backend":http://doc.qt.io/qt-5/multimediaoverview.html#limitations to decode video.Take a look "here":http://doc.qt.io/qt-5/videooverview.html#working-with-low-level-video-frames for low level example within Qt
[edit: updated the links SGaist]
-
QMediaPlayer cannot help you? QMediaPlayer can decode video files.
-
@SGaist i am receiving raw h264 frames from a QTCP socket, i need a function or library where i will pass the h264 data (QByteArray) from a http payload, and decode it to pass it to a video player. The QT Multimedia library doesn't work with encoded data. i already tried using the QTAV library but there's is no luck in Reaching what i need. Please help.
-
What OS are you targeting ?
-
Do you have any h264 codec installed ?
-
@SGaist Yes, unfortunately VLC-QT from https://vlc-qt.tano.si doesn't support the particular functionality i require. i also tried using the QTAV library from http://www.qtav.org, which uses the ffmpeg library. none of these are of help because they don't support raw h264 bit streaming. you can check my conversation with on of the repository admins here https://github.com/wang-bin/QtAV/issues/510. I was wondering if QT has a library i could pass my QByteArray data (raw h264 data) from a QTCPSocket and decodes the bit-stream and stream it live.
-
AVPacket avpkt; int err, frame_decoded = 0; AVCodec *codec = avcodec_find_decoder ( AV_CODEC_ID_H264 ); AVCodecContext *codecCtx = avcodec_alloc_context3 ( codec ); avcodec_open2 ( codecCtx, codec, NULL ); // Set avpkt data and size here err = avcodec_decode_video2 ( codecCtx, avframe, &frame_decoded, &avpkt );
avframe being the QByteArray data from the socket ?
-
You'll likely have build your avframe with the data contained by the QByteArray