How can I access the current frame in C++ builder 6 MediaPlayer object when I have paused the video? - c++

How can I access the current frame in C++ builder 6 MediaPlayer object when I have paused the video?
i use a panel or Animate object as its display but I can't find a property or function for neither the MediaPlayer object or its display that lets me access the currently paused frame so that I can be able to copy its pixels information to a bitmap or do some processing on it!
I did this to copy the display image to a bitmap image but it just copies the display(panel or animate) background color:
MediaPlayer1->Display->PaintTo(Image1->Canvas, 200, 200);

TMediaPlayer does not support what you want. You will have to switch to another API, like DirectX or libav, which can give you access to the frame data and expects you to render the frames visually yourself as they are being given to you.

Related

WinUI3 & Unoplatform: Drawing brush on image/video surface while playing and save it directly on original file

Hello I am building an image/video editing application (runs on window 11) using Unoplatform.
(Unoplatform internally use WinUI3)
What i want to do is
App can load image/video frame on canvas
Use brush effect on frame surface like drawing pad feature
During playing video, user can add effect on every frame and modified frame saved right away on original file.
During playing video, do computer vision processing to recognize object and add mark on frame
Audio must playable
So my question is,
How can I add an effect to only a specific frame in the original video and save it using Unoplatform(or WinUI3) API?
Is it possible to play video on canvas view and get frame by frame from MediaPlayer?

Borland C++ stretch a TAnimate

Hi I have an application made with Borland C++Builder. I am using RAD Studio for it.
In the application there is a TForm with a TAnimate (object for videos) on it. I wanted to know if it is somehow possible to stretch the TAnimate object?
If I change the size of the object:
video->Width = newwidth;
video->Height = newheight;
The video doesn't get stretched but a white border gets added to the video image.
Is there some way to scale the video image?
If someone tells me that it is impossible that would be ok !
Maybe it is possible to convert TAnimate in a scaled TImage.
The autosize property of TAnimate doesn't work.
TAnimate is just a thin wrapper around a Win32 Animation control, which has no option for stretching/scaling video. Even MSDN says:
Note The AVI file, or resource, must not have a sound channel. The capabilities of the animation control are very limited and are subject to change. If you need a control to provide multimedia playback and recording capabilities for your application, you can use the MCIWnd control. For more information, see MCIWnd Window Class.

Drawing items on VLC object

Recently I have tried to do some graphics on the top of VLC video using vlc-qt (which provides a video widget). The approach was trying to draw something on the widget. But it failed duo to the fact that vlc-qt's widget uses an internal widget to render video. (See more details here)
Now I'm trying to do something different. I want to try drawing text (or some rectangles) on the VLC media itself (not the widget). I suppose it's the way how VLC media player renders subtitles (isn't it?)
So the question is this: Having a vlc-qt interface, how can I access underlying vlc object and draw something on it [using libVLC API]?
I'm afraid the only way to do it with libvlc is to use libvlc_video_set_callbacks + libvlc_video_set_format_callbacks. It will decode media stream's frames to memory, which you could use as you wish.

How to pass D3DDevice in LibVLC to be the "HWND"

I wanted to use libVCL to display a video in my game, however I have issues with using HWND when the game is in fullscreen, the fullscreen surface overlaps the video.
I do have the D3DDevice handle available though so the video could draw inside the game surface.
But all I've found is libvlc_media_player_set_hwnd() and not a way to pass the video surface to my game's surface for drawing. Is there any way/example to do this?
There is no such function in LibVLC.
I think you need to use the video format callbacks and render the video buffer to a texture yourself. That is the I the approach I used (from Java with JMonkeyEngine for example).
See libvlc_video_set_callbacks, libvlc_video_set_format and libvlc_video_set_format_callbacks.
I've seen this play back full HD smoothly, but this will consume more CPU than having VLC render directly into a video surface.

Playing transparent video over screen with custom user input handling

I need to play animated characters over the screen on Windows. Basically, it will be character video with transparency and only non-transparent parts should be able to accept user input (e.g. mouse clicks), all other events should be passed through to underlying window.
I've made a simple transparent DirectX window with video in it. But I don't know how to make parts of this window "transparent" for user input. So if I clicking on the character, my application should accept this click, if I clicking on the transparent part of the video - click should be handled by the underlying window. How can I make it?
Thanks in advance.
I assume you mean Direct Show rather than DirectX?
You can do it using the Video Mixing Renderer. As with anything directshow its not, necessarily, easy.
First connect the video to the VMR Filter.
Second, for the animating characters all you need to do is build a simple DirectShow push source filter (Its explained really well in the DirectShow samples) that supplies the animation frames.
Third you need to create an IVMRImageCompositor class. You can then use DirectX to composite the images.