Currently I am playing with FFMPEG to add video playback in my 64bit app developed in Delphi.
I read somewhere that VLC medial player is more powerful and has more features.
Is there any control or library that I can use to play videos in my 64bit app at a given location on form.
One peculiar thing that I require is to be able to skip a few frames as per users configuration during playback.
I did try out VLC but the code sample provided on VLC web site works only for 32bit app and not for 64bit apps.
Here is the code to initialize VLC:
var
sL: TStringList;
VLCPath: string;
begin
// load vlc library
VLCPath := ExtractFilePath(Application.ExeName);
VLCPath := VLCPath + 'vlc';
//VLCPath := VLCPath + 'vlc64';
vlclib := LoadVLCLibrary(VLCPath);
if vlclib = 0 then begin
Showmessage('Load vlc library failed');
Exit;
end;
// sL will contains list of functions fail to load
sL := TStringList.Create;
if not LoadVLCFunctions(vlclib, sL) then begin
Showmessage('Some functions failed to load : ' + #13#10 + sL.Text);
FreeLibrary(vlclib);
sL.Free;
Exit;
end;
sL.Free;```
Code for playing video:
procedure TfrmMain.btnPlayClick(Sender: TObject);
var
VidFile: PAnsiChar;
begin
VidFile := PAnsiChar(AnsiString(ExtractFilePath(Application.ExeName) + 'videos\Happy.mp4'));
// create new vlc instance
vlcInstance := libvlc_new(0, nil);
// create new vlc media from file
vlcMedia := libvlc_media_new_path(vlcInstance, VidFile);
// if you want to play from network, use libvlc_media_new_location instead
// vlcMedia := libvlc_media_new_location(vlcInstance, 'udp://@225.2.1.27:5127');
// create new vlc media player
vlcMediaPlayer := libvlc_media_player_new_from_media(vlcMedia);
// now no need the vlc media, free it
libvlc_media_release(vlcMedia);
// play video in a TPanel, if not call this routine, vlc media will open a new window
libvlc_media_player_set_hwnd(vlcMediaPlayer, Pointer(pnlMain.Handle));
// play media
libvlc_media_player_play(vlcMediaPlayer);
end; ```
TIA