Necessary libraries to PlayMovie()

Linux specific forum
User avatar
Shardik
Addict
Addict
Posts: 2060
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: PlayMovie() LinkerError

Post by Shardik »

Both Huitbit's contest code and Vera's example code are showing the same weakness: they don't examine the return code of LoadMovie()
PB help for [url=http://www.purebasic.com/documentation/movie/loadmovie.html][color=#0040FF]LoadMovie()[/color][/url] wrote:Return value

Returns nonzero if the movie was loaded correctly and zero if loading the movie failed (format not supported or file not found). If #PB_Any was used for the #Movie parameter then the generated number is returned on success.
A closer inspection reveals that both examples fail at LoadMovie() because the Linux version of PB is seemingly not able to read in and initialize MPG or MID files correctly. Although the documentation states that music files like MID are not officially supported:
PB help for [url=http://www.purebasic.com/documentation/movie/index.html][color=#0040FF]Movie[/color][/url] wrote:Note: on some OS, music files can also played by this library but it is not officially supported and somewhat broken. Better use the sound library for this.
As a further proof I have written the following example code which loads a MPG or AVI file (always comment out one of them) from an internet address and checks every possible error condition. I have tested with PB 5.31 and PB 4.61 on Ubuntu 14.04 x64 with KDE and with PB 5.31 on Lubuntu 14.04 x86 with LXDE and in all cases it was not possible to load the movie successfully with LoadMovie() although in each test it was possible to view the movie using the distribution specific videoplayer by double clicking the movie in the respective file manager. The developer version of libxine (needed for video playback) was installed in both distributions. So it seems indeed that the movie functions in PB's Linux version are broken...

Code: Select all

#VideoURL = "http://home.arcor.de/frogspace/aliensg.mpg"
; #VideoURL = "http://www.onlinewahn.de/mentos.avi"

Define VideoFile.S = GetTemporaryDirectory() + "AlienSong.mpg"
; Define VideoFile.S = GetTemporaryDirectory() + "Mentos.avi"

If InitNetwork() = 0
  MessageRequester("Error", "InitNetwork() failed!")
Else
  If FileSize(VideoFile) <= 0
    If ReceiveHTTPFile(#VideoURL, VideoFile) = 0
      MessageRequester("Error", "Download of movie failed!")
    EndIf
  EndIf
  
  If InitMovie() = 0
    MessageRequester("Error", "InitMovie() failed!")
  Else
    If LoadMovie(0, VideoFile) = 0
      MessageRequester("Error", "LoadMovie() failed!")
    Else
      OpenWindow(0, 100, 100, MovieWidth(0), MovieHeight(0), "Movie")
      While WindowEvent() : Wend
      PlayMovie(0, WindowID(0))
      
      Repeat
      Until WaitWindowEvent() = #PB_Event_CloseWindow
    EndIf
  EndIf
EndIf
Last edited by Shardik on Thu Jan 01, 2015 12:07 pm, edited 1 time in total.
User avatar
Vera
Addict
Addict
Posts: 858
Joined: Tue Aug 11, 2009 1:56 pm
Location: Essen (Germany)

Re: PlayMovie() LinkerError

Post by Vera »

Thank you very much Shardik for taking such a close look at this issue :)

Would you please make it a bug report if you think it's appropriate, for I simply can't say anything about this and could only copy+paste your analysis.

I'm ok to live with the movie-feature being unavailable for me, but even your test doesn't run for me because I still emediately get those linker errors.

Now reading that
Better use the sound library for this.
I came across djes final contest-greeting with an example using sound.

Here too I get Linker Errors:
Sound.a(Sound.o): In function 'fill_audio' and again numberous 'undefined references to 'SDL_...'

Again I tried to find hints on the forum without success and also an older code (even assumed to be crossplatform) that should run, but of course returning the same error-messages.

What are these: Movie.a and Sound.a ?
Are those lib-files that I have to provide on my system or is it part of a PB-distribution? Is it something (reference/link) within another lib? ...

What would I have to do to get past these absolut hindrances?
Is it that it doesn't work for portable installations?


I have no clou what to do.

~ happy days to all ~ Vera ~ Image
User avatar
Shardik
Addict
Addict
Posts: 2060
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: PlayMovie() LinkerError

Post by Shardik »

Shardik wrote:So it seems indeed that the movie functions in PB's Linux version are broken...
Vera wrote:Would you please make it a bug report if you think it's appropriate, for I simply can't say anything about this and could only copy+paste your analysis.
Sorry for the premature statement that the movie functions seem to be broken. The movie functions are working fine but it took me many hours to find out which libraries are essential to install in order to successfully run PB's PlayMovie() command... :oops:

Until now I was not able to run my above code example (which I have modified a bit to detect if a movie has already been loaded during a previous run) on these distributions:
- Bodhi Linux 0.2 x86 with Pantheon
- Fedora 20 x86 with Gnome 3
- Kubuntu 10.04 x86 with KDE
- Kubuntu 14.04 x86 with KDE
- Linux Mint 17 x86 with Cinnamon
- Lubuntu 14.04 x86 with LXDE
- OpenSuSE 13.1 x86 with KDE
- Ubuntu 13.10 x86 with Unity
- Ubuntu 14.10 x86 with Unity
- PCLinuxOS MiniMe x86 with KDE
- Xubuntu 14.04 x86 with Xfce

Until now I have been successful with these distributions:
- OpenSuSE 12.3 x86
- Ubuntu 14.04 x64 with KDE

In general I first executed my above program to download one of the two movies. In no case in my tests of 13 Linux distributions did my program work on the first try although in all Debian based distributions libxine-dev was installed and checkinstall.sh reported that all is OK.

The next step was to start the movie downloaded to /tmp by double clicking it in the file manager of the tested distribution. In most cases the distribution specific video player reported missing libraries which had to be installed. After the installation of these libraries in most cases it was possible to play the movie with the distribution's video player so that all necessary codecs for video playback should have been installed.

Unfortunately there exist multiple possible alternative libraries to play a video so if a movie can be played back with the distribution's preinstalled video player that doesn't mean that all problems are solved. Therefore it's necessary to know which libraries PB is using for executing the LoadMovie() and PlayMovie() commands. If LoadMovie() doesn't report an error I was already one step further. I started my above program from the command line and tried to resolve the errors which were displayed.

Here are the needed libraries for the Linux distributions successfully running my above program with the MPEG and AVI videos (the libraries in brackets are dependancies of the first one and will be automatically installed). But keep in mind that unfortunately your requirements may be different depending on your graphics card! Both my two test computers utilized a different model of a Radeon graphics card...

OpenSuSE 12.3 x86 with KDE:
- Install packman repository and needed codecs for multimedia support from console:

Code: Select all

sudo zypper ar -f -n packman-essentials http://packman.inode.at/suse/openSUSE_12.3/Essentials packman-essentials
sudo zypper ar -f -n packman-multimedia http://packman.inode.at/suse/openSUSE_12.3/Multimedia packman-multimedia
sudo zypper install libxine2-codecs k3b-codecs ffmpeg lame gstreamer-0_10-plugins-bad gstreamer-0_10-plugins-ugly gstreamer-0_10-plugins-ugly-orig-addon gstreamer-0_10-plugins-ffmpeg libdvdcss2
- Install libvdpau_r600 (hardware specific library for hardware accelerated video rendering on my graphics card ATI Radeon HD 5670)

Ubuntu 14.04 x64 with KDE, Unity and Enlightenment E 17 (Graphics card: ATI Radeon HD 5670; libxine1-dev and dependancies didn't work correctly!) :
- libxine2-dev (libxine2-bin)
- libxine2-x (libva-glx1, libva-x11-1, libvdpau1)
- libxine2 (libaacs0, libblueray1, libxine2-ffmpeg, libxine2-misc-plugins, libxine2-plugins)
- mesa-vdpau-drivers

This list will be expanded as soon as I have found out the missing libraries for the other distributions!
Last edited by Shardik on Wed Jan 21, 2015 10:05 am, edited 3 times in total.
User avatar
heartbone
Addict
Addict
Posts: 1058
Joined: Fri Apr 12, 2013 1:55 pm
Location: just outside of Ferguson

Re: PlayMovie() LinkerError

Post by heartbone »

Good work Shardik.

No need to apologize here because your posted statement was correct.
If one installs PureBasic as instructed, then the functions are broken.
Keep it BASIC.
User avatar
Shardik
Addict
Addict
Posts: 2060
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: PlayMovie() LinkerError

Post by Shardik »

In order to play videos from PB these are the general steps to install missing libraries in Debian based distributions:
- Deinstall libxine-dev (if already installed; it's installation is proposed by PB's script checkinstall.sh)
- Install libxine2-dev
- Install libxine2-x
- Install libxine2
- Install mesa-vdpau-drivers
- Run my example program from above

With these libraries installed the following Linux distributions derived from Debian played successfully both the MPG and AVI video on PB 5.31 (the graphics card in my tests was a AMD/ATI RV620 LE / Radeon HD 3450 if not noted otherwise):
- Kubuntu 14.04 x86 with KDE
- Linux Mint 17 x86 with Cinnamon
- Lubuntu 14.04 x86 with LXDE
- Ubuntu 14.04 x86 with Unity
- Xubuntu 14.04 x86 with Xfce

These were the steps necessary to successfully play the videos on OpenSuSE 13.1 x86 with KDE:
- Install packman repository and needed codecs for multimedia support from console (for some packages an error occured and I was given several options because some libs were not available anymore in their original repository; I always chose the option to use a different provider):

Code: Select all

sudo zypper ar -f -n packman-essentials http://packman.inode.at/suse/openSUSE_13.1/Essentials packman-essentials
sudo zypper ar -f -n packman-multimedia http://packman.inode.at/suse/openSUSE_13.1/Multimedia packman-multimedia
sudo zypper install libxine2-codecs k3b-codecs ffmpeg lame gstreamer-0_10-plugins-bad gstreamer-0_10-plugins-ugly gstreamer-0_10-plugins-ugly-orig-addon gstreamer-0_10-plugins-ffmpeg libdvdcss2
- Install libvdpau_r600 (hardware specific library for hardware accelerated video rendering on my graphics card ATI Radeon HD 5670)

These are the distributions I finally gave up trying:

Lubuntu 14.04 x86 with LXDE (Graphics card: ATI RV370)
To identify my graphics card and its currrent driver I used this console command:
lspci -nnk | grep -i VGA -A2
This graphics card (a more recent one in another test PC worked without problems on Lubuntu 14.04!) seems to be way too old. At first there was no library "mesa-vdpau-drivers" available, so after installing the libraries libxine2-dev, libxine2-x and libxine2 when running my example program from console I got the following error message:
Failed to open VDPAU backend libvdpau_r300.so: cannot open shared object file: No such file or directory
So I tried to add a bleeding edge repository with most recent graphics drivers:
> sudo add-apt-repository ppa:oibaf/graphics-drivers
> sudo apt-get update
After this action I was able to install library "mesa-vdpau-drivers" and the above error message disappeared because now the missing library "libvdpau_r300.so" was indeed available. But I got the following new error message which unfortunately seems to indicate that my graphics card isn't capable to playback videos:
vo-vdpau: VideoSurface doesn't support yuy2, sorry
So I was finally stuck again...

Ubuntu 13.10 x86 with Unity
This distribution is simply too old. It isn't supported anymore since July 2014. It's always a bad idea to use a Ubuntu version without LTS support (currently 5 years). So you should update to Ubuntu 14.04 LTS which is supported until March 2019.
The problem with Ubuntu 13.10 is the missing library mesa-vdpau-drivers. Even adding the well-known packet repository (ppa) oibaf with the most up-to-date graphics drivers doesn't help. I even tried to copy the missing libraries libvdpau_r600.so and libLLVM-3.4.so.1 from my working Lubuntu system but I got finally stuck with an "Unresolved symbol in libvdpau_r600.so"...
Last edited by Shardik on Wed Jan 21, 2015 4:56 pm, edited 5 times in total.
User avatar
heartbone
Addict
Addict
Posts: 1058
Joined: Fri Apr 12, 2013 1:55 pm
Location: just outside of Ferguson

Re: PlayMovie() LinkerError

Post by heartbone »

Shardik wrote:These are the distributions I finally gave up trying:

Ubuntu 13.10 x86 with Unity
This distribution is simply too old. It isn't supported anymore since July 2014. It's always a bad idea to use a Ubuntu version without LTS support (currently 5 years). So you should update to Ubuntu 14.04 LTS which is supported until March 2019.
The problem with Ubuntu 13.10 is the missing library mesa-vdpau-drivers. Even adding the well-known packet repository (ppa) oibaf with the most up-to-date graphics drivers doesn't help. I even tried to copy the missing libraries libvdpau_r600.so and libLLVM-3.4.so.1 from my working Lubuntu system but I got finally stuck with an "Unresolved symbol in libvdpau_r600.so"...
That was my system.
Based on your research and recommendation, and following my philosoply of "If it ain't broke, don't fix it.", this morning I upgraded to 14.04.
Then I performed the uninstall of libxine-dev and installed the three new libraries.
Running your test program in PB 5.22 LTS on a x86 system I can now see the movies, however the program abends with [ERROR] Program aborted. (by external library) as the movie plays.
When testing it in PB 5.31 x86, or PB 5.22 x64, or PB5.31 x64 (MINT 17.1), the program fails before the movie even starts!
Shardik, do you know what the problem might be?
Keep it BASIC.
User avatar
Vera
Addict
Addict
Posts: 858
Joined: Tue Aug 11, 2009 1:56 pm
Location: Essen (Germany)

Re: PlayMovie() LinkerError

Post by Vera »

Hello Shardik,
w0w ~ your investigations and researches are incredible :-)

... and very likely quite valuable to many, so that I would adjust the thread title appropriately to ease its finding. Any suggestions are welcomed if you like.

Atm I'm still catching up with last weeks threads and will call back on you as soon as I've found your suggested lib (that I surely miss). By the impression of your results I'll likely have a pretty old and poor/slim libxine installation on this current system.

Greets ~ Vera
User avatar
Shardik
Addict
Addict
Posts: 2060
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: PlayMovie() LinkerError

Post by Shardik »

heartbone wrote:Based on your research and recommendation, and following my philosoply of "If it ain't broke, don't fix it.", this morning I upgraded to 14.04.
That's a wise decision because it will make your life easier at least until 2019... :wink:
heartbone wrote:Then I performed the uninstall of libxine-dev and installed the three new libraries.
Running your test program in PB 5.22 LTS on a x86 system I can now see the movies, however the program abends with [ERROR] Program aborted. (by external library) as the movie plays.
So you installed three new libraries. Did you also install the library "mesa-vdpau-drivers"? Without the drivers from this library your observed behaviour is typical...

You should also check whether the library "libvdpau1" is installed. VDPAU (Video Decode and Presentation API for Unix) and its drivers from "mesa-vdpau-drivers" are essential together with the different libxine2 libraries to display videos using PB commands.

In order to help you further you should follow these steps:
- Start my example program from the PB IDE (to download one of the two videos into your /tmp folder) and terminate it.
- Start my example program from the console using the PB compiler (please change the path to your PB installation folder and the path where you saved my example program together with its name):
> export PUREBASIC_HOME=/home/shardik/PureBasic/5.31
> export PATH=$PUREBASIC_HOME/compilers:$PATH
> pbcompiler /home/shardik/Download+PlayMovie.pb

Now you should see error messages in your console which you should post in this thread and then I can try to help you further... :wink:
User avatar
Shardik
Addict
Addict
Posts: 2060
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: PlayMovie() LinkerError

Post by Shardik »

Vera wrote:Hello Shardik,
w0w ~ your investigations and researches are incredible :-)
Thank you for your kind words... :)
Vera wrote:... and very likely quite valuable to many, so that I would adjust the thread title appropriately to ease its finding. Any suggestions are welcomed if you like.
I would propose something like "Necessary libraries to play videos".
Vera wrote:By the impression of your results I'll likely have a pretty old and poor/slim libxine installation on this current system.
I am very sorry but I think that it will be very difficult if you are still running PB 4.51 on OpenSuSE 11.1 x86 as you reported here. I would recommend to use a much more recent PB version and linux distribution...:wink:
I am even fighting with difficulties in distributions like Ubuntu 12.04 LTS and derivated distributions...
User avatar
heartbone
Addict
Addict
Posts: 1058
Joined: Fri Apr 12, 2013 1:55 pm
Location: just outside of Ferguson

Re: PlayMovie() LinkerError

Post by heartbone »

Shardik wrote:So you installed three new libraries. Did you also install the library "mesa-vdpau-drivers"? Without the drivers from this library your observed behaviour is typical...

You should also check whether the library "libvdpau1" is installed. VDPAU (Video Decode and Presentation API for Unix) and its drivers from "mesa-vdpau-drivers" are essential together with the different libxine2 libraries to display videos using PB commands.

In order to help you further you should follow these steps:
- Start my example program from the PB IDE (to download one of the two videos into your /tmp folder) and terminate it.
- Start my example program from the console using the PB compiler (please change the path to your PB installation folder and the path where you saved my example program together with its name):
> export PUREBASIC_HOME=/home/shardik/PureBasic/5.31
> export PATH=$PUREBASIC_HOME/compilers:$PATH
> pbcompiler /home/shardik/Download+PlayMovie.pb

Now you should see error messages in your console which you should post in this thread and then I can try to help you further... :wink:
That was an embarrASSing public brain fart. :oops:
After I installed the "mesa-vdpau-drivers" library, the movie playback started working!
Thanks for your expert diagnosis Shardik, it is much appreciated.
Keep it BASIC.
User avatar
Shardik
Addict
Addict
Posts: 2060
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: PlayMovie() LinkerError

Post by Shardik »

heartbone wrote:After I installed the "mesa-vdpau-drivers" library, the movie playback started working!
I am glad it's now working for you... :)
User avatar
Vera
Addict
Addict
Posts: 858
Joined: Tue Aug 11, 2009 1:56 pm
Location: Essen (Germany)

Re: PlayMovie() LinkerError

Post by Vera »

Shardik wrote:I am very sorry but I think that it will be very difficult if you are still running PB 4.51 on OpenSuSE 11.1 x86
I'm about to return to my now repaired PC and than doing that big step to PB 5.31, but trying to stick with Suse 11.2 if possible.

But to give some feedback.
Your updated test-code now also downloads the files for me. :D
Doing some researches it looked to me as if the libvdpau_r600 came with Suse 12 and dared not to install it. Checking xine again, I found the devel-packages were missing and installed those.
And that was successful in the way that the linker errors don't apear anymore and your code now fully runs for me. With mpg LoadMovie fails, but avi is loaded ... only it wouldn't play and just display an artefact picture.

But playing sound via Movie does work now ;-) ... and with that a further punching-contribution.

Hoping to be likewise successfull with PlaySound I installed all missing SDL-dev packages, but that didn't work out.

And while looking for further hints I crossed another thread where you already helped uwekel to figure out which libraries would be needed on Fedora 19 to PlayMovie which is worth redarding:
- Movie example does not work on Linux

Thanks for your proposal - I merged it with mine.

and congrats to Mr heartbone :D

cheers ~ Vera
John Duchek
User
User
Posts: 83
Joined: Mon May 16, 2005 4:19 pm
Location: St. Louis, MO

Re: Necessary libraries to PlayMovie()

Post by John Duchek »

This stream addresses long standing problems I have seen with pure under linux. I am running Fedora 21 64 bit. As I read through here I am trying to install various codecs and programs to get linux to play video properly. As I do, I am noting a few things. On installing the gstreamer codecs in fedora, they are separated into 'free' and non-free versions. The free versions are usually in the normal repository, but the non-free versions are in the rpmfusion-nonfree repository. If one hasn't installed the rpmfusion repositories, they are unavailable, and of course not installed. I am working on getting them all installed now.
Thanks,
John
John R. Duchek
St. Louis,MO
emm
New User
New User
Posts: 7
Joined: Tue Oct 18, 2022 7:47 pm

Re: Necessary libraries to PlayMovie()

Post by emm »

Hi

It's an old thread but as the issue experienced maybe related I post here.

GOAL: I try to play a mp4 video stored online

Environment:

I use ubuntu 22.04 on a 64 bit intel CPU on a PC. All videos play well on VLC and online.

I don't know how to install codecs on linux.
I searched online but found many 'solutions' which don't provide a way to test if they work as using VLC use its own codecs if I understand well.

I use PB 6.02 LTS free edition using this code:

Code: Select all

InitMovie()

file$ = "/home/manu/Downloads/1.mp4"

 -> *** If LoadMovie(0, file$)
  OpenWindow(0, #PB_Ignore, #PB_Ignore, MovieWidth(0), MovieHeight(0), "movietest")
  PlayMovie(0, WindowID(0))
  While MovieStatus(0) <= 0
    Delay(10)
  Wend
  Repeat
    Select WaitWindowEvent(100)
      Case #PB_Event_CloseWindow
        Break
      Case 0
        If Not MovieStatus(0)
          Break
        EndIf
    EndSelect  
  ForEver
EndIf
I traced the code and see it exits at the -> *** part.

I can play the file with VLC and the permission enable reading for the user running PB so I assume the loadMovie function exits due to not supporting the format.
The format is:

Image

I tried with avi file and mpeg file too and same issue.

The documentation of PB don't tell anything about Linux:
https://www.purebasic.com/documentation ... index.html

Image

Questions:

1- How could I list all the codecs installed on this linux version?
2- How to list all codecs supported by PB 6.02 LTS via code?
3- How to get more info from LoadMovie about the failure?

Thanks
User avatar
mk-soft
Always Here
Always Here
Posts: 6246
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Necessary libraries to PlayMovie()

Post by mk-soft »

Possibly a package or app is still missing

Simple Install of Purebasic ...
* Movie / Ubuntu
sudo apt install xine*

* Movie / Raspberry PI Desktop
sudo apt-get install libvlc-dev
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply