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. Add mp4 video
Forum Updated to NodeBB v4.3 + New Features

Add mp4 video

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 4 Posters 532 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.
  • R Offline
    R Offline
    Rumeysa_135
    wrote on last edited by
    #1

    Hello, I want to ask you something. I made a video design. I want to play this video on the interface screen I created in Qt widget Applications. But I want to do it without using keys like play, pause. As soon as I run the interface, I want the video to appear directly on the screen. How can ı do that?

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

      Hi,

      You can use a QVideoWidget and start the video from your code.

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

      R 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        You can use a QVideoWidget and start the video from your code.

        R Offline
        R Offline
        Rumeysa_135
        wrote on last edited by
        #3

        @SGaist said in Add mp4 video:

        Hi,

        You can use a QVideoWidget and start the video from your code.

        I looked at the page you said and did it, but the video did not appear on the screen. The blank main window just popped up. Why did this happen?

        jsulmJ 1 Reply Last reply
        0
        • R Rumeysa_135

          @SGaist said in Add mp4 video:

          Hi,

          You can use a QVideoWidget and start the video from your code.

          I looked at the page you said and did it, but the video did not appear on the screen. The blank main window just popped up. Why did this happen?

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

          @Rumeysa_135 said in Add mp4 video:

          Why did this happen?

          Hard to say without seeing your code...

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

          R 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Rumeysa_135 said in Add mp4 video:

            Why did this happen?

            Hard to say without seeing your code...

            R Offline
            R Offline
            Rumeysa_135
            wrote on last edited by
            #5

            @jsulm said in Add mp4 video:

            @Rumeysa_135 said in Add mp4 video:

            Why did this happen?

            Hard to say without seeing your code...

            MainWindow::MainWindow(QWidget parent)
            : QMainWindow(parent)
            , ui(new Ui::MainWindow)
            {
            ui->setupUi(this);
            QMediaPlayer
            player = new QMediaPlayer;
            QUrl videoUrl = QUrl::fromLocalFile("‪C:/Users/Desktop/video.mp4");
            QMediaContent videoMedia(videoUrl);
            player->setMedia(videoMedia);
            QVideoWidget* videoWidget = new QVideoWidget;
            videoWidget->setMinimumWidth(640);
            videoWidget->setMinimumHeight(360);
            player->setVideoOutput(videoWidget);
            videoWidget->setGeometry(QRect(10, 10, 640, 360));
            player->play();

            }

            jsulmJ 1 Reply Last reply
            0
            • R Rumeysa_135

              @jsulm said in Add mp4 video:

              @Rumeysa_135 said in Add mp4 video:

              Why did this happen?

              Hard to say without seeing your code...

              MainWindow::MainWindow(QWidget parent)
              : QMainWindow(parent)
              , ui(new Ui::MainWindow)
              {
              ui->setupUi(this);
              QMediaPlayer
              player = new QMediaPlayer;
              QUrl videoUrl = QUrl::fromLocalFile("‪C:/Users/Desktop/video.mp4");
              QMediaContent videoMedia(videoUrl);
              player->setMedia(videoMedia);
              QVideoWidget* videoWidget = new QVideoWidget;
              videoWidget->setMinimumWidth(640);
              videoWidget->setMinimumHeight(360);
              player->setVideoOutput(videoWidget);
              videoWidget->setGeometry(QRect(10, 10, 640, 360));
              player->play();

              }

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

              @Rumeysa_135 As far as I can see you're neither showing videoWidget nor putting it into a layout, so it is not shown. And as soon as you call show on it it will be shown as stand alone widget because it does not have a parent and is not added to any layout.

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

              1 Reply Last reply
              1
              • R Offline
                R Offline
                Rumeysa_135
                wrote on last edited by Rumeysa_135
                #7

                DirectShowPlayerService::doRender: Unresolved error code 0x80040266 () How can i fix this error?

                SGaistS 1 Reply Last reply
                0
                • R Rumeysa_135

                  DirectShowPlayerService::doRender: Unresolved error code 0x80040266 () How can i fix this error?

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

                  First thing, did you address the issues pointed in your code ?

                  Next, can you properly render that file on your system ?

                  Then, which version of Qt are you using ?
                  The latest 6.5 should use the ffmpeg backend.

                  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
                  • Y Offline
                    Y Offline
                    yamu
                    wrote on last edited by
                    #9

                    Please try on .avi file. .mp4 file is not support for windows.
                    kindly load .avi file. Then the video will play.
                    Like,
                    QUrl videoUrl = QUrl::fromLocalFile("‪C:/Users/Desktop/video.avi");

                    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