How to develop a video audio player ?

Just starting out? Need help? Post your questions and find answers here.
spataro
New User
New User
Posts: 6
Joined: Wed Apr 18, 2012 6:48 pm

How to develop a video audio player ?

Post by spataro »

I'm a newbie in purebasic, sorry if it is a stupid question.

I'm developing a simple application to download some videos and / or audio files from the web.

The idea is to receive a list of videos, download and play even offline.

I was making some test with Movie example file: it supports mpg - mp3 files.

I have mp4 files (should be mpg) and mp3. I renamed the mp4 in mpg but the movie example gives me the error of unsupported video format. In the forum I've found mp4 is supported, but perhaps with other libraries.

I've alse modified the MiniBrowser example to surf an url with the mp4 files, but it opens in movie media player, not inside the browser (I use win 7-64). Is it why I'm still using the demo version of Purebasic ?

I didn't find a little tutorial to understand better how can I manage videos. So any help is appreciated :) And thanks for this great project and community.

Valentino
User avatar
em_uk
Enthusiast
Enthusiast
Posts: 366
Joined: Sun Aug 08, 2010 3:32 pm
Location: Manchester UK

Re: How to develop a video audio player ?

Post by em_uk »

----

R Tape loading error, 0:1
spataro
New User
New User
Posts: 6
Joined: Wed Apr 18, 2012 6:48 pm

Re: How to develop a video audio player ?

Post by spataro »

No, something easier. A simple object inside a window with a player

Thanks
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: How to develop a video audio player ?

Post by Zach »

If I recall correctly the Movie library uses DirectShow (on Windows), and as such you need to have the proper codecs and splitters installed first, to be able to play anything beyond basic DVD/MPEG stuff.

MP4 uses h264 video and AAC audio (usually).

A codec pack like CCCP (Combined Community Codec Project) will sort most of this out for you.
spataro
New User
New User
Posts: 6
Joined: Wed Apr 18, 2012 6:48 pm

Re: How to develop a video audio player ?

Post by spataro »

Zach wrote:A codec pack like CCCP (Combined Community Codec Project) will sort most of this out for you.
thanks for your answer.

I've checked the property of my video file: it's mpeg-4 mp4v and mpeg aac audio (mp4a)

Perhaps I'm missing something: I have the codec on my desktop, why should I install a cccp (perhaps I don't understand how to use it) ?

I was thinking that i need simply to code something in purebasic, as in the movie example:

MovieName$ = OpenFileRequester("Choose the movie to play", "", "Movie/Audio files|*.avi;*.mpg;*.asf;*.mp3;*.wav|All Files|*.*", 0)
If MovieName$
If LoadMovie(0, MovieName$)
OpenWindow(0, 100, 150, MovieWidth(0), MovieHeight(0), "PureBasic - Movie")
PlayMovie(0, WindowID(0))
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
Else
MessageRequester("Error", "Can't load the movie...", 0)
EndIf
EndIf

It works with mp3 and wav files; it supports wmv but if i move the window across the desktop the video (inside the purebasic's window) stay fixed on the desktop (!) without following the purebasic window, if I move it.

I've read on the forum that movie support is not the best solution.

So: I don't think it's a problem of codec. I see the videos.

My question is: what limits (solutions) has pure basic (win/mac) if i want to play a video inside a purebasic's window ?

Thanks
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: How to develop a video audio player ?

Post by Zach »

I really can't offer much help, if you are indeed able to see the video and hear audio already.

I kind of tried going down this path with a utility I wanted to write, for Inverse Telecining Anime, but its too complicated for my feeble mind to bother with.

Basically you want to write a DirectShow wrapper. Forum member, Inc, wrote a Dshow wrapper and Rashad has also done some work on it trying to help me get what I wanted.

I can't find the threads at the moment, but if you do a forum search for terms like "Directshow", you might get a hit.. if not I'll try and have links to relevant threads for you tomorrow.

If you are comfortable with pointers, DIB's and all that stuff.. Dshow probably won't be a huge problem for you to learn to use.

Another forum member also has written a Media Player with Purebasic, but I don't recall who it is.. I believe it is called "Greenforce Player". You could try getting in touch with him for advice.


Naturally, DirectShow is a windows only solution. I have no idea what PB can do on Macs.. Sorry I couldn't be of more help, I'm pretty much an amateur when it comes to these things, but I will try to get those links for you by tomorrow evening. Inc did a lot of great work with his wrapper, and RASHAD also did some nice modifications that might be relevant to your work.
rrpl
Enthusiast
Enthusiast
Posts: 121
Joined: Fri Apr 18, 2008 7:22 am
Location: Australia

Re: How to develop a video audio player ?

Post by rrpl »

spataro wrote: I'm developing a simple application to download some videos and / or audio files from the web.
I can confirm same result as you, the *.mp4 's don't load for some reason. Yet I have the correct codec loaded for DirectShow (on Windows). Other programs using Directshow load mp4's OK, but PB for some strange reason does not load the movie. Is this a bug? Purebasic help says "as it uses the DirectX 7 technology (DirectShow), any kind of media can be played with this library: AVI, MPG, DivX, Mp3 etc."
spataro wrote: It works with mp3 and wav files; it supports wmv but if i move the window across the desktop the video (inside the purebasic's window) stay fixed on the desktop (!) without following the purebasic window, if I move it.
I can't confirm this. On my computer when I move the purebasic window the video stays in the window.
"What you are is what you have been. What you’ll be is what you do now.” -Buddha
spataro
New User
New User
Posts: 6
Joined: Wed Apr 18, 2012 6:48 pm

Re: How to develop a video audio player ?

Post by spataro »

Zach wrote:Basically you want to write a DirectShow wrapper. Forum member, Inc, wrote a Dshow wrapper and Rashad has also done some work on it trying to help me get what I wanted.
...
"Greenforce Player".
Useful infos. I've read about greenforce player, but just for the beginning I was looking for something standard, even if greenforce is interesting for me.

I think all depends on directx 7 (on win). An update should be interesting, as i've read in other posts.
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Re: How to develop a video audio player ?

Post by utopiomania »

Use a program to inject the right code into an html gadget, and it can play
anything, from videos to pics, and music.

you can use src, dynsrc, or object to do what you want.
spataro
New User
New User
Posts: 6
Joined: Wed Apr 18, 2012 6:48 pm

Re: How to develop a video audio player ?

Post by spataro »

utopiomania wrote:Use a program to inject the right code into an html gadget, and it can play
anything, from videos to pics, and music.

you can use src, dynsrc, or object to do what you want.
Did you do it ?

I've done on win 7 purebasic 64, but it seems it doesn't support all videos. Let me explain.

I've run the webbrowser code changing the url to www.civile.it/corsopenale but there are some problems with blip embeds, less problems with youtube embeds.

I've tried once again now. Adobe updated flash (i don't use i.e.). Now some strange behaviours (tab key on keyboard doesn't work) but i can view a video embed with the different custom flash player I use.

But i have some mp3 and mp4 to deliver. I've tried:

<embed src=... width=320 height=240></embed>

<object src=... width=320 height=240></object>

<video src=... width=320 height=240></video>

<iframe src=... width=320 height=240></iframe>

Only iframe works, opening an external player (microsoft movie player)... !

So the solutions could be delivering video and mp3 files to listen into a custom flash player, all embedded.

I think that webbrowser is not "standard", it is something created to be cross platform, it seems i.e. but perhaps i should declare the document type of html as html5 explictly.

In few words, could work delivering a flash custom player togheter with the app.

I have to check if my custom flash player supports mp4 and mp3.

Yes. It's a solution. Needs a local flash player on a html page (the software must works even without an internet connection).

Thanks

v.
User avatar
utopiomania
Addict
Addict
Posts: 1655
Joined: Tue May 10, 2005 10:00 pm
Location: Norway

Re: How to develop a video audio player ?

Post by utopiomania »

Did you do it ?
Yes, I use a homegrown mediaplayer based on a webgadget and dhtml code since 2003.

It shows images, plays videos, and mp3s, and just injects the right code into the webgadget to
enable it to render the selected file correctly.

Just install the K-Lite codec pack and the webgadget can replay anything IE can.
Post Reply