Necessary libraries to PlayMovie()

Linux specific forum
User avatar
Vera
Addict
Addict
Posts: 858
Joined: Tue Aug 11, 2009 1:56 pm
Location: Essen (Germany)

Necessary libraries to PlayMovie()

Post by Vera »

Hello,

due to the PunchingContest I again experience that I can't use PB's movie feature as I get half a page of linker errors starting with 'Movie.a(InitializeMovie.o): In function PB_FreeMovies' and many undefined references to 'xine_...'.

I have similar issues with the webgadget and some drawing routines where I can solve it by importing certain libs directly. But I have no idea what I'd need to do to make the movie feature start running at all.

Yes - I searched the forum for hints, but I didn't cross any.

Any suggestions what I could try are welcomed :-)

greets ~ Vera

***
edit: adjusted the title to reflect the enhanced library research by Shardik, you'll find below.
Last edited by Vera on Sun Jan 04, 2015 3:26 pm, edited 2 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 »

Post some code that triggers the problem.
I should have some substitute media of the correct format.

Post 500. :mrgreen:
I see that my forum classification didn't change to something like Hopeless Nerd. ;)
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 »

heartbone wrote:Post some code that triggers the problem.
You could take Huitbit's contest code
or the more easy example I came across on my research:

Code: Select all

Enumeration
  #WinMovie
  #BtnMoviePlay
  #BtnMoviePause
  #BtnMovieResume
  #BtnMovieExit
EndEnumeration

#Movie = 100

Global igInitMovieOK = InitMovie()

Procedure MovieWin()
  ;------------------

 ; sMovie.s = "D:\PROJECTS\ProfLangTranslate.flv" ;<-- your movie here
  sMovie.s = "/home/user/place/PB_Debugger.avi" 
  
  ; file:///home/webuser/inetz/PB_Debugger.avi
  
  If (igInitMovieOK > 0)

    If OpenWindow(#WinMovie, 0, 0, 830, 593, "Play Movie", #PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_TitleBar)

      ButtonGadget(#BtnMoviePlay,   255, 564,  80,  24, "Play")
      ButtonGadget(#BtnMoviePause,  335, 564,  80,  24, "Pause")
      ButtonGadget(#BtnMovieResume, 415, 564,  80,  24, "Resume")
      ButtonGadget(#BtnMovieExit,   495, 564,  80,  24, "Exit")

      LoadMovie(#Movie, sMovie)
      PlayMovie(#Movie, WindowID(#WinMovie))
      PauseMovie(#Movie)
    EndIf

  EndIf

EndProcedure

Procedure RunMovie()
  ;-------------------
  iEventMovie.i = 0

  If (igInitMovieOK > 0)

    Repeat
      iEventMovie = WaitWindowEvent(1) ; Wait until an event is received

      Select EventGadget()

        Case #BtnMoviePlay: PlayMovie(#Movie, WindowID(#WinMovie))
        Case #BtnMoviePause: PauseMovie(#Movie)
        Case #BtnMovieResume: ResumeMovie(#Movie)
        Case #BtnMovieExit: iEventMovie = #PB_Event_CloseWindow

      EndSelect

    Until iEventMovie = #PB_Event_CloseWindow

    CloseWindow(#WinMovie)

  EndIf

EndProcedure

MovieWin()
RunMovie()
End
congrats dear heartbone

Image Image Image ... Image
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 »

What I can do is verify that there is indeed a problem with the PlayMovie() function.
UBUNTU 13.10 x86
Running in PB 5.31, both your example and Huitbit's give an INVALID MEMORY ACCESS error when executed.
Same thing in PB 5.22.
Same thing with a .mpg file.
Apparently this bug has been around for a while.
How to fix it?
I do not know.
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 »

Thanks :-)
well Huitbit writes to only run his code as executable because of a sound-play issue.

But my problem occures already much earlier, as the compiler can't find the needed lib [which is what I assume atm]. I cannot even test the second example, as it simply stops compiling when the lib isn't found.

I also searched for a 'Movie.a' file, but there's none.
It cannot be that the movie-feature never ran on Linux - there should have been some threads about it ever since.

Hope someone can tell me what special setting and/or which initial lib is needed to be imported to get a chance in the first place.
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 »

Vera wrote:It cannot be that the movie-feature never ran on Linux - there should have been some threads about it ever since.
I'm not so sure about that.
Considering how badly they broke the 5.3x version of the Linux compiler (compared to the 5.2x versions), and other than my posts there has been nary a peep out of anyone, and not a single fix has been forthcoming since the crap release, I'm thinking that the Linux compiler remains unused by most, due to it being broken.
I expect Linux bug fixes to be measured in years.
Keep it BASIC.
User avatar
Shardik
Addict
Addict
Posts: 2058
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: 2058
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: 2058
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: 2058
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: 2058
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...
Post Reply