Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. [QWebView] HTML5 video with Hardware Decoding
QtWS25 Last Chance

[QWebView] HTML5 video with Hardware Decoding

Scheduled Pinned Locked Moved Qt WebKit
11 Posts 3 Posters 6.1k Views
  • 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.
  • B Offline
    B Offline
    birdca
    wrote on 15 Oct 2014, 08:13 last edited by
    #1

    I use html5 to play a H.264 video in QWebView, but it uses software decode.
    How to use hardware decode instead?

    My main function and html are like below:
    @ int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    QWebView *view = new QWebView();
    view->setGeometry(0,0,1024,1000);
    view->load(QUrl("qrc:/html5/html5_video.html?init=true"));
    view->show();

    return a.exec();
    }@
    @<video width="854" height="480" src="file:///media/video/test.mp4" controls></video>@

    Thanks!

    1 Reply Last reply
    0
    • V Offline
      V Offline
      Vovasty
      wrote on 15 Oct 2014, 09:50 last edited by
      #2

      Hi,
      i'm not sure but try this:
      @view->settings()->setAttribute(QWebSettings::PluginsEnabled, true);@

      1 Reply Last reply
      0
      • B Offline
        B Offline
        birdca
        wrote on 15 Oct 2014, 10:06 last edited by
        #3

        Thanks Vovasty, but after adding this, the video is still lag...

        1 Reply Last reply
        0
        • B Offline
          B Offline
          brcontainer
          wrote on 15 Oct 2014, 15:58 last edited by
          #4

          "video lag"? Your project is compiled in "DEBUG mode"?

          Try compile in RELEASE.

          QT project: https://github.com/brcontainer/qt-helper

          1 Reply Last reply
          0
          • B Offline
            B Offline
            birdca
            wrote on 16 Oct 2014, 02:52 last edited by
            #5

            Hi Guilherme, same in RELEASE mode.

            I think it's a codec problem, it's a H.264 video. If you use CPU to decode, it may be not that efficient, and it'll drop some frames, to cause video lag.
            That's why I want to use GPU to decode.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              brcontainer
              wrote on 16 Oct 2014, 16:51 last edited by
              #6

              I believe the "QT" use the defined "codecs" of your operating system, you may not be the question you set the "QT" but set the "CODEC" software installed on your machine, so even if you redistribute your project, the user will be required to configure the "codec" manually.

              In other words, perhaps the only way of doing this is as "GoogleChrome" does: it has the own "codec" that accompanies the browser.

              Unfortunately I do not know how to use a "codec" in itself "QtWebKit" (I really wanted to know if this is possible).

              Alternative (improved perfomance of "webView"):
              If Windows: You use "openGL"? Tried enable "webGL"?

              Note: I do not know if it will work, but it's a try.

              Try this:
              @QWebSettings *settings = QWebSettings::globalSettings();

              settings->setAttribute(QWebSettings::AcceleratedCompositingEnabled, true);
              settings->setAttribute(QWebSettings::WebGLEnabled, true);@

              Note: Maybe QT5.4 use Chromium, see codec details: http://www.chromium.org/audio-video :)

              QT project: https://github.com/brcontainer/qt-helper

              1 Reply Last reply
              0
              • B Offline
                B Offline
                birdca
                wrote on 17 Oct 2014, 02:53 last edited by
                #7

                oh, I played the same video in VLC and in Chrome in the same machine, both of them works fine! The video are smooth. So, I think, maybe I could do something in QtWebView to make it work.

                Hmmm.. still got video lag. Thank you, Guilherme!

                Interesting! :D

                Thanks, Guilherme~

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  brcontainer
                  wrote on 5 Dec 2014, 16:12 last edited by
                  #8

                  Hi birdca,

                  Just a comment:

                  Note, VLC and Chrome no using native codecs, but QT use native codec installed in your machine.

                  QT project: https://github.com/brcontainer/qt-helper

                  1 Reply Last reply
                  0
                  • B Offline
                    B Offline
                    brcontainer
                    wrote on 5 Dec 2014, 16:12 last edited by
                    #9

                    Hi birdca,

                    Just a comment:

                    Note, VLC and Chrome no using native codecs, but QT use native codec installed in your machine.

                    QT project: https://github.com/brcontainer/qt-helper

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      birdca
                      wrote on 8 Dec 2014, 13:26 last edited by
                      #10

                      Noted, thank you Guilherme~

                      1 Reply Last reply
                      0
                      • B Offline
                        B Offline
                        birdca
                        wrote on 8 Dec 2014, 13:26 last edited by
                        #11

                        Noted, thank you Guilherme~

                        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