Media Player

New to Gambas? Post your questions here. No question is too silly or too simple.
Post Reply
PeteMarsh
Posts: 13
Joined: Thursday 22nd February 2024 8:01pm

Media Player

Post by PeteMarsh »

Regarding the Media Player :

Very excited - such a simple but powerful tool with just afew commands, but all the right ones - well thought out.

I have found that some MP4 files will run without an issue, but a couple i downloaded from the web which are closer to my application come up with the "Cannot Get Status" Message. Are all MP4's not the same format ? sounds like cannot get status means there is something missing from the MP4 File. Any help would be greatly appreciated.

I am running Gambas on a Raspberry Pi model 4 with latest Pi OS
User avatar
BruceSteers
Posts: 1588
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Media Player

Post by BruceSteers »

hmm, not sure, according to the web it is a "Container format" so i guess it's contents can vary

possibly a missing codec? , i think it also supports drm.

Quote from wikipedia...
Video: MPEG-H Part 2 (H.265/HEVC), MPEG-4 Part 10 (H.264/AVC) and MPEG-4 Part 2
Other compression formats are less used: MPEG-2 and MPEG-1

maybe exiftool can give some answers if you examine the exif metadata of a working and non working file.

do you have h264/h265 codecs installed?

are you being sure to use file:// prefix

does it play using gst-play
gst-play-1.0 file:///path/to/localfile.mp4
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1588
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Media Player

Post by BruceSteers »

Just a note.

I have problems with MediaView when loading a new URL without calling MediaView.Stop first.

So i always Stop the player before loading something else.
If at first you don't succeed , try doing something differently.
BruceS
PeteMarsh
Posts: 13
Joined: Thursday 22nd February 2024 8:01pm

Re: Media Player

Post by PeteMarsh »

Thanks Bruce - I’m choosing the file from the media player properties whilst I find my feet rather than trying to change on the fly so it’s got to be a problem with the file format that is upsetting things - I assumed the codec used was part of gambus rather than something in the underlying pi. I’m not really sure how I check codecs or change them - Google will be my friend here I suppose.

Whilst I’m writing do you know how the “about to finish” event works - about to finish would imply that it hasn’t finished or it would be called finished surely - how far off the. End does it trigger.

Finally is there any master documentation for the media player - it seems very lightly explained but could easily form a chapter of a book
User avatar
BruceSteers
Posts: 1588
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Media Player

Post by BruceSteers »

yeah gambas does not really do anything with codecs,
the MediaPlayer is basically a gstreamer interface.
So issues will most likely be gstreamer issues at heart.

maybe search the software catalogue for gstreamer plugins (the good the bad and the ugly) and h264 h265 , aac

I don't know about "about to finish event". can't be hard to test it.
Documentation says about 2 seconds before end
https://gambaswiki.org/wiki/comp/gb.med ... uttofinish

docs wise there is MediaView of course
https://gambaswiki.org/wiki/comp/gb.med ... /mediaview

But also MediaView uses gb.media so these docs will help you understand more about what's going on.
https://gambaswiki.org/wiki/comp/gb.media
If at first you don't succeed , try doing something differently.
BruceS
PeteMarsh
Posts: 13
Joined: Thursday 22nd February 2024 8:01pm

Re: Media Player

Post by PeteMarsh »

Thanks for all this, but I fall at the first fence here :

Most of my issues come from a weak understanding of how to load files on the Pi probably.

I have tried typing "gst-play-1.0--help" to see if the command exists on the pi I have, and it doesn't understand this command.
I have used the packaged video player VLC Media Player and the file plays fine (does that depend on gstreamer ?)
I have checked that GStreamer is present and it seems to be version 1.14 (dpkg -1 | grep gstreamer)
I have tried the basic video player on the gambas farm and that has the same issue with the MP4 file

Finally - I have tried to google finding out what codec i have but to no avail. Even if I'd found out, I can't find info on installing the two codecs you mention or where to get them from even if I knew - any help here would be greatly appreciated.

As always - thanks in anticipation.
PeteMarsh
Posts: 13
Joined: Thursday 22nd February 2024 8:01pm

Re: Media Player

Post by PeteMarsh »

Ok - original question was why do some MP4 files play and some dont - they are both the same format right ? Wrong ! MP4 is a wrapper but what it wraps can be different. Most notably different codecs (coder/decoder) can be used to encode the data in the MP4 file and if your player hasn’t got access to that codec then it won’t play.

I have used sudo apt get update/ upgrade to make sure I have the latest version of GStreamer which apparently gambas uses to play videos but it still doesn’t include some of the common codecs.

Now for the question - can gstreamer have other codecs welded to it ? And, if so which ones would give the widest range of MP4 files played - or can multiple codecs be used ? The standard video player on the pi can play them all so the codec must be present somewhere - any help on assigning codecs to gstreamer would be gratefully received
User avatar
BruceSteers
Posts: 1588
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Media Player

Post by BruceSteers »

I heard you the first time :D

(So I deleted the duplicate quoted post 😉 )
Why do you post your messages twice?
If at first you don't succeed , try doing something differently.
BruceS
Post Reply