#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 600
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private xui As XUI
Private Button1 As B4XView
Private Button2 As Button
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
MainForm.Show
End Sub
Sub Button1_Click
Get_Frame
End Sub
Sub Get_Frame()
Dim URL As String = "rtsp://rtsp.stream/pattern"
'Dim command As String = "/usr/bin/ffmpeg -rtsp_transport tcp -i " & URL & " -r 1 -vsync 1 -qscale 1 -frames:v 1 -f image2 images_$(date +%F_%H-%M-%S).jpg"
Dim ff As String = "ffmpeg.exe"
Dim Args As List
Args.Initialize
Args.Add("-i")
Args.Add(QUOTE & URL & QUOTE)
Args.Add("-r")
Args.Add("10") 'try for 10fps
Args.Add("image%01d.jpg")
Dim sh As Shell
sh.Initialize("ffmpeg", ff, Args)
sh.WorkingDirectory = File.DirApp
sh.Run(-1)
'Dim res As ShellSyncResult =
' #if Debug
' Log(res.Success & "; ExitCode = " & res.ExitCode)
' Log("StdOut = " & res.StdOut)
' Log("StdErr = " & res.StdErr)
' #end if
End Sub
Sub Get_Stamp As String
Dim b As String, d, E As Long, f As Float
DateTime.DateFormat = "yyyy-MM-dd"
DateTime.TimeFormat = "HH:mm:ss"
d = DateTime.Now
E = d - DateTime.TimeParse(DateTime.Time(d))
f = E/DateTime.TicksPerSecond
b = NumberFormat(f, 0, 3)
Dim stamp As String = DateTime.DAte(d) & " " & DateTime.Time(d) & b
Return stamp
End Sub
Private Sub Button2_Click
Dim ff As String = "taskkill.exe"
Dim Args As List
Args.Initialize
Args.Add("/F")
Args.Add("/IM")
Args.Add("ffmpeg.exe")
Dim sh As Shell
sh.Initialize("tk", ff, Args)
sh.WorkingDirectory = "c:\windows\system32"
sh.Run(-1)
End Sub