Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Embedding LAV Filters in PyQt5 application?



  • I've got a PyQt5 application which uses (among a lot of other things) QVideoWidget and QMediaPlayer elements to play back MOV and MP4 files and interact with them, in a shared server environment where people view files other users have put into the system.

    Most users are using the h.264 codec in their input files, and I've found that on Windows, these files will only play if the user already has LAV Filters installed on their Windows machine. However on a Mac, the files will play natively without requiring a plug-in.

    It's not ideal to have to ask users to install LAV Filters separately (there are quite a lot of users, generally without admin/install rights), so I was wondering- is there a way to embed the libraries of LAV Filters into a PyQt5 application (compiled by PyInstaller), without the user needing to manually install them?

    Specifically, is there any way in Qt/PyQt5 code to 'feed' the library files to the QMediaPlayer element so it can use them if it needs them, without them being installed?

    Or, in Qt, is the QMediaPlayer operation all handled at a deeper level, by Windows Media Foundation (or whatever it is) etc.?

    This is what LAV Filter libraries look like: https://files.1f0.de/lavf/LAVFilters-0.74.1-x64.zip

    Perhaps I'm looking at this backwards. Fingers crossed that this kind of makes sense, and that there's some sensible way of approaching it.


  • Lifetime Qt Champion

    Hi,

    Qt uses the platform native API. IIRC, on Windows you have to register the codecs you want to use. Note that this might be outdated knowledge. You should check whether it's possible for users to register them for their session.

    VLC might also be an alternative for you depending on what you are currently doing with these files.



  • Thanks for the reply. That confirms my suspicions, that it won't be possible to embed the filters and use them without installation.

    For my software's needs VLC has some distinct drawbacks, including (but not limited to) a lack of frame accuracy when seeking. QMediaPlayer is still the best option I think, despite requiring these filters to play back a fairly industry-standard video format.


Log in to reply