hoyon / mpv-mpris Goto Github PK
View Code? Open in Web Editor NEWMPRIS plugin for mpv
License: MIT License
MPRIS plugin for mpv
License: MIT License
Original issue: flathub/io.mpv.Mpv#23 (comment)
A lot of config parameters of mpv are reset to default while mpv-mpris and the mpris indicator button extension is enabled. See original issue for details.
I am thinking this feature would be useful for the auto profiles and also if people have profiles for streaming services where pausing should really be avoided and muting the content would be preferred
Hi :)
I use your program daily, it's very useful. Thank you for creating it and maintaining it.
I'm using NixOS and our package manager (Nix) has a certain mechanism to detect why a package / file depends on a file from a different package. So for example, since your package depends on glib
, glib
is detected as a runtime dependency.
Unfortunately, it detects also gcc as a runtime dependency, which makes gcc being pulled and hence consume disk unnecessarily. Running strings
on our build of mpris.so
yields:
$ strings mpris.so | grep gcc
/nix/store/52x4908vr922dhnxz1i5rfnrsq244vzc-gcc-9.3.0/lib/gcc/x86_64-unknown-linux-gnu/9.3.0/crtbeginS.o
/nix/store/52x4908vr922dhnxz1i5rfnrsq244vzc-gcc-9.3.0/lib/gcc/x86_64-unknown-linux-gnu/9.3.0/crtendS.o
The hash in the beginning belongs to where gcc is "installed" (don't mind that).
Is there anything we could pass the Makefile
perhaps to avoid that? If you are absolutely clueless regarding this feel free to close this. I'm just trying to investigate...
Not sure if this is against the spec but it would be useful when used with gpodder.
Hello, I would like to get any pieces of advice about how to install mpv-mpris. I'm working on script for gotubecast so I need this plugin.
I builded mpv 0.32.0-514-g502e798 succesfully on my pc with command ./scripts/mpv-build --enable-cplugins.
I got an error while installing mpris:
mpris.c: In function 'mpv_open_cplugin':
mpris.c:968:32: error: 'G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE' undeclared (first use in this function)
G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE,
Thank you for your replies
I have statusbar scripts which constantly poll the following command to show currently playing media.
dbus-monitor "path=/org/mpris/MediaPlayer2,member=PropertiesChanged"
However, I've noticed the mpv
doesn't send an event when it exists, which leaves my statusbar stale. Would it be possible to achieve this?
when play videos, and try to see the length of the video file:
└───╼ qdbus org.mpris.MediaPlayer2.mpv /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata
mpris:trackid:
xesam:title: Arietty's Song.mp4
but when play audio, the length is exposed:
└───╼ qdbus org.mpris.MediaPlayer2.mpv /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Metadata
mpris:length: 348000000
mpris:trackid:
xesam:album: A Type (WEB)
xesam:artist: Arkitech
xesam:genre: Hardcore
xesam:title: A Type
please add support for expose length when play video files
greetings
I think I followed the installation correctly - download the mpris.so file and copy it to the .config/mpv/scripts directory. Kde-connect has a multimedia control screen within which is a drop down menu where you can select the the player, for me only vlc appears. If I start mpv with the scripts option from the CLI then mpv appears on the drop down list. How to make kde-connect see mpv without having to start mpv from the CLI first?
removed - posted in wrong repo
I'm seeing this every time mpv runs with this plugin:
(process:378104): GLib-GIO-CRITICAL **: 20:46:25.185: g_dbus_connection_register_object: assertion 'error == NULL || *error == NULL' failed
Nothing seems to be broken yet, but I'm pointing this out because I'm not sure if something will break in upcoming gio releases due to this.
Would be nice to have album art displayed by software that supports it. I guess for embedded art, a temp file would have to be created for this to work.
Compiled it fresh from git with gcc 7.1.1. mpv is also freshly compiled from git, with the same gcc version. All it does is spit a pointer into the terminal.
$ mpv -v --script=~/Projekte/mpv-mpris/mpris.so --idle
[cplayer] Command line options: '-v' '--script=~/Projekte/mpv-mpris/mpris.so' '--idle'
[cplayer] mpv 0.25.0-113-g5521d48b4b (C) 2000-2017 mpv/MPlayer/mplayer2 projects
[cplayer] built on Fri Jun 9 08:00:46 CEST 2017
[cplayer] ffmpeg library versions:
[cplayer] libavutil 55.58.100
[cplayer] libavcodec 57.89.100
[cplayer] libavformat 57.71.100
[cplayer] libswscale 4.6.100
[cplayer] libavfilter 6.82.100
[cplayer] libswresample 2.7.100
[cplayer] ffmpeg version: 3.3.1
[cplayer]
[cplayer] Configuration: ./waf configure --prefix=/usr --confdir=/etc/mpv --enable-zsh-comp --enable-libmpv-shared --enable-cplugins --enable-cplugins
[cplayer] List of enabled features: 51obsd alsa asm atomics audio-input avutil-imgcpy-uc build-date caca cplayer cplugins cuda-hwaccel debug-build dlopen drm egl-drm egl-helpers egl-x11 encoding fchmod gbm gbm.h gl gl-wayland gl-x11 glibc-thread-name glob gnuc iconv is_ffmpeg jack jpeg lcms2 libass libass-osd libav libavcodec libavdevice libbluray libdl libm libmpv-shared librt libv4l2 linux-fstatfs lua nanosleep optimize oss-audio oss-audio-native plain-gl posix posix-or-mingw posix-spawn pthreads pulse rubberband shm stdatomic subprocess termios tv tv-v4l2 uchardet vaapi vaapi-drm vaapi-egl vaapi-glx vaapi-hwaccel vaapi-wayland vaapi-x-egl vaapi-x11 vapoursynth vapoursynth-core vapoursynth-lazy vdpau vdpau-gl-x11 vdpau-hwaccel videodev vt.h wayland x11 xv zlib zsh-comp
[global] config path: '' -> '/home/fratti/.config/mpv'
[global] config path: 'mpv.conf' -> '/home/fratti/.config/mpv/mpv.conf'
[global] config path: 'config' -/-> '/home/fratti/.config/mpv/config'
[global] config path: 'mpv.conf' -/-> '/home/fratti/.mpv/mpv.conf'
[global] config path: 'config' -/-> '/home/fratti/.mpv/config'
[global] config path: 'mpv.conf' -/-> '/etc/mpv/mpv.conf'
[global] config path: 'config' -/-> '/etc/mpv/config'
[cplayer] Reading config file /home/fratti/.config/mpv/mpv.conf
[cplayer] Setting option 'profile' = 'opengl-hq' (flags = 4)
[cplayer] Setting option 'scale' = 'spline36' (flags = 4)
[cplayer] Setting option 'cscale' = 'spline36' (flags = 4)
[cplayer] Setting option 'dscale' = 'mitchell' (flags = 4)
[cplayer] Setting option 'dither-depth' = 'auto' (flags = 4)
[cplayer] Setting option 'correct-downscaling' = 'yes' (flags = 4)
[cplayer] Setting option 'sigmoid-upscaling' = 'yes' (flags = 4)
[cplayer] Setting option 'deband' = 'yes' (flags = 4)
[cplayer] Setting option 'hwdec' = 'vaapi' (flags = 4)
[cplayer] Setting option 'video-sync' = 'display-resample' (flags = 4)
[cplayer] Setting option 'screenshot-format' = 'png' (flags = 4)
[cplayer] Setting option 'screenshot-high-bit-depth' = 'no' (flags = 4)
[cplayer] Setting option 'demuxer-mkv-subtitle-preroll' = '' (flags = 4)
[cplayer] Setting option 'demuxer-mkv-subtitle-preroll-secs' = '4' (flags = 4)
[cplayer] Setting option 'ytdl-format' = 'bestvideo[height<=?1080][vcodec!=vp9][protocol!=http_dash_segments]+bestaudio/bestvideo[height<=?1080][protocol!=http_dash_segments]+bestaudio/best[protocol!=http_dash_segments]' (flags = 4)
[cplayer] Setting option 'cache-default' = '175000' (flags = 4)
[cplayer] Setting option 'audio-channels' = 'stereo' (flags = 4)
[cplayer] Setting option 'tscale' = 'sinc' (flags = 4)
[cplayer] Setting option 'v' = '' (flags = 8)
[cplayer] Setting option 'script' = '~/Projekte/mpv-mpris/mpris.so' (flags = 8)
[cplayer] Setting option 'idle' = '' (flags = 8)
[global] config path: 'input.conf' -> '/home/fratti/.config/mpv/input.conf'
[global] config path: 'input.conf' -/-> '/home/fratti/.mpv/input.conf'
[global] config path: 'input.conf' -/-> '/etc/mpv/input.conf'
[global] user path: '/home/fratti/.config/mpv/input.conf' -> '/home/fratti/.config/mpv/input.conf'
[bdmv/bluray] Opening /home/fratti/.config/mpv/input.conf
[file] Opening /home/fratti/.config/mpv/input.conf
[file] Stream opened successfully.
[input] Parsing input config file /home/fratti/.config/mpv/input.conf
[input] Input config file /home/fratti/.config/mpv/input.conf parsed: 9 binds
[osc] Loading lua script @osc.lua...
[global] config path: 'scripts' -> '/home/fratti/.config/mpv/scripts'
[global] config path: 'scripts' -/-> '/home/fratti/.mpv/scripts'
[global] config path: 'scripts' -/-> '/etc/mpv/scripts'
[osc] loading mp.defaults
[osc] loading @osc.lua
[global] config path: 'lua-settings/osc.conf' -/-> '/home/fratti/.config/mpv/lua-settings/osc.conf'
[global] config path: 'lua-settings/osc.conf' -/-> '/home/fratti/.mpv/lua-settings/osc.conf'
[global] config path: 'lua-settings/osc.conf' -/-> '/etc/mpv/lua-settings/osc.conf'
[osc] lua-settings/osc.conf not found.
[cplayer] Run command: define-section, flags=0, args=[showhide, mouse_move script-binding osc/__keybinding1
[cplayer] mouse_leave script-binding osc/__keybinding2
[cplayer] , force]
[cplayer] Run command: enable-section, flags=0, args=[showhide, allow-hide-cursor+allow-vo-dragging]
[cplayer] Run command: define-section, flags=0, args=[input, mouse_btn0 script-binding osc/__keybinding3
[cplayer] shift+mouse_btn0 script-binding osc/__keybinding4
[cplayer] mouse_btn2 script-binding osc/__keybinding5
[cplayer] mouse_btn3 script-binding osc/__keybinding6
[cplayer] mouse_btn4 script-binding osc/__keybinding7
[cplayer] axis_up script-binding osc/__keybinding8
[cplayer] axis_down script-binding osc/__keybinding9
[cplayer] mouse_btn0_dbl ignore
[cplayer] shift+mouse_btn0_dbl ignore
[cplayer] mouse_btn2_dbl ignore
[cplayer] , force]
[cplayer] Run command: enable-section, flags=0, args=[input, ]
[cplayer] Run command: define-section, flags=0, args=[input_osc, del script-binding osc/__keybinding10
[cplayer] , default]
[cplayer] Run command: enable-section, flags=0, args=[input_osc, allow-hide-cursor+allow-vo-dragging]
[cplayer] Run command: define-section, flags=0, args=[input_forced_osc, , force]
[cplayer] Run command: enable-section, flags=0, args=[input_forced_osc, allow-hide-cursor+allow-vo-dragging]
[cplayer] Done loading @osc.lua.
[ytdl_hook] Loading lua script @ytdl_hook.lua...
[global] config path: 'scripts' -> '/home/fratti/.config/mpv/scripts'
[global] config path: 'scripts' -/-> '/home/fratti/.mpv/scripts'
[global] config path: 'scripts' -/-> '/etc/mpv/scripts'
[ytdl_hook] loading mp.defaults
[cplayer] Run command: disable-section, flags=0, args=[input]
[global] config path: 'fonts' -/-> '/home/fratti/.config/mpv/fonts'
[global] config path: 'fonts' -/-> '/home/fratti/.mpv/fonts'
[global] config path: 'fonts' -/-> '/etc/mpv/fonts'
[osd/libass] Shaper: FriBidi 0.19.7 (SIMPLE) HarfBuzz-ng 1.4.6 (COMPLEX)
[global] config path: 'subfont.ttf' -/-> '/home/fratti/.config/mpv/subfont.ttf'
[global] config path: 'subfont.ttf' -/-> '/home/fratti/.mpv/subfont.ttf'
[global] config path: 'subfont.ttf' -/-> '/etc/mpv/subfont.ttf'
[global] config path: 'fonts.conf' -/-> '/home/fratti/.config/mpv/fonts.conf'
[global] config path: 'fonts.conf' -/-> '/home/fratti/.mpv/fonts.conf'
[global] config path: 'fonts.conf' -/-> '/etc/mpv/fonts.conf'
[osd/libass] Setting up fonts...
[ytdl_hook] loading @ytdl_hook.lua
[cplayer] Run command: hook-add, flags=0, args=[on_load, 1, 10]
[cplayer] Run command: hook-add, flags=0, args=[on_preloaded, 2, 10]
[cplayer] Done loading @ytdl_hook.lua.
[mpris] Loading SO plugin ~/Projekte/mpv-mpris/mpris.so...
[mpris] Could not load SO plugin ~/Projekte/mpv-mpris/mpris.so
[mpris] Exiting...
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
[cplayer] Done loading ~/Projekte/mpv-mpris/mpris.so.
[global] config path: 'scripts' -> '/home/fratti/.config/mpv/scripts'
[global] config path: 'scripts' -/-> '/home/fratti/.mpv/scripts'
[global] config path: 'scripts' -/-> '/etc/mpv/scripts'
[mpris] Loading SO plugin /home/fratti/.config/mpv/scripts/mpris.so...
[cplayer] Done loading /home/fratti/.config/mpv/scripts/mpris.so.
[cplayer] Run command: disable-section, flags=0, args=[showhide]
0x7f3320019080
[cplayer] Run command: quit, flags=9, args=[0]
[cplayer]
[cplayer] Exiting... (Quit)
[ytdl_hook] Exiting...
[osc] Exiting...
[mpris] Exiting...
It would be nice to implement it. For example, https://github.com/dodo/lua-mpris supports it.
Hi there,
Thanks for this work!
I'm trying to load it from a python script in which I'm using the python-mpv ctypes bindings.
Here's my sample code:
import mpv
def debug_print(loglevel, component, message):
print(f"[{loglevel}] {component}: {message}")
player = mpv.MPV(config=True, log_handler=debug_print)
url = "https://somafm.com/defcon130.pls"
player.play(url)
Here's the error I'm getting:
[error] mpris: C plugin error: '/home/berger/.config/mpv/scripts/mpris.so: undefined symbol: mpv_get_property'
[error] mpris: Could not load SO plugin /home/berger/.config/mpv/scripts/mpris.so
However, when I'm running mpv, and the extension is loaded automatically since it is in my scripts
path, it is loaded successfully and it sends the song metadata as expected via dbus-send.
Here's my version of the mpv
binary (this loads mpris.so successfully):
mpv 0.32.0-747-g5e4ec15e6c Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
built on Sat Sep 26 22:10:14 BST 2020
FFmpeg library versions:
libavutil 56.59.100
libavcodec 58.107.100
libavformat 58.59.100
libswscale 5.8.100
libavfilter 7.87.100
libswresample 3.8.100
FFmpeg version: N-99386-g85195f6ae9
On the other hand, I've built libmpv.so
from source using the latest tree and using the mpv-build repo.
Any hints as to what's causing this?
Thanks
I updated to version 0.33.0 and now changing the loop status work, but fetching it doesn't return the correct value.
Running playerctl -p mpv loop Track && playerctl -p mpv loop
the output is None
, but it actually loops the track.
[This is a copy of mpv-player/mpv/issues/6118].
v0.29.0
built on Jul 22 2018
ffmpeg library versions:
libavutil 56.14.100
libavcodec 58.18.100
libavformat 58.12.100
libswscale 5.1.100
libavfilter 7.16.100
libswresample 3.1.100
ffmpeg version: 4.0.2
Start a radio stream which reports "icy-title" (what's currently played) and have an invalid UTF-8 character in there. In my case it was, perhaps, in another encoding.
mpv skips the invalid character.
mpv crashes with the following message:
A: 01:09:21 / 01:09:37 (99%) Cache: 16s+498KB
File tags:
icy-title: NEK - LAURA NON C�
(process:15290): GLib-CRITICAL **: 15:09:02.059: g_variant_new_string: assertion 'g_utf8_validate (string, -1, NULL)' failed
dbus[15290]: arguments to dbus_message_iter_append_basic() were incorrect, assertion "_dbus_check_is_valid_utf8 (*string_p)" failed in file dbus-message.c line 2754.
This is normally a bug in some application using the D-Bus library.
D-Bus not built with -rdynamic so unable to print a backtrace
They closed it with:
Looks like a problem in the mpris plugin, as mpv by itself does not use dbus.
At that time this bug happened I was on commit d741f7a.
Manjaro 21.3 (Arch linux) - Gnome 42.2 with Wayland
mpv 0.34.1-dirty mpv --version
mpv-mpris 0.7.1
Please, can you add fullscreen status signals (true/false) ? Like with vlc or celluloid :
dbus-monitor "type='signal',interface='org.freedesktop.DBus.Properties'"
with celluloid :
signal time=1655305733.087620 sender=:1.155 -> destination=(null destination) serial=43
path=/org/mpris/MediaPlayer2; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
string "org.mpris.MediaPlayer2"
array [
dict entry(
string "Fullscreen"
variant boolean true
)
]
array [
]
I get other signals, play, pause,.. but not this one.
I don't know if this is a mistake or if it has not been added.
Thank you for your work.
Yours sincerely.
repro steps:
play media
hit the left arrow button a bunch of times to move the seek position
observe seek position in a mpris compatible tool (KDE's media player, for example)
notice that the seek position and actual seek location are different
First of all, thanks for your plugin!
Since I've started using it, I noticed the media keys stops working after a while in my Gnome (Fedora 29).
Not sure if it's a Gnome specific issue or something related to your plugin, maybe like missing to free a dbus lock (take this with a pinch of salt, I don't know how it works 😝 ).
I have not identified the exact steps exactly but I think it has to do with running multiple instances in parallel.
If you have any idea how I could gather more info for you let me know.
I installed glib dev library which includes gio.h:
sudo apt install libglib2.0-de
It still fails though:
pris.c:1:10: fatal error: gio/gio.h: No such file or directory
1 | #include <gio/gio.h>
Files went to:
/usr/include/glib-2.0/gio/gio.h
/usr/include/glib-2.0/glib/giochannel.h
Dear @hoyon,
I saw your latest commits.
Could you provide a newly compiled release version on the release page?
I got error when I execute the following command:
mpv --script /usr/lib/mpv/mpris.so music.mp3
Error parsing commandline option script: option requires parameter
Exiting... (Fatal error)
mpv-mpris version: 0.4-1 installed from AUR
$ mpv -v
[cplayer] Command line options: '-v'
[cplayer] mpv 0.32.0 Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
[cplayer] built on UNKNOWN
[cplayer] ffmpeg library versions:
[cplayer] libavutil 56.31.100
[cplayer] libavcodec 58.54.100
[cplayer] libavformat 58.29.100
[cplayer] libswscale 5.5.100
[cplayer] libavfilter 7.57.100
[cplayer] libswresample 3.5.100
[cplayer] ffmpeg version: n4.2.2
[cplayer]
[cplayer] Configuration: /usr/bin/waf configure --prefix=/usr --confdir=/etc/mpv --enable-cdda --enable-dvb --enable-dvdnav --enable-libarchive --enable-libmpv-shared --enable-libsmbclient --disable-build-date
[cplayer] List of enabled features: 52arch aligned_alloc alsa asm atomics caca cdda cplayer cplugins cuda-hwaccel cuda-interop debug-build drm drmprime dvbin dvdnav egl egl-drm egl-helpers egl-x11 fchmod ffmpeg ffnvcodec gbm gbm.h gl gl-wayland gl-x11 glibc-thread-name glob glob-posix gnuc gpl iconv jack javascript jpeg lcms2 libarchive libass libass-osd libav-any libavcodec libavdevice libavutil libbluray libdl libm libmpv-shared libplacebo librt libsmbclient linux-fstatfs lua memfd_create optimize oss-audio plain-gl posix posix-or-mingw posix-spawn posix-spawn-native pthreads pulse rubberband shaderc shaderc-shared stdatomic uchardet vaapi vaapi-drm vaapi-egl vaapi-vulkan vaapi-wayland vaapi-x-egl vaapi-x11 vdpau vdpau-gl-x11 vt.h vulkan wayland wayland-protocols x11 xv zlib
[cplayer] Reading config file /etc/mpv/encoding-profiles.conf
[cplayer] Applying profile 'default'...
[cplayer] Reading config file /home/balazs4/.config/mpv/mpv.conf
[cplayer] Applying profile 'default'...
[cplayer] Setting option 'osd-bar' = 'no' (flags = 4)
[cplayer] Setting option 'v' = '' (flags = 8)
[cplayer] mpv 0.32.0 Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects
[cplayer] built on UNKNOWN
[cplayer] ffmpeg library versions:
[cplayer] libavutil 56.31.100
[cplayer] libavcodec 58.54.100
[cplayer] libavformat 58.29.100
[cplayer] libswscale 5.5.100
[cplayer] libavfilter 7.57.100
[cplayer] libswresample 3.5.100
[cplayer] ffmpeg version: n4.2.2
[cplayer]
[cplayer] Usage: mpv [options] [url|path/]filename
[cplayer]
[cplayer] Basic options:
[cplayer] --start=<time> seek to given (percent, seconds, or hh:mm:ss) position
[cplayer] --no-audio do not play sound
[cplayer] --no-video do not play video
[cplayer] --fs fullscreen playback
[cplayer] --sub-file=<file> specify subtitle file to use
[cplayer] --playlist=<file> specify playlist file
[cplayer]
[cplayer] --list-options list all mpv options
[cplayer] --h=<string> print options which contain the given string in their name
[cplayer]
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Set property: shared-script-properties -> 1
please let me know if you need more details. thanks!
I face the problem that whenever 'mpris:length' receives an update via MPRIS the title, the url and the track id get send two, even if they have not changed. This causes unneeded extra traffic on the MPRIS bus and may cause applications two act upon title updates even though there is no real update, which in turn causes unnecessary load.
EDIT: If you wonder why the length variable changes during playback: I tried watching livestreams via youtube-dl + mpv...
For me, on openSUSE, the compilation worked only when I added glib-2.0
to the CFLAGS pkgconfig list.
Could you please verify if, with this added component, nothing breaks on your system?
-CFLAGS=-std=c99 -Wall -Wextra -O2 `$(PKG_CONFIG) --cflags gio-2.0 gio-unix-2.0 mpv`
+CFLAGS=-std=c99 -Wall -Wextra -O2 `$(PKG_CONFIG) --cflags gio-2.0 gio-unix-2.0 glib-2.0 mpv`
This seems to be more of a mild annoyance than anything, but when mpv starts up I now get this error message:
GLib-GIO-CRITICAL **: 21:03:15.407: g_dbus_connection_emit_signal: assertion 'G_IS_DBUS_CONNECTION (connection)' failed
It still works fine, and I'm kinda used to random glib spam now and then, but if possible it would still be nice to get rid of, if only to de-clutter the mpv cli.
Often, the play controls in KDE Connect Android stop working. I think it happens after Ubuntu waking up from standby, the play controls in the Ubuntu notification area still work after waking up, does that mean that my problem is caused by Ubuntu or GSConnect? I use GSConnect v50 because a newer version isn't supported on Ubuntu 22.04.
If I load mpv without mpris.so, the video plays as normal, and nothing shows up in playerctl -l
. However, if I load mpv with --script=~/.config/mpv/scripts/mpris.so
, and add the relevant dbus interfaces in /usr/lib/dbus-1/system.d/
, nothing shows up in playerctl -l
, and I get the following output:
`An object is already exported for the interface org.mpris.MediaPlayer2 at /org/mpris/MediaPlayer2
(process:27778): GLib-GIO-CRITICAL **: 15:59:09.590: g_dbus_connection_register_object: assertion 'error == NULL || error == NULL' failed
An object is already exported for the interface org.mpris.MediaPlayer2 at /org/mpris/MediaPlayer2 (+) Video --vid=1 () (h264 1280x720
30.000fps)
(+) Audio --aid=1 (*) (aac 2ch 44100Hz)
AO: [pulse] 44100Hz stereo 2ch float
VO: [gpu] 1280x720 yuv420p
AV: 00:00:04 / 00:04:53 (1%) A-V: 0.000
Exiting... (Quit)`
Some mpris clients make use of album art, most notably KDE Connect. When I listen to music on MPD with the MPDris plugin, KDE Connect gets the album art from the mpris protocol and displays it on my phone. Example data with playerctl:
$ playerctl metadata | grep artUrl
playerctld mpris:artUrl file:///home/frodo/Music/Eminem/Relapse/cover.jpg
It would be very nice to do the same thing when I watch a youtube video with mpv and mpv-mpris. Local files obviously wouldn't have a thumbnail.
At least on the command line, you can get the thumbnail URL like this:
$ youtube-dl --list-thumbnails "https://www.youtube.com/watch?v=HaMjPs66cTs"
[info] Thumbnails for HaMjPs66cTs:
ID width height URL
0 unknown unknown https://i.ytimg.com/vi/HaMjPs66cTs/maxresdefault.jpg
So in the end it would just involve getting the thumbnail URL and publishing it as artUrl. What do you think, is this something that is worth it to implement in this plugin?
I am using this plugin so that I can control MPV through the KDE Connect application. However, default seek distance is 10 seconds and I usually like to lower it to 5 seconds.
After some trial and error over the past few weeks I managed to make the seek button in KDE Connect seek by 5 seconds instead of 10 by modifying this line: (I tried to half the 10 seconds seek time)
--- mpris.c 2022-02-02 02:34:48.414593201 +0100
+++ m.c 2022-02-02 02:37:00.937265047 +0100
@@ -544,7 +544,7 @@
int64_t offset_us; // in microseconds
char *offset_str;
g_variant_get(parameters, "(x)", &offset_us);
- double offset_s = offset_us / 1000000.0;
+ double offset_s = 0.5 * offset_us / 1000000.0;
offset_str = g_strdup_printf("%f", offset_s);
const char *cmd[] = {"seek", offset_str, NULL};
This works great, but today I noticed that seeking with the slider inside of KDE Connect wrongly sets the new position. In fact, if I add a 0.5
multiplier like above, seeking with the slider by an amount x
away from the current position, will only make it seek by 0.5 * x
. In other words, if I am currently at 10'00" in the video, and slide to 0'00", then the new position will be 5'00". Similarly going from 2'00" to 3'00" will put me at 2'30".
I therefore reckon that this offset_s
is also used for seeking via the slider, which explains why seeking distance is off by the factor that I specified (here 0.5
, but adding a factor of 2
makes it go too far). I tried adding a factor of 0.5
or 2
to other mentions of 1000000
in the code in an attempt to counter the factor of 0.5
that I added for the offset but it ended up doing more harm than good.
I am slowly getting the impression that seek distance should actually be specified in KDE Connect instead of mpv-mpris (especially thanks to issue 36) but I am creating this issue in case it can actually be done properly through mpv-mpris. Also, I wouldn't know where to go to make this modification to KDE Connect I was imagining a sort of input.conf
like you have for MPV, where you can specify the distance but this further makes me believe the modification should rather happen inside of KDE Connect.
Apologies for this simple inquiry end up in such a long post. I wanted to properly highlight the issue with the slider in KDE Connect. Sliding inside of MPV properly sets the slider in KDE Connect. It does not work the other way around though after adding a factor to the offset of mpv-mpris (like mentioned above).
When playing an opus file which contains a cover image with mpv, it's not propagating through mpris.
I think it's a problem with mpv-mpris, since mpv shows the image in the window itself and reports using a cover art when run from the terminal. And when playing it with vlc, it shows up there fine.
If you think it's an issue with mpv itself, I can open a bug there too.
I'm currently trying to switch to the mpv flatpak, but mpris is currently not working correctly when using 3 or more instances of mpv.
The reason for this is that the process ids are in their own namespace and therefore start with 1 again.
The 1. mpv proccess takes the dbus identifier "mpv", the second and subsequent instances try to take "mpv.instance2", which causes a conflict from the third instance on.
Could this plugin include a check for further conflicts or otherwise circumvent this problem (appending a random number maybe)?
Thank you! :)
I think you should note in the README that metadata handling isn't fully implemented. In particular, there's no way to get the URL of the currently playing file.
Please correct me if I'm wrong, once the TrackList interface is added you will be able to get the URL by calling TrackList.GetTracksMetadata.
This is useful info for people who want to communicate with multiple instances of mpv playing videos.
I don't know exactly what the correct behaviour in general for this ought to be, but I observed the following behaviour that I would consider to be a bug:
mpv
mpv
Now, I can resume the music with MPRIS (good), but the track information emitted is that of the video I watched instead of the music.
Hello. Thank you for this awesome library of awesomeness. Did I mention that this awesome library of awesomeness is awesome?
I have noticed an annoying bug. If you pause mpv, and rewind the current file to the beginning, mpv will ignore the org.mpris.MediaPlayer.Player.PlayPause
command/signal/whatever. If I send org.mpris.MediaPlayer.Player.Play
, the player responds as expected. Also, if I don't rewind to the beginning, there's no problem.
I can still send the Next and Previous signal-thinggies, and they work as expected. I haven't tested any other dbus/mpris signal-thinngies.
I'm running version git-2018-05-17-05b392b
on Ubuntu 18.04. I only compiled mpv-mpris a few days ago, so I'm assuming it's still the newest version.
Also, as you may have already guessed, I don't really know much about dbus, hence my constant use of the term "thinggies".
The plugin works when using it in MPV, but stops working when I'm inside terminal (Windows terminal).
I get an error:
Can't load unknown script: HereIsThePath/mpris.so
BTW I'm using Windows with PowerShell which I suppose is causing this problem. Am I right?
MPV version: 0.34.0
MPV is finding the file correctly, however cannot LOAD it.
The full log is below, however the "tl;dr" is:
[mpris] Could not load SO plugin /tmp/mpv-mpris/mpris.so
[mpris] Could not load SO plugin /home/james/.config/mpv/scripts/mpris.so
(This is a separate issue from #1, which was caused by the fact that MPV doesn't internally parse tildes to the value of HOME—in this situation, the file is being specified correctly fails to activate.)
$ mpv 05\ Eternity\ Vector\ \(off\ Vocal\).flac -v --script=/tmp/mpv-mpris/mpris.so
[cplayer] Command line options: '05 Eternity Vector (off Vocal).flac' '-v' '--script=/tmp/mpv-mpris/mpris.so'
[cplayer] mpv git-94e82bc (C) 2000-2017 mpv/MPlayer/mplayer2 projects
[cplayer] built on Tue Mar 14 15:03:30 CDT 2017
[cplayer] ffmpeg library versions:
[cplayer] libavutil 55.34.101
[cplayer] libavcodec 57.64.101
[cplayer] libavformat 57.56.101
[cplayer] libswscale 4.2.100
[cplayer] libavfilter 6.65.100
[cplayer] libswresample 2.3.100
[cplayer] ffmpeg version: 3.2.4
[cplayer]
[cplayer] Configuration: /var/tmp/portage/media-video/mpv-9999-r9/work/mpv-9999/waf --prefix=/usr --libdir=/usr/lib64 --confdir=/etc/mpv --docdir=/usr/share/doc/mpv-9999-r9 --htmldir=/usr/share/doc/mpv-9999-r9/html --enable-libmpv-shared --disable-libmpv-static --disable-static-build --disable-optimize --disable-debug-build --enable-html-build --disable-pdf-build --enable-cplugins --enable-vf-dlopen-filters --enable-zsh-comp --disable-test --enable-iconv --disable-libsmbclient --enable-lua --lua=luajit --enable-libass --enable-libass-osd --enable-encoding --disable-libbluray --enable-dvdread --enable-dvdnav --enable-cdda --enable-uchardet --enable-rubberband --enable-lcms2 --enable-vapoursynth --disable-vapoursynth-lazy --disable-libarchive --enable-libavdevice --disable-sdl2 --disable-sdl1 --disable-oss-audio --disable-rsound --disable-sndio --enable-pulse --disable-jack --enable-openal --disable-opensles --enable-alsa --disable-coreaudio --disable-cocoa --enable-drm --disable-gbm --enable-wayland --enable-x11 --enable-xss --enable-xext --enable-xv --enable-xinerama --enable-xrandr --disable-gl-cocoa --enable-gl-x11 --enable-egl-x11 --disable-egl-drm --enable-gl-wayland --enable-vdpau --enable-vdpau-gl-x11 --disable-vaapi --disable-vaapi-x11 --disable-vaapi-wayland --disable-vaapi-drm --enable-caca --enable-jpeg --disable-android --disable-rpi --enable-standard-gl --disable-ios-gl --enable-plain-gl --disable-mali-fbdev --disable-vaapi-hwaccel --enable-vdpau-hwaccel --disable-cuda-hwaccel --enable-tv --enable-tv-v4l2 --enable-libv4l2 --enable-audio-input --disable-dvbin --disable-apple-remote configure
[cplayer] List of enabled features: alsa any-gl asm atomics audio-input build-date c11-tls caca cdda cplayer cplugins dlopen drm dvdnav dvdread egl-helpers egl-x11 encoding fchmod gbm.h gcc-tls gl gl-wayland gl-x11 glibc-thread-name glob gnuc iconv is_ffmpeg jpeg lcms2 libass libass-osd libav libavcodec libavdevice libdl libm libmpv-shared librt libv4l2 linux-fstatfs lua nanosleep openal plain-gl posix posix-or-mingw posix-spawn pthreads pulse rubberband shm standard-gl stdatomic subprocess termios tv tv-v4l2 uchardet vapoursynth vapoursynth-core vdpau vdpau-gl-x11 vdpau-hwaccel vf-dlopen-filters videodev vt.h wayland x11 xext xinerama xrandr xss xv zlib zsh-comp
[global] config path: '' -> '/home/james/.config/mpv'
[global] config path: 'mpv.conf' -> '/home/james/.config/mpv/mpv.conf'
[global] config path: 'config' -/-> '/home/james/.config/mpv/config'
[global] config path: 'mpv.conf' -/-> '/home/james/.mpv/mpv.conf'
[global] config path: 'config' -/-> '/home/james/.mpv/config'
[global] config path: 'mpv.conf' -> '/etc/mpv/mpv.conf'
[global] config path: 'config' -/-> '/etc/mpv/config'
[cplayer] Reading config file /etc/mpv/mpv.conf
[cplayer] Setting option 'hwdec' = 'auto' (flags = 4)
[cplayer] Reading config file /home/james/.config/mpv/mpv.conf
[cplayer] Setting option 'osd-fractions' = '' (flags = 4)
[cplayer] Setting option 'input-ipc-server' = '/tmp/1000-mpv-socket' (flags = 4)
[cplayer] Setting option 'deinterlace' = 'yes' (flags = 4)
[cplayer] Setting option 'hwdec' = 'auto' (flags = 4)
[cplayer] Setting option 'vo' = 'opengl' (flags = 4)
[cplayer] Setting option 'tscale' = 'oversample' (flags = 4)
[cplayer] Setting option 'interpolation' = '' (flags = 4)
[cplayer] Setting option 'video-sync' = 'display-resample' (flags = 4)
[cplayer] Setting option 'scale' = 'ewa_lanczossharp' (flags = 4)
[cplayer] Setting option 'v' = '' (flags = 8)
[cplayer] Setting option 'script' = '/tmp/mpv-mpris/mpris.so' (flags = 8)
[global] config path: 'input.conf' -/-> '/home/james/.config/mpv/input.conf'
[global] config path: 'input.conf' -/-> '/home/james/.mpv/input.conf'
[global] config path: 'input.conf' -/-> '/etc/mpv/input.conf'
[osc] Loading lua script @osc.lua...
[global] config path: 'scripts' -> '/home/james/.config/mpv/scripts'
[global] config path: 'scripts' -/-> '/home/james/.mpv/scripts'
[global] config path: 'scripts' -/-> '/etc/mpv/scripts'
[osc] loading mp.defaults
[osc] loading @osc.lua
[global] config path: 'lua-settings/osc.conf' -/-> '/home/james/.config/mpv/lua-settings/osc.conf'
[global] config path: 'lua-settings/osc.conf' -/-> '/home/james/.mpv/lua-settings/osc.conf'
[global] config path: 'lua-settings/osc.conf' -/-> '/etc/mpv/lua-settings/osc.conf'
[osc] lua-settings/osc.conf not found.
[cplayer] Run command: define-section, flags=0, args=[showhide, mouse_move script-binding osc/__keybinding1
[cplayer] mouse_leave script-binding osc/__keybinding2
[cplayer] , force]
[cplayer] Run command: enable-section, flags=0, args=[showhide, allow-hide-cursor+allow-vo-dragging]
[cplayer] Run command: define-section, flags=0, args=[input, mouse_btn0 script-binding osc/__keybinding3
[cplayer] shift+mouse_btn0 script-binding osc/__keybinding4
[cplayer] mouse_btn2 script-binding osc/__keybinding5
[cplayer] mouse_btn0_dbl ignore
[cplayer] shift+mouse_btn0_dbl ignore
[cplayer] mouse_btn2_dbl ignore
[cplayer] , force]
[cplayer] Run command: enable-section, flags=0, args=[input, ]
[cplayer] Run command: define-section, flags=0, args=[input_osc, del script-binding osc/__keybinding6
[cplayer] , default]
[cplayer] Run command: enable-section, flags=0, args=[input_osc, allow-hide-cursor+allow-vo-dragging]
[cplayer] Run command: define-section, flags=0, args=[input_forced_osc, , force]
[cplayer] Run command: enable-section, flags=0, args=[input_forced_osc, allow-hide-cursor+allow-vo-dragging]
[cplayer] Done loading @osc.lua.
[ytdl_hook] Loading lua script @ytdl_hook.lua...
[global] config path: 'scripts' -> '/home/james/.config/mpv/scripts'
[global] config path: 'scripts' -/-> '/home/james/.mpv/scripts'
[global] config path: 'scripts' -/-> '/etc/mpv/scripts'
[ytdl_hook] loading mp.defaults
[cplayer] Run command: disable-section, flags=0, args=[input]
[global] config path: 'fonts' -/-> '/home/james/.config/mpv/fonts'
[global] config path: 'fonts' -/-> '/home/james/.mpv/fonts'
[global] config path: 'fonts' -/-> '/etc/mpv/fonts'
[osd/libass] Shaper: FriBidi 0.19.6 (SIMPLE) HarfBuzz-ng 1.4.5 (COMPLEX)
[global] config path: 'subfont.ttf' -/-> '/home/james/.config/mpv/subfont.ttf'
[global] config path: 'subfont.ttf' -/-> '/home/james/.mpv/subfont.ttf'
[global] config path: 'subfont.ttf' -/-> '/etc/mpv/subfont.ttf'
[global] config path: 'fonts.conf' -/-> '/home/james/.config/mpv/fonts.conf'
[global] config path: 'fonts.conf' -/-> '/home/james/.mpv/fonts.conf'
[global] config path: 'fonts.conf' -/-> '/etc/mpv/fonts.conf'
[osd/libass] Setting up fonts...
[ytdl_hook] loading @ytdl_hook.lua
[cplayer] Run command: hook-add, flags=0, args=[on_load, 1, 10]
[cplayer] Run command: hook-add, flags=0, args=[on_preloaded, 2, 10]
[cplayer] Done loading @ytdl_hook.lua.
[global] user path: '/tmp/1000-mpv-socket' -> '/tmp/1000-mpv-socket'
[ipc] Starting IPC master
[mpris] Loading SO plugin /tmp/mpv-mpris/mpris.so...
[ipc] Listening to IPC socket.
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
[mpris] Could not load SO plugin /tmp/mpv-mpris/mpris.so
[mpris] Exiting...
[cplayer] Done loading /tmp/mpv-mpris/mpris.so.
[global] config path: 'scripts' -> '/home/james/.config/mpv/scripts'
[global] config path: 'scripts' -/-> '/home/james/.mpv/scripts'
[global] config path: 'scripts' -/-> '/etc/mpv/scripts'
[mpris] Loading SO plugin /home/james/.config/mpv/scripts/mpris.so...
[mpris] Could not load SO plugin /home/james/.config/mpv/scripts/mpris.so
[mpris] Exiting...
[cplayer] Done loading /home/james/.config/mpv/scripts/mpris.so.
[global] config path: 'watch_later' -> '/home/james/.config/mpv/watch_later'
[cplayer] Playing: 05 Eternity Vector (off Vocal).flac
[cplayer] Running hook: ytdl_hook/on_load
[cplayer] Run command: hook-ack, flags=0, args=[on_load]
[ifo] Opening 05 Eternity Vector (off Vocal).flac
[ifo_dvdnav] Opening 05 Eternity Vector (off Vocal).flac
[file] Opening 05 Eternity Vector (off Vocal).flac
[file] Stream opened successfully.
[demux] Trying demuxers for level=normal.
[lavf] Found 'flac' at score=50 size=2048.
[lavf] avformat_find_stream_info() finished after 373339 bytes.
[demux] Detected file format: flac (libavformat)
[cplayer] Opening done: 05 Eternity Vector (off Vocal).flac
[find_files] Loading external files in .
[global] config path: 'sub/' -/-> '/home/james/.config/mpv/sub/'
[global] config path: 'sub/' -/-> '/home/james/.mpv/sub/'
[global] config path: 'sub/' -/-> '/etc/mpv/sub/'
[global] config path: 'audio/' -/-> '/home/james/.config/mpv/audio/'
[global] config path: 'audio/' -/-> '/home/james/.mpv/audio/'
[global] config path: 'audio/' -/-> '/etc/mpv/audio/'
[cplayer] Running hook: ytdl_hook/on_preloaded
[cplayer] Run command: hook-ack, flags=0, args=[on_preloaded]
[cplayer] (+) Video --vid=1 [P] (mjpeg)
[cplayer] (+) Audio --aid=1 (flac)
[display-tags] File tags:
[display-tags] Artist: Itou Shun
[display-tags] Album: Uchuu Engineer
[display-tags] Album_Artist: Itou Kanako
[display-tags] Comment: Ripped by strayer
[display-tags] Romanized by Ignis
[display-tags] Brought to you by Anime-Sharing.com
[display-tags] Come and visit us or say "Hi" in our IRC channel: #[email protected]
[display-tags] Composer: Mizoguchi Kazuhiko
[display-tags] Genre: Game
[display-tags] Title: Eternity Vector (off Vocal)
[display-tags] Track: 5
[vo/opengl] Initializing OpenGL backend 'wayland'
[vo/opengl/wayland] failed to connect to a wayland server: check if a wayland compositor is running
[vo/opengl] Initializing OpenGL backend 'x11probe'
[vo/opengl/x11] X11 opening display: :0.0
[vo/opengl/x11] X11 running at 2720x1024 (":0.0" => local display)
[vo/opengl/x11] Detected wm supports NetWM.
[vo/opengl/x11] Detected wm supports ABOVE state.
[vo/opengl/x11] Detected wm supports BELOW state.
[vo/opengl/x11] Detected wm supports FULLSCREEN state.
[vo/opengl/x11] Display 0 (DVI-0): [1280, 0, 2720, 900] @ 59.887445 FPS
[vo/opengl/x11] Display 1 (DVI-1): [0, 0, 1280, 1024] @ 60.019740 FPS
[vo/opengl/x11] Current display FPS: 59.887445
[vo/opengl] GLX chose FB config with ID 0xaf
[vo/opengl] GLX chose visual with ID 0x305
[vo/opengl] Creating OpenGL 3.3 context...
[vo/opengl] GL_VERSION='4.5 (Core Profile) Mesa 17.0.4'
[vo/opengl] Detected desktop OpenGL 4.5.
[vo/opengl] GL_VENDOR='X.Org'
[vo/opengl] GL_RENDERER='Gallium 0.4 on AMD PITCAIRN (DRM 2.49.0 / 4.10.8-ck, LLVM 4.0.0)'
[vo/opengl] GL_SHADING_LANGUAGE_VERSION='4.50'
[vo/opengl] Loaded extension GLX_SGI_swap_control.
[vo/opengl] Loaded extension GLX_SGI_video_sync.
[vo/opengl] Loaded extension GL_NV_vdpau_interop.
[vo/opengl] 16 bit texture depth: 16.
[vo/opengl] Reported display depth: R=8, G=8, B=8
[vo/opengl] Testing FBO format 0x805b
[vo/opengl] Create FBO: 16x16 (16x16)
[vo/opengl] Using FBO format 0x805b.
[vo/opengl] Loading hwdec driver 'vdpau-glx'
[vo/opengl] Assuming 59.887445 FPS for display sync.
[vd] Container reported FPS: 0.000000
[vd] Codec list:
[vd] mjpeg - MJPEG (Motion JPEG)
[vd] Opening video decoder mjpeg
[vd] Not trying to use hardware decoding: codec mjpeg is not on whitelist, or does not support hardware acceleration.
[vd] Using software decoding.
[vd] Detected 8 logical cores.
[vd] Requesting 9 threads for decoding.
[vd] Selected video codec: mjpeg (MJPEG (Motion JPEG))
[ad] Codec list:
[ad] flac - FLAC (Free Lossless Audio Codec)
[ad] Opening audio decoder flac
[ad] Requesting 1 threads for decoding.
[ad] Selected audio codec: flac (FLAC (Free Lossless Audio Codec))
[cplayer] Displaying attached picture. Use --no-audio-display to prevent this.
[cplayer] Starting playback...
[vo/opengl/x11] Disabling screensaver.
[vd] Using software decoding.
[vd] Decoder format: 496x500 yuv444p bt.601/auto/auto/full CL=mpeg1/jpeg
[vf] Video filter chain:
[vf] [in] 496x500 yuv444p bt.601/bt.709/bt.1886/full CL=mpeg1/jpeg
[vf] [out] 496x500 yuv444p bt.601/bt.709/bt.1886/full CL=mpeg1/jpeg
[vf] Opening video filter: [yadif]
[yadif] Using libavfilter for 'yadif'
[yadif] lavfi: create graph: 'yadif=mode=send_field:deint=interlaced'
[ffmpeg] src: w:496 h:500 pixfmt:yuv444p tb:1/1000000 fr:0/1 sar:100/100 sws_param:
[vf] Video filter chain:
[vf] [in] 496x500 yuv444p bt.601/bt.709/bt.1886/full CL=mpeg1/jpeg
[vf] [yadif] "deinterlace" 496x500 yuv444p bt.601/bt.709/bt.1886/full CL=mpeg1/jpeg
[vf] [out] 496x500 yuv444p bt.601/bt.709/bt.1886/full CL=mpeg1/jpeg
[af] Audio filter chain:
[af] [in] 44100Hz stereo 2ch s16
[af] [out] 44100Hz stereo 2ch s16
[af] [ao] 44100Hz stereo 2ch s16
[ao] Trying audio driver 'pulse'
[ao/pulse] requested format: 44100 Hz, stereo channels, s16
[ao/pulse] Library version: 10.0.0
[ao/pulse] Proto: 32
[ao/pulse] Server proto: 4294967295
[ao/pulse] Channel layouts:
[ao/pulse] - #fl
[ao/pulse] - #fr
[ao/pulse] - #fc
[ao/pulse] - #lfe
[ao/pulse] - #bl
[ao/pulse] - #br
[ao/pulse] - #flc
[ao/pulse] - #frc
[ao/pulse] - #bc
[ao/pulse] - #sl
[ao/pulse] - #sr
[ao/pulse] - #tc
[ao/pulse] - #tfl
[ao/pulse] - #tfc
[ao/pulse] - #tfr
[ao/pulse] - #tbl
[ao/pulse] - #tbc
[ao/pulse] - #tbr
[ao/pulse] result: stereo
[ao/pulse] device buffer: 5513 samples.
[ao/pulse] using soft-buffer of 8820 samples.
[cplayer] AO: [pulse] 44100Hz stereo 2ch s16
[cplayer] AO: Description: PulseAudio audio output
[cplayer] VO: [opengl] 496x500 yuv444p
[cplayer] VO: Description: Extended OpenGL Renderer
[vo/opengl] Resize: 496x500
[vo/opengl] Window size: 496x500
[vo/opengl] Video source: 496x500 (100:100)
[vo/opengl] Video display: (0, 0) 496x500 -> (0, 0) 496x500
[vo/opengl] Video scale: 1.000000/1.000000
[vo/opengl] OSD borders: l=0 t=0 r=0 b=0
[vo/opengl] Video borders: l=0 t=0 r=0 b=0
[vo/opengl] Testing FBO format 0x805b
[vo/opengl] Create FBO: 16x16 (16x16)
[vo/opengl] Using FBO format 0x805b.
[vo/opengl] Texture for plane 0: 496x500
[vo/opengl] Texture for plane 1: 496x500
[vo/opengl] Texture for plane 2: 496x500
[cplayer] set video colors output-levels=0
[vo/opengl] Create FBO: 496x500 (496x500)
[vo/opengl] recompiling a shader program:
[vo/opengl] [ 1] // merging plane 1 ...
[vo/opengl] [ 2] color.r = 1.000000 * vec4(texture(texture0, texcoord0)).r;
[vo/opengl] [ 3] // merging plane 2 ... into 1
[vo/opengl] [ 4] color.g = 1.000000 * vec4(texture(texture1, texcoord1)).r;
[vo/opengl] Create FBO: 496x500 (496x500)
[vo/opengl] recompiling a shader program:
[vo/opengl] [ 1] // combining planes
[vo/opengl] [ 2] color.r = 1.000000 * vec4(texture(texture0, texcoord0)).r;
[vo/opengl] [ 3] color.gb = 1.000000 * vec4(texture(texture1, texcoord1)).rg;
[vo/opengl] [ 4] // color conversion
[vo/opengl] [ 5] color = color.rgba;
[vo/opengl] [ 6] color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;
[vo/opengl] [ 7] color.a = 1.0;
[vo/opengl] [ 8] // scaler pre-conversion
[vo/opengl] [ 9] // main scaling
[vo/opengl] Create FBO: 496x500 (512x512)
[vo/opengl] recompiling a shader program:
[vo/opengl] [ 1] #undef tex
[vo/opengl] [ 2] #define tex texture0
[vo/opengl] [ 3] vec2 pos = texcoord0;
[vo/opengl] [ 4] vec2 size = texture_size0;
[vo/opengl] [ 5] vec2 pt = pixel_size0;
[vo/opengl] [ 6] color = texture(tex, pos);
[vo/opengl] [ 7] color *= 1.000000;
[vo/opengl] [ 8] color.a = 1.000000;
[vo/opengl] [ 9] // scaler post-conversion
[vo/opengl] recompiling a shader program:
[vo/opengl] [ 1] color.rgb = 1.000000 * vec4(texture(texture0, texcoord0)).rgb;
[vo/opengl] [ 2] // color mapping
[osd/libass] fontselect: (sans-serif, 400, 0) -> /usr/share/fonts/dejavu/DejaVuSans.ttf, 0, DejaVuSans
[cplayer] first video frame after restart shown
[cplayer] starting audio playback
[cplayer] playback restart complete
[statusline] AV: 00:00:00.629 / 00:04:49.639 (0%) DS: 1.000/0
[cplayer] Run command: quit, flags=9, args=[0]
[cplayer] EOF code: 6
[ad] Uninit audio decoder.
[yadif] lavfi: create graph: 'yadif=mode=send_field:deint=interlaced'
[ffmpeg] src: w:496 h:500 pixfmt:yuv444p tb:1/1000000 fr:0/1 sar:100/100 sws_param:
[vd] Uninit video.
[vo/opengl/x11] Enabling screensaver.
[cplayer] finished playback, success (reason 3)
[cplayer]
[cplayer]
[cplayer] Exiting... (Quit)
[ytdl_hook] Exiting...
[osc] Exiting...
[ao/pulse] draining...
[vo/opengl] flushing shader cache
[vo/opengl/x11] uninit ...
This was tested with mpv 0.31.0 from RPM Fusion and self-compiled
something must have changed because in mpv 0.29.0 it worked just fine
Trying to instantiate a new mpv context with mpv_context_new
after having called mpv_destroy
or mpv_terminate_destroy
on an instance which had already loaded mpv-mpris currently causes a segmentation fault as mpv tries to load the plugin the second time:
AddressSanitizer:DEADLYSIGNAL
=================================================================
==34262==ERROR: AddressSanitizer: SEGV on unknown address 0x7fd5651f89a0 (pc 0x7fd568a55114 bp 0x000000000006 sp 0x7fd5669fb810 T27)
==34262==The signal is caused by a READ memory access.
#0 0x7fd568a55113 in event_handler /home/aanok/mpv-mpris/mpris.c:858:11
#1 0x7fd574e5526e in g_main_context_dispatch (/usr/lib/libglib-2.0.so.0+0x6a26e)
#2 0x7fd574e571b0 (/usr/lib/libglib-2.0.so.0+0x6c1b0)
#3 0x7fd574e580c2 in g_main_loop_run (/usr/lib/libglib-2.0.so.0+0x6d0c2)
#4 0x7fd568a56224 in mpv_open_cplugin /home/aanok/mpv-mpris/mpris.c:955:5
#5 0x7fd577be6372 (/usr/lib/libmpv.so.1+0xcc372)
#6 0x7fd577be621a (/usr/lib/libmpv.so.1+0xcc21a)
#7 0x7fd577b014ce in start_thread (/usr/lib/libpthread.so.0+0x94ce)
#8 0x7fd5778be2d2 in clone (/usr/lib/libc.so.6+0xff2d2)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/aanok/mpv-mpris/mpris.c:858:11 in event_handler
Thread T27 (mpv/SO plugin () created by T0 here:
#0 0x5571fc8f63f4 in pthread_create (/home/aanok/Programming/tests/mpv_simple+0x3d3f4)
#1 0x7fd577be6526 (/usr/lib/libmpv.so.1+0xcc526)
==34262==ABORTING
(I'm attaching source code for a minimal example to illustrate the behavior: mpv_simple.c.txt)
I'm not familiar with GLib, but it seems the mpv people themselves go on taking some extra measures when using it for a plugin. Indeed their example doesn't cause segfaults.
Would it be possible to make mpv-mpris be able to be loaded multiple times for multiple mpv contexts without error? It is a pattern I have encountered while developing an application embedding mpv via libmpv.
I've been using this with a script I wrote that works as my remote for controlling playback of all my open mpv windows. please check it out and do with it as you please :-)
Usage: $ mpv_remote COMMAND [all | PID[,PID]]
Example: mpv_remote play all
mpv_remote next
mpv_remote pause 845
mpv_remote pause 845,846
Dear @hoyon,
Thank you! I would love to try your plugin and control mpv from my media keys.
But how do I do it?
Can we add installation instructions to your README?
I am on Linux Mint 18.3.
Thank you!
I found that mpv treats cue sheet entries as chapters. If a cue sheet contains 4 entries (i.e. 4 songs / pieces of music), it means that there will be 4 chapters.
If I change this ... (Lines 378 - 386)
} else if (g_strcmp0(method_name, "Next") == 0) {
const char *cmd[] = {"playlist_next", NULL};
mpv_command_async(ud->mpv, 0, cmd);
g_dbus_method_invocation_return_value(invocation, NULL);
} else if (g_strcmp0(method_name, "Previous") == 0) {
const char *cmd[] = {"playlist_prev", NULL};
mpv_command_async(ud->mpv, 0, cmd);
g_dbus_method_invocation_return_value(invocation, NULL);
... into this,
} else if (g_strcmp0(method_name, "Next") == 0) {
const char *cmd[] = {"add", "chapter", "1", NULL};
mpv_command_async(ud->mpv, 0, cmd);
g_dbus_method_invocation_return_value(invocation, NULL);
} else if (g_strcmp0(method_name, "Previous") == 0) {
const char *cmd[] = {"add", "chapter", "-1", NULL};
mpv_command_async(ud->mpv, 0, cmd);
g_dbus_method_invocation_return_value(invocation, NULL);
Then "Media Next" and "Media Previous" keyboard keys, which are originally used to jump to the next / previous file in playlist, will be used to jump to the next / previous entry in cue sheet.
For VLC (which does not require additional mpris plugin), when a .cue file is played, the keys jump to the next / previous entry in cue sheet. (However, this behavior of VLC does not apply to video files with chapter markers.)
Will it be possible / suitable for the mpv-mpris plugin to detect whether a cue sheet file is being played, and switches the mode to work on cue sheet entries instead of playlist file entries?
Hi
when run make test
, the test failed because mpv reads the user or systemwide config file. wich can cantains the entry wich enable the mpirs plugin installed by the user in other instance. this cause malfuction between the old plugin and the new builded version, because is loaded twice
adding the line '--no-config ' between
Lines 109 to 110 in ed9f36b
solve the issue
snip the log
++ mpv --load-scripts=no --script=../mpris.so --vo=null --ao=null --msg-time --msg-module --msg-level=cplayer=trace,mpris=trace --log-file=./metadata.mpv.log --input-ipc-server=./metadata.mpv.ipc /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga
++ sleep 1
+++ awk '/statusline.*Paused/{print>"/dev/stdout";next} 1'
[cplayer] mpv 0.35.0-2-g1e9a2cbebf Copyright © 2000-2022 mpv/MPlayer/mplayer2 projects
[cplayer] built on UNKNOWN
[cplayer] FFmpeg library versions:
[cplayer] libavutil 57.42.100
[cplayer] libavcodec 59.52.102
[cplayer] libavformat 59.34.101
[cplayer] libswscale 6.8.112
[cplayer] libavfilter 8.50.100
[cplayer] libswresample 4.9.100
[cplayer] FFmpeg version: N-109078-g2d25f33a7e
[cplayer]
[cplayer] Configuration: ./waf configure --prefix=/usr --confdir=/etc/mpv --htmldir=/usr/share/doc/mpv/html --disable-build-date --lua=luajit --enable-cdda --enable-dvbin --enable-dvdnav --enable-html-build --enable-libarchive --enable-libmpv-shared --enable-openal --enable-sdl2 --enable-shaderc --enable-vulkan --enable-gl-x11 --enable-egl --enable-egl-x11 --enable-egl-drm --enable-gl-wayland --enable-drm --enable-gbm --enable-wayland --enable-vdpau --enable-vdpau-gl-x11 --enable-vaapi --enable-vaapi-x11 --enable-vaapi-wayland --enable-vaapi-drm --enable-vaapi-x-egl --enable-cuda-hwaccel --enable-cuda-interop --color=yes
[cplayer] List of enabled features: alsa asm av-channel-layout caca cdda cplayer cplugins cuda-hwaccel cuda-interop debug-build dmabuf-interop-gl dmabuf-interop-pl dmabuf-wayland drm drm-is-kms dvbin dvdnav egl egl-drm egl-helpers egl-x11 ffmpeg ffnvcodec gbm gbm.h gl gl-wayland gl-x11 glibc-thread-name glob glob-posix gpl iconv jack javascript jpeg jpegxl lcms2 libarchive libass libavdevice libbluray libdl libm libmpv-shared libplacebo libplacebo-next librt linux-fstatfs linux-input-event-codes lua luajit memfd_create openal optimize pipewire plain-gl posix posix-or-mingw pthreads pulse rubberband rubberband-3 sdl2 sdl2-audio sdl2-gamepad sdl2-video shaderc shaderc-shared sixel spirv-cross spirv-cross-shared stdatomic uchardet vaapi vaapi-drm vaapi-egl vaapi-libplacebo vaapi-wayland vaapi-x-egl vaapi-x11 vapoursynth vdpau vdpau-gl-x11 vector vt.h vulkan wayland wayland-protocols wayland-protocols-1-24 x11 xv zimg zlib
[cplayer] Command line options: '--load-scripts=no' '--script=../mpris.so' '--vo=null' '--ao=null' '--msg-time' '--msg-module' '--msg-level=cplayer=trace,mpris=trace' '--log-file=./metadata.mpv.log' '--input-ipc-server=./metadata.mpv.ipc' '/usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga'
[cplayer] mpv 0.35.0-2-g1e9a2cbebf Copyright © 2000-2022 mpv/MPlayer/mplayer2 projects
[cplayer] built on UNKNOWN
[cplayer] FFmpeg library versions:
[cplayer] libavutil 57.42.100
[cplayer] libavcodec 59.52.102
[cplayer] libavformat 59.34.101
[cplayer] libswscale 6.8.112
[cplayer] libavfilter 8.50.100
[cplayer] libswresample 4.9.100
[cplayer] FFmpeg version: N-109078-g2d25f33a7e
[cplayer]
[cplayer] Configuration: ./waf configure --prefix=/usr --confdir=/etc/mpv --htmldir=/usr/share/doc/mpv/html --disable-build-date --lua=luajit --enable-cdda --enable-dvbin --enable-dvdnav --enable-html-build --enable-libarchive --enable-libmpv-shared --enable-openal --enable-sdl2 --enable-shaderc --enable-vulkan --enable-gl-x11 --enable-egl --enable-egl-x11 --enable-egl-drm --enable-gl-wayland --enable-drm --enable-gbm --enable-wayland --enable-vdpau --enable-vdpau-gl-x11 --enable-vaapi --enable-vaapi-x11 --enable-vaapi-wayland --enable-vaapi-drm --enable-vaapi-x-egl --enable-cuda-hwaccel --enable-cuda-interop --color=yes
[cplayer] List of enabled features: alsa asm av-channel-layout caca cdda cplayer cplugins cuda-hwaccel cuda-interop debug-build dmabuf-interop-gl dmabuf-interop-pl dmabuf-wayland drm drm-is-kms dvbin dvdnav egl egl-drm egl-helpers egl-x11 ffmpeg ffnvcodec gbm gbm.h gl gl-wayland gl-x11 glibc-thread-name glob glob-posix gpl iconv jack javascript jpeg jpegxl lcms2 libarchive libass libavdevice libbluray libdl libm libmpv-shared libplacebo libplacebo-next librt linux-fstatfs linux-input-event-codes lua luajit memfd_create openal optimize pipewire plain-gl posix posix-or-mingw pthreads pulse rubberband rubberband-3 sdl2 sdl2-audio sdl2-gamepad sdl2-video shaderc shaderc-shared sixel spirv-cross spirv-cross-shared stdatomic uchardet vaapi vaapi-drm vaapi-egl vaapi-libplacebo vaapi-wayland vaapi-x-egl vaapi-x11 vapoursynth vdpau vdpau-gl-x11 vector vt.h vulkan wayland wayland-protocols wayland-protocols-1-24 x11 xv zimg zlib
[cplayer] Reading config file /etc/mpv/encoding-profiles.conf
[cplayer] Applying profile 'default'...
[cplayer] Reading config file /etc/mpv/mpv.conf
[cplayer] Applying profile 'default'...
[cplayer] Setting option 'gpu-api' = 'vulkan' (flags = 4)
[cplayer] Setting option 'vo' = 'gpu' (flags = 4)
[cplayer] Setting option 'hwdec' = 'nvdec' (flags = 4)
[cplayer] Setting option 'gpu-context' = 'x11vk' (flags = 4)
[cplayer] Setting option 'spirv-compiler' = 'auto' (flags = 4)
[cplayer] Setting option 'audio-device' = 'pulse' (flags = 4)
[cplayer] Setting option 'audio-channels' = 'auto' (flags = 4)
[cplayer] Setting option 'screenshot-format' = 'png' (flags = 4)
[cplayer] Setting option 'screenshot-high-bit-depth' = 'yes' (flags = 4)
[cplayer] Setting option 'hidpi-window-scale' = 'no' (flags = 4)
[cplayer] Setting option 'cdrom-device' = '/dev/cdrom' (flags = 4)
[cplayer] Setting option 'dvd-device' = '/dev/cdrom' (flags = 4)
[cplayer] Setting option 'bluray-device' = '/dev/cdrom' (flags = 4)
[cplayer] Setting option 'script-opts' = 'osc-layout=bottombar,osc-timems=yes' (flags = 4)
[cplayer] Setting option 'demuxer-mkv-subtitle-preroll' = '' (flags = 4)
[cplayer] Setting option 'sub-ass-vsfilter-blur-compat' = 'yes' (flags = 4)
[cplayer] Setting option 'scripts-append' = '/usr/share/mpv/scripts/mpris.so' (flags = 4)
[cplayer] Setting option 'load-scripts' = 'no' (flags = 8)
[cplayer] Setting option 'scripts-append' = '../mpris.so' (flags = 8)
[cplayer] Setting option 'vo' = 'null' (flags = 8)
[cplayer] Setting option 'ao' = 'null' (flags = 8)
[cplayer] Setting option 'msg-time' = '' (flags = 8)
[cplayer] Setting option 'msg-module' = '' (flags = 8)
[cplayer] Setting option 'msg-level' = 'cplayer=trace,mpris=trace' (flags = 8)
[cplayer] Setting option 'log-file' = './metadata.mpv.log' (flags = 8)
[cplayer] Setting option 'input-ipc-server' = './metadata.mpv.ipc' (flags = 8)
[ 0.010947] mpris: Loading SO plugin /usr/share/mpv/scripts/mpris.so...
[ 0.011104] cplayer: Waiting for scripts...
greetings
Since mpv now has --enable-cplugins
by default, I decided to give this a try and it works perfectly with all MPRIS consumers around here that I tested. Thanks very much for this fine piece of software!
Can you please cut a release (don't care whether it's 0.1 or 1.0 or whatever) so that I can package this up for Arch Linux?
Error:
fatal error: gio/gio.h: No such file or directory
Full output:
cc mpris.c -o mpris.so -std=c99 -Wall -Wextra -O2 `pkg-config --cflags gio-2.0 gio-unix-2.0 glib-2.0 mpv` `pkg-config --libs gio-2.0 gio-unix-2.0 glib-2.0` -shared -fPIC
Package mpv was not found in the pkg-config search path.
Perhaps you should add the directory containing `mpv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'mpv' found
mpris.c:1:10: fatal error: gio/gio.h: No such file or directory
#include <gio/gio.h>
^~~~~~~~~~~
compilation terminated.
Makefile:11: recipe for target 'mpris.so' failed
make: *** [mpris.so] Error 1
Not sure what to do from here, any help is appreciated!
I have debian 11, installed Radio ++ applet, it asks to install mpv. So is it possible without mpv, because I don't want to play for the sake of radio
Currently, the artists fields are only split by ,
. This is unsuitable for files using Vorbis comments with multiple Artist tags, as mpv will concatenate them together using a semicolon as a delimiter, like so: Artist 1;Artist 2;Artist 3
.
Some MP3s may also use a slash as a delimiter, like so: Artist 1/Artist 2
.
As mpv-mpris only handles a comma with a trailing space as a delimiter, none of these are split and programs using MPRIS could treat this as one huge artist field.
Unfortunately from the looks of things, libmpv doesn't provide a method of returning this as an array, and there's the possibility that some artist fields will have multiple sequences (possible situation: Tyler, The Creator;Artist 2
) which will make this even more of a pain.
Perhaps different file types could have a delimiter priority.
To reproduce open anything in mpv with this plugin installed and run this command a couple of times
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.mpv /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Seek int64:-5
You'll see what I mean, it just seems to be stuck at one point and never go back past that.
Positive seek works as expected.
There is no artist info for youtube videos when calling playerctl metadata
. I can see artist info when I am using playerctl with Chromium-based browsers on youtube, but not in mpv.
Sometimes when seeking close to the beginning, the position returned by the Seeked signal returns a negative number.
This seems to happen much more often if it's seeked back to the beginning due to the file looping.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.