I made Delphi form application and I have implemented usage of libvlc.dll and sdl2.dll to get video frame.
Sdl is using lock, unlock and display function where you work with PSDL_Texture. According to my test showing video in SDL window use alot of CPU and very small amount of GPU (setting '--avcodec-hw=dxva2' didn't help at all).
If I removed the SDL window and tryed to display video in Panel by calling
Code: Select all
libvlc_media_player_set_hwnd(AMediaPlayer, Pointer(Panel1.Handle));
Code: Select all
libvlc_video_set_callbacks(AMediaPlayer, @lock, @unlock, @display, @FrameContext[iId]);
So my questions/desire:
- I want to get each video frame so I can display it with IDirect3DTexture9, IDirect3DSurface9.
- As I can see I can't get dx9 texture out of vlc directly?
- so which aproach would be the best to do this on GPU and not on CPU site?
Did I set the hardwer decoding wrong?
Code: Select all
//Before opening an instance:
AVlcArgs[0] := ''; //PAnsiChar(libvlc_dynamic_dll_path);
AVlcArgs[1] := '--no-video-title-show';
AVlcArgs[2] := '--no-xlib';
AVlcArgs[3] := '--no-audio';
AVlcArgs[4] := '--network-caching=200';
AVlcArgs[5] := '--rtsp-caching=100';
AVlcArgs[6] := '--sout-rtp-caching=200';
AVlcArgs[7] := '--avcodec-hw=any';
AVlcArgs[8] := '--vout=directx';
AVlcArgs[9] := '--ffmpeg-hw';
AVlcArgs[10] := '--extraintf=logger';
AVlcArgs[11] := '--verbose=2'; //
AVlcArgs[12] := '--file-logging';
AVlcArgs[13] := '--logfile=vlc.log';
var p_li := libvlc_new(Length(AVlcArgs)-1, @AVlcArgs[0]);
//And before play:
libvlc_media_add_option(AMedia, PAnsiChar('--network-caching=200'));
libvlc_media_add_option(AMedia, PAnsiChar('--rtsp-caching=100'));
libvlc_media_add_option(AMedia, PAnsiChar('--sout-rtp-caching=200'));
libvlc_media_add_option(AMedia, PAnsiChar('--avcodec-hw=any'));
libvlc_media_add_option(AMedia, PAnsiChar('--vout=directx'));
libvlc_media_add_option(AMedia, PAnsiChar('--ffmpeg-hw'));