libVLC in pb (Windows Only)

Share your advanced PureBasic knowledge/code with the community.
RSrole
User
User
Posts: 71
Joined: Fri Apr 29, 2022 8:27 pm

Re: libVLC in pb

Post by RSrole »

Thanks, you nailed it. No crashes now. The rest is up to me.
novablue
Enthusiast
Enthusiast
Posts: 177
Joined: Sun Nov 27, 2016 6:38 am

Re: libVLC in pb

Post by novablue »

Is it possible to play a video from memory instead from a file?
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: libVLC in pb

Post by infratec »

Yes, it is possible.

But you have to use the media api.

https://stackoverflow.com/questions/312 ... error-main
novablue
Enthusiast
Enthusiast
Posts: 177
Joined: Sun Nov 27, 2016 6:38 am

Re: libVLC in pb

Post by novablue »

infratec wrote: Sun May 22, 2022 1:54 pm Yes, it is possible.

But you have to use the media api.

https://stackoverflow.com/questions/312 ... error-main
Thank you but unfortunately a little too complex for me. It would be great if someone with the know-how could implement it for the use in Purebasic.
elfo116
User
User
Posts: 39
Joined: Sun Oct 12, 2008 9:50 am
Location: CADIZ

Re: libVLC in pb

Post by elfo116 »

Hello everyone, does anyone know how to change the playback speed of a video using libVLC?
StephanB
New User
New User
Posts: 1
Joined: Mon Sep 19, 2022 10:20 am

Re: libVLC in pb

Post by StephanB »

Hello,

is there a way to find out when the playback has finished?
I would then like to automatically close the VLC gadget.

Thanks
gregreen
User
User
Posts: 28
Joined: Fri Apr 21, 2023 7:26 pm

Re: libVLC in pb - learning...

Post by gregreen »

Tremendous help from Justin on the WMP, but I am now very interested in learning more about libVLC for pb. I am in way over my head, but very interested in learning as I have some ideas about playing video that seem possible with the libVLC architecture. Would the book by Martin Vinkel be helpful? There are no pb examples mentioned. I too would like to control speed and playback of multiple streams similar to a video wall but different. Also image overlays and experimenting with reverse playback (perhaps switching to a mp4 that was encoded in reverse? Ideally, I would like to create an Abacus type playback that was from the olden days if anyone remembers.

So much to learn... it is daunting and any guidance here would be supremely appreciated! Thank you all so much!
User avatar
Piero
Addict
Addict
Posts: 865
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: libVLC in pb

Post by Piero »

Did somebody say ffmpeg, ffplay (mplayer) handbrake, ocenaudio (audacity) shutter encoder and stuff? (these are just multimedia tips, often accessible via command-line)
gregreen
User
User
Posts: 28
Joined: Fri Apr 21, 2023 7:26 pm

Re: libVLC in pb

Post by gregreen »

Yes, ffmpeg is awesome but wouldn't know exactly how to implement with purebasic. VLClib so far is very interesting. I'll keep plugging away! Thanks for the tips Piero!
Love the forum. I have zillions of questions but I try to figure out on my own as much as I can before asking. There is so much to learn!
User avatar
Piero
Addict
Addict
Posts: 865
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: libVLC in pb

Post by Piero »

gregreen wrote: Fri May 19, 2023 10:26 pmffmpeg is awesome
I saw mplayer (older stuff) and ffplay ("part of" ffmpeg project...) used in open source projects (like subtitlers), and you can install full binaries or "linked to libraries" versions... so, in case of problems, see if you can use ffmpeg/ffplay libraries (I'm sure ppl here will help you, if it's possible…)
Anyway VLC reads almost anything in theory...
You are so right; there's so much stuff to learn... :)
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Re: libVLC in pb

Post by Rings »

anyone did a port for linux ?
SPAMINATOR NR.1
User avatar
ccode_new
User
User
Posts: 21
Joined: Sat Jul 30, 2022 10:39 am

Re: libVLC in pb (Windows Only)

Post by ccode_new »

Hi!

I've now tried "libvlc" to play videos.

The example from collectordave works very well, but you have to adapt the "vlc_createplayer" procedure for Linux or MacOS.

Code: Select all

CompilerSelect #PB_Compiler_OS
  CompilerCase #PB_OS_Windows
    libvlc_media_player_set_hwnd( \libvlc_media_player, hwnd)
  CompilerCase #PB_OS_MacOS
    libvlc_media_player_set_nsobject(\libvlc_media_player, hwnd)
  CompilerCase #PB_OS_Linux
    libvlc_media_player_set_xwindow(\libvlc_media_player, hwnd)
CompilerEndSelect
Patrice Terrier
User
User
Posts: 21
Joined: Sun Aug 10, 2003 11:45 am
Location: France
Contact:

Re: libVLC in pb (Windows Only)

Post by Patrice Terrier »

FFmpeg offers a direct alternative to VLC

I have written a complete FFmpeg encapsulation with WinDev, but this could be done with any programming language.
The link to the FFmpeg documentation is provided here
http://www.objreader.com/index.php?topic=358.0

And the TMDB version, using a specific 64-bit DLL written in C++ to query the Movie database from the internet.
http://www.objreader.com/index.php?topic=359.0
Patrice Terrier
objreader@gmail.com
http://www.objreader.com
Addon: WinLIFT (Skin Engine), GDImage (Graphic library), ObjReader (3D engine)
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: libVLC in pb (Windows Only)

Post by infratec »

Since you can not test the streaming url stuff with youtube, here is an example with the VideoLan examples:

Code: Select all

;
; https://streams.videolan.org/streams/
;

EnableExplicit

#URL$ = "https://streams.videolan.org/streams/mp4/GHOST_IN_THE_SHELL_V5_DOLBY%20-%203.m4v"

#Width = 1600 / 2
#Height = 900 / 2

IncludeFile "vlc.pb"

CompilerIf Not #PB_Compiler_Thread
  CompilerError "You have to enable thread save!"
CompilerEndIf



Define *vlc.vlc

If vlc_loadlibvlc("C:\Program Files\VideoLAN\VLC\libvlc.dll") ; select vlc dll
  OpenWindow(0, 0, 0, #Width, #Height, "")
  CanvasGadget(1, 0, 0, WindowWidth(0), WindowHeight(0))
  
  *vlc = vlc_createplayer(GadgetID(1), #True)
  ;vlc_showdebug(*vlc, #False)
  vlc_setvolume(*vlc, 80)
  vlc_play(*vlc, #URL$) ; not work for youtube video
  ;vlc_addplaylist(*vlc, #URL$)
  ;vlc_playplaylist(*vlc)
  
  While WaitWindowEvent() <> #PB_Event_CloseWindow
  Wend
  
  vlc_freeplayer(*vlc)
Else
  Debug "Was not able to load libvlc.dll"
EndIf
tj1010
Enthusiast
Enthusiast
Posts: 716
Joined: Mon Feb 25, 2013 5:51 pm

Re: libVLC in pb (Windows Only)

Post by tj1010 »

YT transcodes all uploads to VP9 and Opus. They used HLS up till recently when they moved to MPEG-DASH. They still try to use JS generation as a form of DRM but you can still get active-session URLs to feed to ffmpeg via F12>Network in Chromium browsers. To use as input with ffmpeg you need to use protocol_whitelist

I think they're not using AV1 because Safari and Apple hardware not having a software encoder/decoder across all chips.

Amazon, HULU, Netflix and others were still using HLS, but they all generate m3u8 off session parameters usually in "minimized" JS.

Also do we still need to use named pipes for ffmpeg because of stderr?
Post Reply