Gadgetguy
Posts: 100
Joined: Fri Aug 15, 2014 2:55 am

Nearly nirvana mpv and smplayer but can use a little help

Tue Jul 05, 2016 7:30 am

Surprisingly considering it's many virtues as a media player I do not see much discussion on these forums concerning mpv .

https://mpv.io/ .

Mpv now supports hardware accelerated high def video decoding on the raspberry pi using mmal (Multi-Media Abstraction Layer) and it will decode just about any audio or video codec and format using the ffmpeg platform to which it is linked.:

https://ffmpeg.org/

Moreover if ffmpeg is compiled with openssl, and gnutls flags and lua support then mpv player will support youtube-dl. This means if mpv is run through the smplayer gui that you can simply drag and drop the video link from over 600 supported sites (including youtube and many other html embedded videos) into smplayer's interface and it will play.

A while ago I posted a rather long, perhaps confusing and tedious missive to these forums concerning mpv integrated with smplayer a media player gui that can use either mplayer or mpv ( or other video players) as its engine:

viewtopic.php?f=66&t=148185&p=975000&hilit=mpv#p975000

Since that post I have succeeded in compiling and creating a deb installation file for the most recent version of ffmpeg which mpv uses to decode audio and video.( Unfortunatlely ffmpeg is not in the raspbian repositories and neither is a recent version of mpv that supports hardware acceleration but there are precompiled debs available which do)
Following instructions I have also been able to build and install the most recent versions of mpv and smplayer. . I can now drag and drop high def video links from the internet into smplayer or onto the mpv desktop icon I created and have them play(if supported by youtube-dl). I have also been able to get smplayer to output hardware accelerated high definition video either full screen or by using a hack to toggle back and forth between fullscreen and a small pseudo window of a predetermined size that I can position to a place of my choosing on the display screen unobtrusive to a work environment so as to enable multi-tasking..More on this later in this post

In my original post I was missing OSD and subtitles on mpv ( and therefore on smplayer) That was because I installed mpv before installing libass.. The necessary libass was not in the raspbian repository but it can be compiled and/or a precompiled deb is also available. After installing libass followed by mpv I now have osd on mpv and smplayer ( progress bar, timing info subtitles etc)
Fot the lazy among us (i'm in that category) there are precompiled debs available for ffmpeg, libass, and mpv and smplayer that will work on raspbian. which I have referred to in my original post. Also see :

https://awesome.nwgat.ninja/deb

However the precompiled ffmpeg deb linked above was compiled without the openssl , and gnutls flags and therefore will not enable ytdl support on mpv. If you want the full youtube-dl support I believe you will have to compile, build and install your own ffmpeg .-see my experience building ffmpeg below.
But if you are intimidated by building your own ffmpeg deb or just want to use the precompiled ffmpeg linked to above it will somewhat work because smplayer still has its own internal youtube support so youtube will still be enabled, but not all the other sites supported by youtube-dl unless you build it yourself. ( It should be noted youtube support must be kept up to date on smplayer which only takes seconds via smplayer's drop down help menu.) Again a recent version of smplayer that supports youtube-dl is not in the raspbian repository but a precompiled deb can be found here:

http://ubuntu-mate.community/t/tutorial ... pport/3888

However again it is better and not hard to create your own smplayer deb so as to enable installing the most recent version, by following the easy install instructions contained in the install text of the source file which can be downloaded here:

http://downloads.sourceforge.net/smplay ... .0.tar.bz2

While you are at it you might also wish to obtain and build a deb for smtube -smplayer's integrateda youtube browser- smtube -which can also run independent of smplayer -using the same procedure.: See :http://www.smtube.org/ It is a very quick uncluttered way of browsing and viewing youtube and can utilize a variety of video engines in addition to smplayer. Someone in the smplayer forum mentioned they were able to use G.Kreidl's omxplayergui as the engine for smtube browser. Omxplayer gui is nice because among it's other virtues it is both draggable and resizable. The version of smtube in the raspbian repository is old and no longer works.

The next few paragraphs mayor may not be of help to those who wish to have youtube-dl support by compiling and building their own deb for ffmpeg and also build and install their own linked mpv with youtube-dl support enabled. Others may wish to skip ahead.

If you decide to install or compile your own ffmpeg libass and mpv useful information can be found on these pages:

https://nwgat.ninja/compiling-mpv-with- ... -3-zero-2/

https://nwgat.ninja/installing-mpv-with ... -2-3-zero/

(Remember ffmpeg and libass have to be installed in that order before building and/or installing mpv.)
I had to modify these instructions to build a deb for ffmpeg so that mpv that would enable ytdl support. Also, if you wish to build ffmpeg and mpv it is necessary to preinstall certain dependencies.


As per https://nwgat.ninja/installing-mpv-with ... -2-3-zero/

Install dependencies
sudo apt-get install libxv1 libxcb-xfixes0 libsdl1.2debian libenca0 libxcb-render0 libwayland-client0 libwayland-cursor0 libwayland-egl1-mesa libxkbcommon0 libxinerama1 libxrandr2 libxss1 libgl1-mesa-glx fontconfig-config fonts-dejavu-core libaacs0 libass5 libbluray1 libbs2b0 libcdio-cdda1 libcdio-paranoia1



As per https://nwgat.ninja/compiling-mpv-with- ... -3-zero-2/



Install build tools
sudo apt-get install -y gperf bison flex build-essentials autoconf automake make makeinfo texinfo help2man libtool libtool-bin ncurses-dev git yasm mercurial cmake cmake-curses-gui



Note I had to change the above to build-essential (without the s and delete makeinfo to successfully compile so that it should read:


Install build tools
sudo apt-get install -y gperf bison flex build-essential autoconf automake make texinfo help2man libtool libtool-bin ncurses-dev git yasm mercurial cmake cmake-curses-gui checkinstall


I then got the latest source for ffmpeg and modified the compile script for ffmpeg as follows:




./configure --enable-gpl -enable-mmal -enable-openssl -enable-gnutls && make -j4
sudo checkinstall

Some suggestions for compiling ffmpeg that worked for me as a linux illiterate was to extract source from latest ffmpeg tarball then using nautilus file manager via properties make the following files executable:makefile, configure and version.sh . Likewise when compiling mpv I again used nautilus to make bootstrap.py executable.

Some of the dependencies I had to (or thought I had to)install to get mpv to build successfully and install are listed below (via my synaptic history) :


Installed the following packages:
libxkbcommon-dev (0.4.3-2)


Installed the following packages:
libgles1-mesa-dev (11.1.0-1+rpi1)
libgles2-mesa-dev (11.1.0-1+rpi1)

Installed the following packages:
libegl1-mesa-drivers (11.1.0-1+rpi1)


Installed the following packages:
gnutls-bin (3.3.8-6+deb8u3)
libcurl4-gnutls-dev (7.38.0-4+deb8u3)
libssh-dev (0.6.3-4+deb8u2)
libssl-dev (1.0.1t-1+deb8u2)
libssl-doc (1.0.1t-1+deb8u2)


Installed the following packages:
libbluray-dev (1:0.6.2-1)
libluajit-5.1-2 (2.0.3+dfsg-3)
libluajit-5.1-dev (2.0.3+dfsg-3)
libpthread-stubs0-dev (0.3-4)
libxau-dev (1:1.0.8-1)
libxcb-xkb-dev (1.10-3)
libxcb-xkb1 (1.10-3)
libxcb1-dev (1.10-3)
libxdmcp-dev (1:1.1.1-1)
libxkbcommon-x11-0 (0.4.3-2)
libxkbcommon-x11-dev (0.4.3-2)
x11proto-core-dev (7.0.26-1)
xorg-sgml-doctools (1:1.11-1)
libxv-dev
libsdl1.2-dev
libsdl1.2
openssl



So now assuming you got ffmpeg, libass ,and mpv successfully built and installed
you will first want to configure mpv. Mpv's local configuration file is located at:
/home/pi/.config/mpv/mpv.conf

Incredibly detailed configuration options covering every conceivable combination and permutation can be found here:
https://mpv.io/manual/stable/

Looking at this page it is obvious that this can be be mind boggling complex but needn.'t be

To acheive a well functioning mpv I would say the bare minimum and also probably quite sufficient “mpv.conf” file to have is to have the following entry:
vo=rpi:background=yes
ytdl-format=best

The entry “background=yes” instructs mpv to paint a black background on the sides if a standard definition video does not take up the full width of the screen as this is more aesthetically pleasing and less distracting and “ ytdl-format=best” instructs mpv to play the best quality video returned by youtube-dl. ( I believe it is the default but i think i read somewhere that it may be best to make it explicit in the configuration file).
My mpv.conf file currently reads:
vo=rpi:background=yes
ytdl-format=best
geometry=18%+1100+500

The configuration entry “geometry=18%+1100+500 “ mpv is my personal hack and instructs mpv to play the video output at 18% of the screen size and place it 1100 pixels from the right and down 500 pixels. On my television screen with a native resolution of 1360x768 this places a small but crystal clear video ( rendered as overlay rather than window) just up from the bottom right hand corner where it can be monitored and listened to without interfering too much with the rest of the screen and then toggled back and forth to fullscreen by using the keyboard command “ f ” . Obviously this hack could be varied to suit personal preferences. Another hack I experimented with was to instead put the following entry into the configuration file “ autofit=1% “ which allows you to toggle back and forth between fullscreen and a miniscule nearly invisible dot but still retain audio playback. Various configurations options using autofit and geometry are described in mpv's online manual referenced above. I fid it incredibly confusing. I would be very interested in hearing from other users of mpv what other options might be available for viewing mpvs video output in non full screen configurations.

Using mpv with the smplayer gui brings a number of advantages perhaps most noteworthy is the ability to drag and drop web video links to the smplayer interface and have them play, and easy configuration and control.
My suggested configuration for smplayer is under the general tab you must specify mpv as the media player and show the path to its executable if not already specified ie. /usr/bin/mpv.
For video output select rpi and for audio alsa for performance threads 4 and auto for hardware decoding. On the most recent versions of smplayer under the network tab select auto for support for video sites. Under the advanced tab select run smplayer in its own window and under options I have specified --geometry=18%+1100+500 This option would of course vary depending on the individuals preference and the resolution of their monitor. I like it because it allows me toggle back and forth between full screen and a small unobtrusive pseudo window when i wish to multitask. It would be ideal if one could configure mpv and smplayer so that mpv would output its mmal overlay video into smplayers window so as to be dragable and resizable . Mpv has windowed options but i don't think they work with mmal decode. Some discussion of the complexeities involved can be found here:

https://github.com/mpv-player/mpv/issues/2532

and here

: https://github.com/mpv-player/mpv/pull/2723.

G. Kreidl's omxplayergui through some kind of ingenious wizadry managed to put omxplayers overlay output into a resizable dragable pseudo window so perhaps there is hope for mpv on the pi. One drawback of selecting run mpv in its own window in smplayers options is that you no longer get the black background on videos that don't cover the width of the screen. I couldn't figure out a way to achieve this .You can deselect run mpv in its own window and remove the hack from mpv options in which case smplayer will run full screen.If you use this option you will have to remeber certain keyboard commands to stop the video and otherwise control playback. It should be noted that tsmplayers preferences alow you to add and change keyboard commands. It should also be noted that youtube-dl must be installed and updated regularly. Minimal kiosk browser(Kweb) has a built in utility for easy install and update of youtube-dl.

hyx
Posts: 8
Joined: Tue Jul 12, 2016 4:27 am
Location: PRC

Re: Nearly nirvana mpv and smplayer but can use a little hel

Tue Jul 12, 2016 5:02 am

Hello!
Your post is really helpful, and I have successfully complied mpv on my rpi3. But I come across a problem.

Code: Select all

mpv: symbol lookup error: mpv: undefined symbol: ass_set_check_readorder
This occurs when I try to play a video which has embedded ass subtitles.
Could you help me check it out? :?:
Poor English, perhaps.
Using RPi3.

Gadgetguy
Posts: 100
Joined: Fri Aug 15, 2014 2:55 am

Re: Nearly nirvana mpv and smplayer but can use a little hel

Wed Jul 13, 2016 3:47 pm

Thanks for the feedback. I hope like myself , you have found mpv to be a great video player for the raspberry pi. I would like to see more raspberry pi users discover its many virtues so that there will be more support within the raspberry pi community to resolve issues and optimize and/or enhance features. Have you also run mpv with the smplayer gui for easier more intuitive control and additional features such as dragging and dropping internet video links into its interface for automatic play
With regard to your particular problem I have a few questions to ask and some suggestions that may help you. Firstly I should note that I haven't used the support for subtitles feature very much so far but on my version of mpv ( and smplayer) subtitles seem to render and play without problem. Is it just a particular video file or subtitle type that is giving you this problem or is it all videos with subtitles? Does the file not play at all or just fail to render the subtitles properly? I assume you installed libass before building mpv because that is necessary in order to have subtitle and osd support. As I recall I was having trouble compiling libass because of the fribidi error. see:

https://www.google.ca/search?q=libass+f ... mAHNhLXwAg

so I took the easy route and installed the precompiled libass_0.13.2-1_armhf.deb file found here:

https://awesome.nwgat.ninja/deb/

which worked fine on my raspbian. The following libass related files were shown as installed in my synaptic package manager before I built mpv: libass 13.2-1, libass-dev 13.2-1, libass5 13.2-1. and I think I installed libassuan0 for good measure( prob not necessary)

If you didn't install libass beforehand you would have to rebuild mpv which didn't take all that long on my pi 2 ( it was compiling and building ffmpeg that was more difficult and time consuming and even that was not all that bad)

Assuming you had installed libass before building mpv then it would be a good idea to check and see if you have installed chardet ( Universal Character Encoding Detector)

google : uchardet support mpv and see:

https://github.com/mpv-player/mpv/issues/908

and also enca ( Extremely Naive Charset Analyser)

You can check and see if your build of mpv was configured with libass, chardet, and enca support enabled by opening your mpv config.log found at : /home/pi/mpv-mpv:0.18.0/build/config.log and searching therein for the terms libass, uchardet and enca.
Note in my succesful build of mpv I had installed libenca and libenca-dev. You might wish to check your synaptic package manager to see if these are installed. Likewise
with chardet-my synaptic showed libuchardet, libuchardet-dev python chardet and python 3 chardet as all having been installed.

Another package you may wish to have installed for complete subtitle support before building mpv is harfbuzz ie libharfbuzz-dev.

Remember google is your friend- when checking your error code via google one can see that others have encountered your problem. However unless it is an idiosyncratic file I think your problem may be resolved by following up on some of the suggestions i have made.


I am curious did you build ffmpeg and mpv with youtube-dl support? Have you tried dragging and dropping internet video links into smplayer interface or onto the mpv desktop icon for automatic play and what was your experiece. I will shortly make another post to describe some of the tricks I have learned to make viewing internet video on mpv and smplayer a better experience.

hyx
Posts: 8
Joined: Tue Jul 12, 2016 4:27 am
Location: PRC

Re: Nearly nirvana mpv and smplayer but can use a little hel

Fri Jul 15, 2016 2:13 pm

Thanks first.
Actually I did exactly what you post. After I met the problem, I found a same issue on github. I'm pretty sure that I installed the libass first, and the video was able to play on mpv on windows. I wonder whether I need a fresh raspbian to try again. It seem what I did before make the systerm unsuitable to compile the program.
By the way, there is one more problem.When I got an error message in the terminal, though the input line appears, I lose the control of it. This become a big problem when I don't use the GUI--I can't even reboot my rpi with ctrl+alt+del!
At last, I want to say--mpv is really a good player,probably the best.
Poor English, perhaps.
Using RPi3.

hyx
Posts: 8
Joined: Tue Jul 12, 2016 4:27 am
Location: PRC

Re: Nearly nirvana mpv and smplayer but can use a little hel

Fri Jul 15, 2016 2:29 pm

more info
I didn't build ffmpeg with youtube-dl because it's useless if I can't visit youtube... I tried other video sites but just not work,then I throw it away. Maybe I should install the packages you mentioned in your last post. I 'll try again later,since I'm working on psptoolchain on rpi.
I wish I can use google just as you do ...
Poor English, perhaps.
Using RPi3.

Gadgetguy
Posts: 100
Joined: Fri Aug 15, 2014 2:55 am

Re: Nearly nirvana mpv and smplayer but can use a little hel

Fri Jul 15, 2016 3:25 pm

Just a quick note for now. Firstly I should point out that my first reply to your post contained an error that made it confusing to read, which i have now corrected. The relevant portion which might be really useful to you in checking if your mpv player was built with libass and character support for subtitles now reads:

You can check and see if your build of mpv was configured with libass, chardet, and enca support enabled by opening your mpv config.log

found at : /home/pi/mpv-mpv:0.18.0/build/config.log

and searching therein for the terms libass, uchardet and enca.


Yes ,one very occasional problem with mpv video player and omxplayer is that they both display full screen overlay video output and therefore depend on an active terminal window to retain keyboard control. I have noted for example that if you do a right click of your mouse while video is playing full screen “ focus “ will sometimes be lost on your terminal window. Your terminal window can frequently be made active again by presing the keyboard combination alt + tab till focus is regained or possibly try control + c.

I have to confess I am nearly a linux illiterate and am somewhat proud of myself in getting mpv and mpv/smplayer working so well together. If I can do it most readers of this forum should probably have no big problems in doing so either.
Yes mpv is a particulary useful player to have available on the raspberry pi, made even more so by its support for youtube and yoube-dl. It will also play many codecs that omxplayer won't, at least the stock omxplayer available in the raspbian repositories. Perhaps if omxplayer is built from source using the compiled version of ffmpeg than support for additional codecs would be obtained( I am just wondering). An idea of what capable video players mpv and mpv/smplayer and its codec support can be found by playing some of the video samples found on sites such as :


http://www.w6rz.net/

or

http://www.elecard.com/en/download/videos.html

or

http://kodi.wiki/view/Samples

hyx
Posts: 8
Joined: Tue Jul 12, 2016 4:27 am
Location: PRC

Re: Nearly nirvana mpv and smplayer but can use a little hel

Sat Jul 16, 2016 1:29 am

I think you may misunderstand what I posted. I do know I can get control by using ctrl+tabs. The fact is that I could't type in any thing except ctrl+c when mpv exit with an error. In X server it's a small problem--I can click the button to terminate the terminal. But in the command line(I mean init 3), I have to reboot my rpi with ctrl+alt+del. Sometimes it won't work.
Today I'll give a try. If the issues gone, I assume it's my systerm's fault :)
Poor English, perhaps.
Using RPi3.

hyx
Posts: 8
Joined: Tue Jul 12, 2016 4:27 am
Location: PRC

Today's test

Sat Jul 16, 2016 1:19 pm

On a fresh raspbian
I tried to fix the fribidi error by installing libfribidi-dev and lib libfribidi-bin. After that, I compiled the libass. But in this way, the ass subs don't work well - same as I posted. So I install the pre-compiled package. BUT IT STILL NOT WORK - even though I add "--enable-libass". The config.log shows libass is included.

It isn't fixed by installing libenca-dev and libuchardet-dev. :(

I give up and try to install all the pre-compiled package.
then I become mad on the test :x

Code: Select all

[sub] Could not  find subtitle decoder for format ‘ass’
It seems I have to wait a long time to have someone fix the problem

Thanks anyway.
Poor English, perhaps.
Using RPi3.

hyx
Posts: 8
Joined: Tue Jul 12, 2016 4:27 am
Location: PRC

Re: Nearly nirvana mpv and smplayer but can use a little hel

Sat Jul 16, 2016 1:49 pm

maybe I should try it on ubuntu mate,since I successfully build the psptoolchain on it instead of raspbian...
:?
Poor English, perhaps.
Using RPi3.

cjan
Posts: 737
Joined: Sun May 06, 2012 12:00 am

Re: Nearly nirvana mpv and smplayer but can use a little hel

Thu Nov 24, 2016 5:48 am

same here
mpv: symbol lookup error: mpv: undefined symbol: ass_set_check_readorder

install from OP's repos, ffmpeg_3.0.3-1 & libass_0.13.3-1 & mpv_0.20.0-1
btw, v_out x11 instead of rpi can play window-mode.

Return to “General discussion”