Simple GUI around MPV and OMXPlayer (hardware accelerated player on Raspberry Pi)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Stefan Naumann 14fd3a57f5 the port for the remote is configurable with command-line argument 11 months ago
data added buttons for switching audio tracks and subtitles (needs more work), painted player background black (useful for OMX) 11 months ago
src the port for the remote is configurable with command-line argument 11 months ago
LICENSE Revert "Revert "Initial commit"" 1 year ago
README.md added Readme-Section about the config-file 11 months ago
dbuscontrol.sh added buttons for switching audio tracks and subtitles (needs more work), painted player background black (useful for OMX) 11 months ago
yt.m3u added test m3u file 1 year ago

README.md

GTPlay

Simple GUI around MPV and OMXPlayer (hardware accelerated player on Raspberry Pi)

OMXPlayer is a quite basic player using the hardware decoding features of the Raspberry Pi for decoding HD videos. The GTPlay-GUI is intended to be used with other tools like smtube. OMXPlayer is kept inside the GTPlay window, so you can move it out of the way, when you need more space on screen.

Setup

Requirements:

  • Python 3
  • pyGTK 3.0 and python-gobject
  • python-mpv and MPV

Maybe your distribution has python-mpv, or you can install it with:

# on Arch Linux ARM, the package may be called differently on Raspbian
sudo pacman -Syu python python-pip pygtk python-gobject
# install python-mpv
sudo pip install python-mpv

OMXPlayer

You will need the following for running with OMXPlayer as player:

  • xwininfo (on Arch Linux xorg-xwininfo)
  • livestreamer (for live streams only)
    • a Twitch token, when wanting to watch Twitch-content (dev.twitch.tv, see below)
  • omxplayer
# on Arch Linux ARM, the package may be called differently on Raspbian
sudo pacman -Syu omxplayer-git xorg-xwininfo
# install livestreamer
sudo pip install livestramer

Usage (preliminary)

At the moment, there are no arguments, only a list of files.

python src/gtplay.py {files}

Once an instance runs, you can run a similar command again and add items to the playlist of the first one. GTPlay will only allow one instance of itself at any time.

MPV

MPV-mode can be used on normal PCs, then GTPlay is a simple wrapper around mpv. It can play Twitch or Youtube natively, however is too slow for Raspberry Pi or other ARM-boards.

OMXPlayer

python src/gtplay.py --omx {files}

The OMX-mode cannot play Youtube-links directly. But you can use GTPlay as player for smtube.

Livestreams (Twitch)

The OMXPlayer cannot retrieve livestreams by itself (mpv can). One needs to tell it, that an URL is a livestream, with the --live argument before the URL. You can also add a quality statement.

For livestreams the Python-program livestreamer is used. It is a run-time requirement, so you need to have it installed, but GTPlay will work without it, as long as you won’t try to view a livestream using the OMXPlayer backend.

livestreamer unfortunately needs a Client-ID-Token for streaming Twitch-Content. You can get one at dev.twitch.tv. There are two ways to pass a Twitch-Token:

  • using the --token parameter
  • using a file src/twitch_token.py which specifies a variable twitch_token with the token as string

Be aware, that OMX is quite slow to respond to anything, when used with livestreamer.

Example

Viewing a file:

python gtplay.py data/bunny.mp4

On Raspberry Pi: Viewing in OMXPlayer (hardware accelerated):

python gtplay.py --omx data/bunny.mp4

Watching a livestream (Twitch):

python gtplay.py --live https://twitch.tv/monstercat --quality 1080p --token ...

Shotcuts

Shortcut Semantic
Space, p toggle pause / play
<, b previous element
>, n next element
l toggle loop-mode
f toggle fullscreen
h hide player (OMXPlayer only)
q exit GTPlay
Shift+Left, a jump backwards
Shift+Right, d jump forwards

Config-file

GTPlay uses a JSON config-file to save some properties. It defaults to gtplay.cfg in the root-directory of GTPlay. This is an example file:

{
  "buttons": [
    {
      "hidden": true,
      "name": "loopBtn",
    },
    {
      "hidden": true,
      "name": "pauseBtn"
    }
  ],
  "loop": false,
  "muted": false,
  "omx_hidden": false,
  "player": "mpv",
  "quality": "720p",
  "volume": 99.0
}

It sets the loop-Button and the pause/play-button to invisible. It sets the player to non-looping at startup and not muted. The default volume is 99.0 (out of 100) at startup, the default player is mpv. In OMX-mode the player is set to startup to not hidden and the quality-parameter to livestreamer to 720p.

The file is rewritten, when the player is exited, so looping, the volume and muting is carried over to the next start.