Recent

Author Topic: How to create video from Component canvas?  (Read 3946 times)

Ronan

  • Full Member
  • ***
  • Posts: 132
How to create video from Component canvas?
« on: March 18, 2017, 09:22:02 am »
Dear All,

I need to create the video from the canvas of any component which has rendering context, that is any TPanel, TBitmap etc..

I've read Video Playback Library section in Lazarus web site and tried to use the SysRec for that purpose. With respect to that I have the following questions:

#1) It seems that totally don't understand how the video is created from any device, googling reveals that creating the snap 
shots from devices and combining later to form the video is enough. Is this the decent way of creating the videos or is there any other more efficient way of doing it with the help of libraries and components.
 
#2) I have used the Sysrec but it seems that it is only capable to capture the video from physical devices, not capable to create video from component canvas. Can you just shed some light on that, is it possible to configure it to produce videos from components canvases ?



Regards,


User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: How to create video from Component canvas?
« Reply #1 on: March 18, 2017, 03:38:23 pm »
I just found something like MediaPlayer component for Lazarus. I don't know if it works or if files in that folder are all it needs:
https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/mplayer/

Judging from example project's source code it should support video
Code: Pascal  [Select][+][-]
  1. MPlayerControl1.StartParam := '-vo direct3d -nofontconfig';
« Last Edit: March 18, 2017, 03:40:17 pm by User137 »

Ronan

  • Full Member
  • ***
  • Posts: 132
Re: How to create video from Component canvas?
« Reply #2 on: March 18, 2017, 03:51:13 pm »
Thanks in advance I'll take a look at that, for the time being I'm trying to figure out how to record using  PasVLCLib.

Generally there are many libraries and components but they all seem to be dealing with playing the medias from devices but not record them from components canvas, which is what I want.

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: How to create video from Component canvas?
« Reply #3 on: March 18, 2017, 05:45:29 pm »
It might be technically too slow to show realtime video in canvas, at least in FullHD. Video libraries might have other functions if you want access to the data. But all depends on what are your goals for the project?

Akira1364

  • Hero Member
  • *****
  • Posts: 561
Re: How to create video from Component canvas?
« Reply #4 on: March 26, 2017, 01:58:17 am »
I just found something like MediaPlayer component for Lazarus. I don't know if it works or if files in that folder are all it needs:
https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/mplayer/

Judging from example project's source code it should support video
Code: Pascal  [Select][+][-]
  1. MPlayerControl1.StartParam := '-vo direct3d -nofontconfig';

That component is just a wrapper around DirectShow, I believe... so the required libraries should already be in place by default. (It's worth pointing out though that many parts of DirectShow itself are deprecated and haven't been updated in a few years.... would likely be better to go with something like an FFMPEG or VLC wrapper.)
« Last Edit: March 26, 2017, 03:12:55 am by Akira1364 »

mercury

  • Full Member
  • ***
  • Posts: 154
Re: How to create video from Component canvas?
« Reply #5 on: March 26, 2017, 08:04:27 am »
Try this http://forum.lazarus.freepascal.org/index.php/topic,33105.0.html
I am not sure what you really want to do.
To cap a webcam use arguments
Code: Pascal  [Select][+][-]
  1. -f vfwcap -i 0
This lib is only for decode audio/video, no image rendering no encode.

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: How to create video from Component canvas?
« Reply #6 on: March 26, 2017, 09:22:49 am »
vfw is older than DS. vfw have some issues on w10. DirectShow is working. But DS is not an easy Framework.
regards
Andreas

mercury

  • Full Member
  • ***
  • Posts: 154
Re: How to create video from Component canvas?
« Reply #7 on: March 26, 2017, 10:28:26 am »
vfw is older than DS. vfw have some issues on w10. DirectShow is working. But DS is not an easy Framework.
Of course.
First Get device name:
Code: Text  [Select][+][-]
  1. ffmpeg -list_devices true -f dshow -i dummy
Then play with:
Code: Text  [Select][+][-]
  1. -f dshow -i video=" device name "  

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: How to create video from Component canvas?
« Reply #8 on: March 26, 2017, 08:25:44 pm »
One of the problem with DS is, there will be no unit with a connector for VCL components. In DS you need always a connector with an matching interface.

I have looked into DS with the Graphedt/graphedt64 tool, and see the kind of filters DS is working. In graphedt you can also look for all the filters on your system. And you can which kind of video sources are available.

On my PC only Webcam and always the 'Render Media File'.

Playing all kinds of media with Lazarus using DS is no problem. There are some good examples.

Andreas
regards
Andreas

 

TinyPortal © 2005-2018