Video & Audio data base & Player

Linux specific questions.
Post Reply
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Video & Audio data base & Player

Post by Dinosaur »

Hi All

The Museum where I volunteer has a need that can best be described as per the title of this post.
I am looking for advice on how to go about achieving the following.

They have a collection of videos (about 100) and the same amount of audio interviews with people now long dead.
These would be categorised in a Tree structure to allow easy selection.

The idea is to make a Audio/Visual booth with a PC running Linux (because I can) where a visitor to the Museum sits down
and selects the video or the Audio with either a Touch screen or hard wired mouse.
Doing a very simple test, I can start a Video or Audio file by calling mplayer from within a FB GUI program.
However as soon as mplayer runs, it can only be stopped with a Esc or Q for quit.
I don't want to put a keyboard there and will also make it near impossible for the visitor to stray elsewhere in the PC.

So, in a nut shell:
I can write the FB program to categorise and display the options with short description, BUT I am not convinced mplayer is the way to go.
Looking for suggestions:
1: Has someone written a player that can be included in my code ?
2: Is there a low cost commercial product that would be easily implemented.?
3: How can I run/shell/exec a video file and still remain in control.?
ie: start video and allow visitor to stop it and select a new one (separate task ?)

Any suggestions greatly appreciated.

Regards
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Video & Audio data base & Player

Post by TJF »

There's a video (and audio) widget in GTK-4:

https://docs.gtk.org/gtk4/class.Video.html

Find header files in

https://github.com/DTJF/gir_headers

(I can update the GTK-4.0.bi header if necessary.)
badidea
Posts: 2586
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: Video & Audio data base & Player

Post by badidea »

The is also libvlc, see header files in include/freebasic/vlc
Some tests here: First test of libVLC include files.
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Video & Audio data base & Player

Post by counting_pine »

Sounds interesting.
Instead of mplayer, you could try ffplay (part of ffmpeg), with the -autoexit flag.
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: Video & Audio data base & Player

Post by Dinosaur »

Hi All

Many thanks guys for the variety of options, some homework to do.

Regards
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: Video & Audio data base & Player

Post by Dinosaur »

Hi All

Gtk seems a good and flexible option.
I have managed to find enough information and examples to make a window, put a button in it and clean up after quit.
However, many hours of searching,, I simply can't find any examples of playing a video file.
There are lots using additional tools (non FB ) which don't help.
The GTK examples in FB don't cover that option either.
I did see an example where GtkPlayerView was imported from mplayer.gtk2, so assumed it must be in the .bi files somewhere.
However could not find it anywhere, in fact searching for "video" in all the .bi files turns up nothing.

Am I barking up the wrong tree ? , can GTK in itself actually play video or does there have to be third part product ?

Could someone please point me in the right direction.

Regards
grindstone
Posts: 862
Joined: May 05, 2015 5:35
Location: Germany

Re: Video & Audio data base & Player

Post by grindstone »

From my experience, libVLC is the jack-of-all-trades-device for media purposes.

Some time ago I wrote this little snippet for Windows, but it should work at Linux, too. Maybe you can find something useful in it:

Code: Select all

'Example of a VERY basic media player using libVLC 

#Inclib "vlccore"
#Include "vlc\vlc.bi" 'Include the libVLC header files

Dim instance As libvlc_instance_t Ptr
Dim media As libvlc_media_t Ptr
Dim mediaPlayer As libvlc_media_player_t Ptr
Dim myMediaFile As String

Print "libVLC version: "; *libvlc_get_version() 'The current libVLC version
Print

SetEnviron ("VLC_PLUGIN_PATH=e:\vlc-2_2_1\plugins") 'Replace with your VLC plugin path
Print "Plugin path: "; Environ ("VLC_PLUGIN_PATH")
Print

instance = libvlc_new (0, NULL) 'Load the VLC engine
If instance = 0 Then
	Print "*** libVLC initialisation failed ***"
	Print "press any key"
	Sleep
  End
EndIf
     
myMediaFile = "f:\##00_00.mp2" 'Replace with the file you want to play. May be any
                                          ' media file (audio or video) libVLC can handle
Print "Media file: ";myMediaFile
Print
media = libvlc_media_new_path(instance, myMediaFile) 'Load media file
mediaPlayer = libvlc_media_player_new_from_media(media) 'Create a media player playing environement
libvlc_media_release(media) 'No need to keep the media now
libvlc_media_player_play(mediaPlayer) 'Play the media

Print "     press any key to quit"
Sleep 'Let it play a bit

libvlc_media_player_stop(mediaPlayer) 'Stop playing
libvlc_media_player_release(mediaPlayer) 'Free the media_player
libvlc_release(instance) 'Free the VLC engine
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Video & Audio data base & Player

Post by TJF »

Dinosaur wrote:Am I barking up the wrong tree ? , can GTK in itself actually play video or does there have to be third part product ?

Could someone please point me in the right direction.
Yes, Gtk can play video/audio without third party products; since version GTK-4.0. Currently you wont find neither headers nor examples in the fbc distribution.

Once you installed Gtk-4, use the video widget as any other widget, setting the auto-play property. Place it in a box beside the QUIT button in a popup dialog window, and start running that dialog from a tree view (selection) in a full screen main window. That's all. (Perhaps you want to load the tree view stuff from an XML file, see g_markup_... function family. Mind i18n.)
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Video & Audio data base & Player

Post by D.J.Peters »

Why not running a HTML 5 web page with video and audio blayback buttons in a tree structure on the Linux PC with touch screen ?

Joshy
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: Video & Audio data base & Player

Post by Dinosaur »

Hi All

Good suggestion but totally different learning curve for me, (75 year old Dinosaur)

Regards
jdmcbride
Posts: 28
Joined: Aug 06, 2016 16:13

Re: Video & Audio data base & Player

Post by jdmcbride »

Dinosaur wrote:Hi All
Hi Back at you! How you feel about python? Very similar to basic....

Goto: https://github.com/ViktorNova/edna

It will do all that you just asked for. Just need python....
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: Video & Audio data base & Player

Post by speedfixer »

You could control any of the Linux CLI audio players with an OPEN PIPE or other command that can contain a script.
MOC is a good example. You can start the play, kill the server on a subsequent command, or let it play out.

david
Dinosaur
Posts: 1478
Joined: Jul 24, 2005 1:13
Location: Hervey Bay (.au)

Re: Video & Audio data base & Player

Post by Dinosaur »

Hi All

Thanks for the additional suggestions , I am still trying to clarify the limits of the project before
I decide on direction.
What is MOC ?

Regards
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: Video & Audio data base & Player

Post by speedfixer »

MOC
Music on Console

https://moc.daper.net/

Midnight Commander like interface, but for music.
Can be command-line only. Doesn't need to display interface and can play as daemon/server.

You can just OPEN PIPE "mocp -S" FOR OUTPUT AS FNUM to start the server.
A few options from man page:
-l, --playit
Play files given on the command line without modifying the clients' playlists.

-s, --stop
Request the server to stop playing.

-v [+|-]N, --volume [+|-]N
Adjust the mixer volume. You can set (-v 50) or adjust (-v +10, -v -10).
Start it in server mode. Send it a file name to play. Tell it to stop or clear the playlist. Terminate the server, etc.

There are a few other programs like it.

ffplay just is TOO complete and only intended to be a tool. Too many options to even try to figure out what is best.
I just wanted something simple to play music while working in the garage. I picked this.

david
Post Reply