Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to produce base64 contents for reading as video via QVideoFrame
Forum Updated to NodeBB v4.3 + New Features

How to produce base64 contents for reading as video via QVideoFrame

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 3 Posters 694 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jafar.Sag.Sibil
    wrote on last edited by Jafar.Sag.Sibil
    #1

    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
    
    jsulmJ 1 Reply Last reply
    0
    • J Jafar.Sag.Sibil

      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 )

      SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #8

      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 ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      J 1 Reply Last reply
      1
      • J Jafar.Sag.Sibil

        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
        
        jsulmJ Online
        jsulmJ Online
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @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?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • J Offline
          J Offline
          Jafar.Sag.Sibil
          wrote on last edited by
          #3

          @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)

          jsulmJ 1 Reply Last reply
          0
          • J Jafar.Sag.Sibil

            @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)

            jsulmJ Online
            jsulmJ Online
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @Jafar-Sag-Sibil From where/how do you get the video frames?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • J Offline
              J Offline
              Jafar.Sag.Sibil
              wrote on last edited by
              #5

              from qcamera using an implemented class of qabstractvideosurface

              jsulmJ 1 Reply Last reply
              0
              • J Jafar.Sag.Sibil

                from qcamera using an implemented class of qabstractvideosurface

                jsulmJ Online
                jsulmJ Online
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #6

                @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.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                1
                • J Offline
                  J Offline
                  Jafar.Sag.Sibil
                  wrote on last edited by
                  #7

                  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 )

                  SGaistS 1 Reply Last reply
                  0
                  • J Jafar.Sag.Sibil

                    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 )

                    SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #8

                    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 ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    J 1 Reply Last reply
                    1
                    • J Offline
                      J Offline
                      Jafar.Sag.Sibil
                      wrote on last edited by
                      #9

                      An android application

                      1 Reply Last reply
                      0
                      • SGaistS SGaist

                        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 ?

                        J Offline
                        J Offline
                        Jafar.Sag.Sibil
                        wrote on last edited by Jafar.Sag.Sibil
                        #10

                        @SGaist
                        I want a c++ android client video recorder which will be displayed into html using network

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #11

                          All within the same device ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved