Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. PySide6 QMediaPlayer do not play all mp4
Forum Updated to NodeBB v4.3 + New Features

PySide6 QMediaPlayer do not play all mp4

Scheduled Pinned Locked Moved Solved Qt for Python
3 Posts 2 Posters 1.5k 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.
  • H Offline
    H Offline
    HubGab
    wrote on last edited by HubGab
    #1

    Hi All!

    I'm trying to record screen using FFMPEG and gdigrab command example below:

    ffmpeg -y -hide_banner -loglevel error -f gdigrab -offset_x 200 -offset_y 300 -video_size 341x153 -show_region 1 -i desktop output.mp4
    

    after recording i would like to just play result of above command in Multimedia example from below site:

    https://doc.qt.io/qtforpython/examples/example_multimedia__player.html

    Unfortunately above multimedia example do not play such file.
    Player do nothing and when I close it I see text in command line:
    "session close time out!"

    No error provided from function "errorOccurred.connect"

    I have installed K-Lite pack Codes from:
    https://codecguide.com/download_kl.htm but it do not helped.

    I can play video using for example MPC-HC without problems.

    This player play "regular" mp4 files but not created by ffmpeg.
    below properties for example mp4 file which i created and would like to play in PySide Player:

    info from ffprobe:

    libavutil      57.  4.101 / 57.  4.101
      libavcodec     59.  6.100 / 59.  6.100
      libavformat    59.  4.102 / 59.  4.102
      libavdevice    59.  0.101 / 59.  0.101
      libavfilter     8.  7.100 /  8.  7.100
      libswscale      6.  0.100 /  6.  0.100
      libswresample   4.  0.100 /  4.  0.100
      libpostproc    56.  0.100 / 56.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '.\output.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf59.6.100
      Duration: 00:00:20.12, start: 0.000000, bitrate: 231 kb/s
      Stream #0:0[0x1](und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 1151x873, 228 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
        Metadata:
          handler_name    : VideoHandler
          vendor_id       : [0][0][0][0]
    

    I have managed to play such videos using PyQt5 using setMedia() function from QMediaPlayer but it is no longer available in PySide6.

    Please let me know if this is bug or i do something wrong?
    I suppose that ffmpeg generate mp4 format not recognized for QMediaPlayer from PySide6.
    Do we have information what exactly properties mp4 files should have to play in PySide6?
    Or I should generate from ffmpeg other formats video files which should be available for mentioned player.py

    Python Version: 3.7
    OS: Windows 10
    QT Version: PySide 6.2.1

    Please let me know if you need more information?
    Much appreciated your help!

    1 Reply Last reply
    0
    • H Offline
      H Offline
      HubGab
      wrote on last edited by
      #2

      Hi All,

      I have found root cause of this issue.

      Issue is caused by Pixel format of video: "yuv444p"

      common pixel format is yuv420p and this format is correctly displayed in PySide program.
      Format yuv420p which have to have even number of video width and height.
      If height or width is odd number then FFMPEG is forced to use pixel format "yuv444p" but if they are even then FFMPEG generate mp4 file with yuv420p.

      I have solved this issue by ensure that width and height of video is even and now everything is working.

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

        Hi and welcome to devnet,

        Beside the frame size, you should also be able to tell ffmpeg which image for format to use.

        In the absolute, you should also configure the video codec to know exactly what goes into your file. mp4 is container format and can contain quite a lot of different video stream format.

        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