Solved How to produce base64 contents for reading as video via QVideoFrame
-
my method to produce base64 :
QVideoFrame frame ( f ); if ( frame.isValid ( ) && frame.map ( QAbstractVideoBuffer::MapMode::ReadOnly ) ) { char * c = (char *) frame.bits ( ); QByteArray arr ( c ); qDebug ( ) << arr.toBase64 ( ) << endl; frame.unmap ( ); }
but the output is not readable by video element of my html file
<video controls src="data:video/mpeg;base64,$content" />
a qvideoframe object encoded contents
"CwkK/wsJCv8LCQr/CggJ/woICf8KCAn/CggJ/wsJCv8LCgn/CwoI/woJB/8KCQf/CgkH/wsKCP8LCgj/CwoI/wsKCP8LCgn/CQkJ/wkJCf8JCQn/CAgI/wgICP8ICAj/CAgI/wgICP8ICAj/CAgI/wgICP8ICAj/CAgI/wcHB/8HBwf/BwcH/wgICP8ICAj/CAgI/wkJCf8JCQn/CQkJ/wkJCf8ICAj/CAgI/wkJCf8JCQn/CQkJ/wgICP8ICAj/CAgI/wgICP8ICAj/CAgI/woJCP8KCQf/CgkH/woJB/8KCQf/CgkH/woJB/8KCQf/CgkH/woJB/8KCQf/CgkH/wkJB/8KCgj/CgoI/woKCP8KCgj/CgoI/woKCP8JCQf/CgoI/woKCP8KCgj/CQoH/wgKB/8JCwj/CQsI/wkLCP8JCwj/CAoH/wgKB/8ICgf/CAoH/wgKB/8ICgf/CAoH/wgKB/8ICgf/CQsI/wkLCP8ICgf/CAoH/wgKB/8ICgf/CAoH/wgKB/8ICgf/CAoH/wgKB/8ICgf/CAoH/wcJBv8HCQb/CAoH/wgKB/8ICgf/CQsI/wkLCP8JCwj/CgwJ/wkLCP8JCwj/CQsI/wkLCP8JCwj/CgwJ/woMCf8KDAn/CwwJ/wsLCf8LCwn/CwsJ/woKCP8KCgj/CgoI/woKCP8KCgj/CgoI/woKCP8KCgj/CwsJ/wsLCf8LCwn/CgoI/woKCP8KCgj/CgoI/woKCP8KCgj/CgoI/woKCP8KCgj/CgoI/woKCP8KCgj/CgoI/woKCP8LCwn/CwsJ/wsLCf8LCwn/CwsJ/wsLCf8LCwn/CwsJ/wsLCf8LCwn/CwsJ/wwMCv8NDQv/DQ0L/wwMCv8MDAr/DAwK/wwMCv8MDAr/DAwK/wwMCv8LCwn/CwsJ/wsLCf8MDAr/DAwK/wwMCv8MDAr/DAwK/wwMCv8MDAr/DAwK/wsLCf8LCwn/CwsJ/wwMCv8NDQv/DQ0L/w0NC/8NDQv/DQ0L/w0NC/8NDQ
-
Hi,
@Jafar-Sag-Sibil said in How to produce base64 contents for reading as video via QVideoFrame:
Man I want make a online video chat application what I can do (QMediaRecorder does save video into storage but I want some faster approach )
That's the kind of information you should give from the start so people can understand what you are after.
That said, you can forget about base64 encoding of a video feed. The encoding itself is expensive both in terms of time and space. It's bandwidth unfriendly and it won't solve your problem as you cannot stream a live video feed like that.
Are you writing a desktop client for that or do you want a web application ?
-
@Jafar-Sag-Sibil I don't see where you actually put the generated Base64 into the HTML document?
Also, why do you encode each frame and not whole video? -
@jsulm said in How to produce base64 contents for reading as video via QVideoFrame:
Also, why do you encode each frame and not whole video?
could you please give me the code (how to collect qvideoframe as video)
-
@Jafar-Sag-Sibil From where/how do you get the video frames?
-
from qcamera using an implemented class of qabstractvideosurface
-
@Jafar-Sag-Sibil I think simply putting frames one by one does not make it a valid video. Alternative would be to record a real video and encode that as base64.
-
Man I want make a online video chat application what I can do (QMediaRecorder does save video into storage but I want some faster approach )
-
Hi,
@Jafar-Sag-Sibil said in How to produce base64 contents for reading as video via QVideoFrame:
Man I want make a online video chat application what I can do (QMediaRecorder does save video into storage but I want some faster approach )
That's the kind of information you should give from the start so people can understand what you are after.
That said, you can forget about base64 encoding of a video feed. The encoding itself is expensive both in terms of time and space. It's bandwidth unfriendly and it won't solve your problem as you cannot stream a live video feed like that.
Are you writing a desktop client for that or do you want a web application ?
-
An android application
-
@SGaist
I want a c++ android client video recorder which will be displayed into html using network -
All within the same device ?