Computer Hope

Software => Computer programming => Topic started by: kalm1234 on June 09, 2020, 10:39:46 PM

Title: Screen Recording Library/Language Suggestions
Post by: kalm1234 on June 09, 2020, 10:39:46 PM
Hello all,

I am trying to create a program that can record my screen just for the heck of it.  I wanted to see what others thought would be a good language and library to use.

Initially, I wanted to go with Java using the JCodec library because it would be quick, easy, and portable.  In hindsight, Java probably wasn't a good choice for something as CPU intensive as video recording because of how resource hungry Java can be.  Recording my screen (1080p) at 60fps took a good 30%+ of my i7 7700k with nothing else noteworthy running.

Does anyone have experience with this?  What is a good language/library combo?  Why?

Thanks!
Title: Re: Screen Recording Library/Language Suggestions
Post by: Base10 on June 24, 2020, 01:43:17 PM

Hey,

Think there could be a few.  YouTube would be a good place to start, lots of coding videos.  Could give these a watch see what you think and perhaps have a go. 

https://www.youtube.com/watch?v=wjfWa590EFQ (https://www.youtube.com/watch?v=wjfWa590EFQ)

https://www.youtube.com/watch?v=kTCmjSFodpM (https://www.youtube.com/watch?v=kTCmjSFodpM)

Hope these point you in the right direction, and you find what you're looking for!
Title: Re: Screen Recording Library/Language Suggestions
Post by: kalm1234 on July 01, 2020, 05:22:41 PM
Following up on this, I wound up sticking with Java and going with the JNA library specifically for getting the locations and sizes of other windows on-screen.  I did what I wanted to, plus more.  I wound up going further and made a way for someone to not only record their screen (or portions of it, being able to specify windows, monitors, or everything), but also let someone stream their selected area to someone else.

I learned a lot from doing this too.  To send the "video" which wound up just being a steady feed of Buffered Images, you have to make sure your code is efficient and your threads don't mess up anything.  Otherwise, the video your friend/client receives will appear choppy, slow, or out of order.  Granted, recording two 1920 x 1080 monitors at 60fps destroyed my CPU by using 70%+, but that is pretty close to 4k so I was somewhat satisfied with that.  I probably won't be able to do much better than that with Java using the Robot screen capture.

I am going to try it in Python next to see if I can make it more efficient and get access to other windows in a less roundabout way.
Title: Re: Screen Recording Library/Language Suggestions
Post by: TheWaffle on July 21, 2020, 09:18:50 PM
I am going to try it in Python next to see if I can make it more efficient and get access to other windows in a less roundabout way.

python-ffmpeg?