Quantcast
Channel: Embarcadero Community - Embarcadero Community
Viewing all articles
Browse latest Browse all 1888

Video : Capture, Save as mp4 file

$
0
0

Can I capture video and save our videos as mp4 format on Android and iOS ?

How can we make it ?

 

this is my code 


unit Unit1;

 

interface

 

uses

  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,

  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,FMX.Media,

  FMX.Controls.Presentation, FMX.StdCtrls, FMX.Objects;

 

type

  TForm1 = class(TForm)

    Button1: TButton;

    Button2: TButton;

    Image1: TImage;

    Timer1: TTimer;

    MediaPlayer1: TMediaPlayer;

    MediaPlayerControl1: TMediaPlayerControl;

    procedure Button1Click(Sender: TObject);

    procedure Button2Click(Sender: TObject);

    procedure Timer1Timer(Sender: TObject);

  private

    { Private declarations }

  public

  VideoCamera : TVideoCaptureDevice;

  procedure BufferReady(Sender: TObject; const ATime:TMediaTime);

 

    { Public declarations }

  end;

 

var

  Form1: TForm1;

 

implementation

 

{$R *.fmx}

 

procedure TForm1.BufferReady(Sender: TObject; const ATime: TMediaTime);

begin

  VideoCamera.SampleBufferToBitmap(Image1.Bitmap, True);

 

end;

 

 

procedure TForm1.Button1Click(Sender: TObject);

begin

  Timer1.Enabled:=True;

  VideoCamera := TCaptureDeviceManager.Current.DefaultVideoCaptureDevice;

  if VideoCamera <> nil then

  begin

     VideoCamera.OnSampleBufferReady :=BufferReady;

     VideoCamera.StartCapture;

  end;

end;

procedure TForm1.Button2Click(Sender: TObject);

begin

     VideoCamera.StopCapture;

     Timer1.Enabled:=False;

 

end;

 

procedure TForm1.Timer1Timer(Sender: TObject);

begin

//

 

end;

 

end.


 

 


Viewing all articles
Browse latest Browse all 1888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>