Record desktop screen

Discuss any general programming issues here
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Record desktop screen

Post 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!
plouf
Posts: 473
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Record desktop screen

Post 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...
Christos
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Record desktop screen

Post by papiosaur »

Thanks plouf for your answer, i will investigate this command ;-)
User avatar
Juan Carlos
Posts: 891
Joined: Mon Sep 06, 2010 1:02 pm

Re: Record desktop screen

Post 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.
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Record desktop screen

Post 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.
plouf
Posts: 473
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Record desktop screen

Post 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()
Christos
User avatar
Juan Carlos
Posts: 891
Joined: Mon Sep 06, 2010 1:02 pm

Re: Record desktop screen

Post 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.
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Record desktop screen

Post 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
papiosaur
Posts: 161
Joined: Fri Mar 31, 2023 1:34 pm

Re: Record desktop screen

Post by papiosaur »

@plouf: a solution to stop the record properly please?

I see a BeginAnimStreamExt() but no example for this command...
plouf
Posts: 473
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: Record desktop screen

Post 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

Christos
Post Reply