Page 1 of 2

Record desktop screen

Posted: Sun Mar 17, 2024 5:04 pm
by papiosaur
Hello,

i would like create a "screen recorder".

What is the best format for this : APNG, Animated GIF, other?

I see the BGPictoBrush command but i don't know how to create an animation, must i use CreateAnim() or BeginAnimStream() command?

How to show the mouse on the video?

Thanks for your help!

Re: Record desktop screen

Posted: Sun Mar 17, 2024 8:45 pm
by plouf
what do you thjink ?

personaly i would prefer BeginAnimStream() , because it is easier, and save it to GIF because its native supported to HOlylwood , and every available software out there...

Re: Record desktop screen

Posted: Mon Mar 18, 2024 8:56 am
by papiosaur
Thanks plouf for your answer, i will investigate this command ;-)

Re: Record desktop screen

Posted: Mon Mar 18, 2024 1:33 pm
by Juan Carlos
Also you can use the option to save to video MPEG instead of animation format, because it will be more easy and I thin possible too.

Re: Record desktop screen

Posted: Mon Mar 18, 2024 7:06 pm
by papiosaur
@Templario: yes i try to register in AVI but i have the same picture in the video and no mouse...

I try to use SaveSnapshot() command to have the mouse but i have a white picture...

A small example will be welcome if possible.

Re: Record desktop screen

Posted: Mon Mar 18, 2024 9:25 pm
by plouf
i dont think its possible to screenshot with mouse, afaik all screenhots, including OS's "printscreen" take not mouse in.

you must take mouse position and draw something

here is an example of a Screenrecorder free in hollywood few lines of code :)

Code: Select all

HideDisplay()

BeginAnimStream(1, "test.avi", 1920, 1080,#ANMFMT_MJPEG,{FPS=10})

CreateDisplay(2,{Borderless=True, X=1, Y=1, Width=1,height=1})
OpenDisplay(2)
For Local k = 1 To 100
	desktop_brush = GrabDesktop(Nil)
	
	SelectBrush(desktop_brush)
	TextOut(0,0,StrStr(k/10).." sec / frame ="..StrStr(k),{color=#WHITE})
	Circle(MouseX(),MouseY(),10,#RED,{AnchorX = 0.5, AnchorY = 0.5})
	
	WriteAnimFrame(1, desktop_brush)
	Sleep(100)
Next
FinishAnimStream(1)


WaitRightMouse()

Re: Record desktop screen

Posted: Tue Mar 19, 2024 12:53 pm
by Juan Carlos
papiosaur wrote: Mon Mar 18, 2024 7:06 pm @Templario: yes i try to register in AVI but i have the same picture in the video and no mouse...

I try to use SaveSnapshot() command to have the mouse but i have a white picture...

A small example will be welcome if possible.
The screen recorder doesn't record the video with the mouse pointer.

Re: Record desktop screen

Posted: Tue Mar 19, 2024 5:43 pm
by papiosaur
@plouf : Thanks a lot for your example! Work better than my tests :-)

I will try to record a zone around the mouse to reduce the snapshot size like 800x600 or 640x512 but i don't know if it possible.

The mouse move with with blows... a solution for that?

@Templario: yes, thanks

Re: Record desktop screen

Posted: Wed Mar 20, 2024 5:40 pm
by papiosaur
@plouf: a solution to stop the record properly please?

I see a BeginAnimStreamExt() but no example for this command...

Re: Record desktop screen

Posted: Fri Mar 22, 2024 9:25 pm
by plouf
think better..

wher do you find it ? if this command is NOT in the manual, maybe its not has to be ;)

there are many solution to your problem, one solutio nis to use interval
bellow example has perfect timing too
exit with Esc but script must be active (selected window) to catch it

Code: Select all

HideDisplay()
Quit=0
frame=0

BeginAnimStream(1, "test.avi", 1920, 1080,#ANMFMT_MJPEG,{FPS=10})

CreateDisplay(2,{Borderless=True, X=1, Y=1, Width=1,height=1})
OpenDisplay(2)

Function FrameGrab()
	desktop_brush = GrabDesktop(Nil)
	frame=frame+1
	SelectBrush(desktop_brush)
	TextOut(0,0,StrStr(frame/10).." sec / frame ="..StrStr(frame),{color=#WHITE})
	Circle(MouseX(),MouseY(),10,#RED,{AnchorX = 0.5, AnchorY = 0.5})
	
	WriteAnimFrame(1, desktop_brush)
	
	If IsKeyDown("Esc")
		ClearInterval(1)
		FinishAnimStream(1)
		Quit=1
	EndIf
EndFunction



SetInterval(1,FrameGrab,100)

Repeat
	WaitEvent()
Until Quit