Giter Site home page Giter Site logo

59de44955ebd / mediaplayerse Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 19.96 MB

Custom PyQt video widget for macOS and Windows using native multimedia frameworks (AVFoundation/DirectShow)

Python 95.97% Shell 0.95% Batchfile 1.84% NSIS 0.92% CSS 0.32%
avfoundation directshow hls lavfilters mediaplayer multimedia netradio pyqt5 pyqt6 python shoutcast streaming

mediaplayerse's Introduction

MediaPlayerSE (Streaming Edition)

A simple media player for macOS and Windows, based on Python 3, PyQt5 (portable to PyQt6 or PySide6) and a custom video widget that uses native system multimedia frameworks directly (AVFoundation in macOS, DirectShow and LAV Filters in Windows).

Supported video containers

  • Windows: 3gp asf asx avi dv f4v flv gif m2ts m4v mkv mov mp4 mpeg mts mxf ogv rm ts vob webm wmv wtv
  • macOS: 3gp avi m2ts m2v m4v mov mp4 mpg mpeg mts mxf ts vob
    (mxf only when free Pro Video Formats are installed)

Supported audio containers

  • Windows: aac ac3 aiff ape caf flac mp3 ogg sox wav
  • macOS: aac ac3 aiff caf flac mp3 wav

Supported video codecs (selection)

  • Windows: bink cinepak dirac dvvideo flv1 (sorenson spark) fraps gif h264 hap1 hap5 hapy hevc indeo mjpeg mpeg1 mpeg2 mpeg4 msrle msvideo1 prores422 prores4444 qtrle theora vp4 vp6 vp7 wmv12 wmv3
  • macOS: dvvideo h264 hevc mjpeg mpeg1 mpeg2 prores422 prores4444
    (+ Pro Video Formats, if installed)

Supported audio codecs (selection)

  • Windows: aac ac3 alac dts flac mp2 mp3 nellymoser opus pcm realaudio truespeech vorbis wavpack wma
  • macOS: aac ac3 alac flac mp2 mp3 pcm

VideoWidget's API

Signals

mediaReady                  -> bool success
mousePressed                -> None
doubleClicked               -> None
metadataChanged             -> metadata as dict

Properties

filename                    -> the currently loaded file ur URL (full path)
is_url                      -> True if current file is HTTP(S)-URL, False if local file

Methods

load_media(filename: str)
close_media()
step(steps: int)            -> step <steps> frames forward, or back if <steps> is negative
get_natural_size()          -> returns tuple (width, height) or None
get_duration()              -> returns seconds as float, or 0 if there is no duration
get_fps()                   -> returns fps as float, or None if there is no framerate
has_video()                 -> returns bool (True or False)
has_audio()                 -> returns bool (True or False)
get_volume()                -> returns volume as float in range 0..1
set_volume(volume: float)   -> set volume as float in range 0..1
set_muted(flag: bool)       -> True mutes, False unmutes
seek_to_time(sec: float)    -> seek to time in seconds as float
get_time()                  -> returns current time in seconds as float (or None)
play()
pause()
toggle_playback()           -> returns True if player now playing, otherwise False

Notes

You don't have to connect to signals mousePressed and doubleClicked, but you always have to connect to signal mediaReady, since loading a media file is asynchronous in macOS/AVFoundation. So when loading a file with load_media(), you always have to wait until mediaReady is emitted, and if 'success' was True, you can go on and now do stuff with the loaded media, if it was False then something went wrong, i.e. the file couldn't be loaded.

mediaplayerse's People

Contributors

59de44955ebd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.