<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[My Visual Database — [Script] Webcam integration using ffmpeg.exe utility]]></title>
		<link>https://myvisualdatabase.com/forum/viewtopic.php?id=3631</link>
		<atom:link href="https://myvisualdatabase.com/forum/extern.php?action=feed&amp;tid=3631&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in [Script] Webcam integration using ffmpeg.exe utility.]]></description>
		<lastBuildDate>Wed, 09 Aug 2017 12:16:25 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[[Script] Webcam integration using ffmpeg.exe utility]]></title>
			<link>https://myvisualdatabase.com/forum/viewtopic.php?pid=21616#p21616</link>
			<description><![CDATA[<p>Webcam integration using ffmpeg.exe utility</p><div class="codebox"><pre><code>CONST

// setting of webcam
WEBCAM_NAME = &#039;USBWebCam&#039;; // YOU NEED TO KNOW YOUR WEB CAM NAME!
WEBCAM_RESOLUTION = &#039;1280x720&#039;;



procedure Form1_OnShow (Sender: string; Action: string);
begin
    ClearShotFolder;
end;

procedure frmEmployee_Button3_OnClick (Sender: string; var Cancel: boolean);
var
    pathShot: string;
    sShotFile: string;
begin
    frmEmployee.Button3.Enabled := False;
    pathShot := ExtractFilePath(Application.Exename)+&#039;shot\&#039;;
    sShotFile := &#039;shot_&#039;+FormatDateTime(&#039;ddmmyyyy_hhmmss&#039;, now)+&#039;.jpg&#039;;

    OpenFile(&#039;-f dshow -s &#039;+WEBCAM_RESOLUTION+&#039; -i video=&quot;&#039;+WEBCAM_NAME+&#039;&quot; -f image2 &quot;&#039;+pathShot+sShotFile+&#039;&quot;&#039;, &#039;ffmpeg.exe&#039;);


    Sleep(3000);
    if FileExists(pathShot+sShotFile) then
    begin
        frmEmployee.imgPhoto.LoadPicture(pathShot+sShotFile);
        frmEmployee.imgPhoto.dbFileName := pathShot+sShotFile;
        frmEmployee.imgPhoto.dbImageIsChanged := True;
    end;

    frmEmployee.Button3.Enabled := True;
end;





procedure Form1_bWebRes_OnClick (Sender: string; var Cancel: boolean);
begin
    OpenFile(&#039;/K ffmpeg.exe -f dshow -list_options true -i video=&quot;&#039;+WEBCAM_NAME+&#039;&quot;&#039;, &#039;cmd.exe&#039;); // list of resolutions
end;

procedure Form1_bListCams_OnClick (Sender: string; var Cancel: boolean);
begin
    OpenFile(&#039;/K ffmpeg.exe -list_devices true -f dshow -i dummy&#039;, &#039;cmd.exe&#039;); // list of devices
end;



procedure ClearShotFolder;
var
    sl: TStringList;
    i,c: integer;
    pathShot: string;
begin
    pathShot := ExtractFilePath(Application.Exename)+&#039;shot\&#039;;

    sl := TStringList.Create;
    sl.Text := GetFilesList(pathShot);

    // delete all files
    c := sl.Count-1;
    for i := 0 to c do
        if not DeleteFile(sl[i]) then ShowMessage(&#039;Can&#039;&#039;t remove file &#039;+sl[i]);

    sl.Free;
end;</code></pre></div><br /><br /><p><strong>Example:</strong><br /><a href="http://myvisualdatabase.com/download/WebCam2.zip">http://myvisualdatabase.com/download/WebCam2.zip</a></p>]]></description>
			<author><![CDATA[null@example.com (DriveSoft)]]></author>
			<pubDate>Wed, 09 Aug 2017 12:16:25 +0000</pubDate>
			<guid>https://myvisualdatabase.com/forum/viewtopic.php?pid=21616#p21616</guid>
		</item>
	</channel>
</rss>
