ShareX / ShareX

ShareX is a free and open source program that lets you capture or record any area of your screen and share it with a single press of a key. It also allows uploading images, text or other types of files to many supported destinations you can choose from.
https://getsharex.com
GNU General Public License v3.0
28.28k stars 3.11k forks source link

[request] Capturing from games #848

Open shavitush opened 8 years ago

shavitush commented 8 years ago

I really like the software and I think that we also need some love for gamers.
How about making capturing from fullscreen games possible? It used to work at Windows 7 with Aero disabled, but now with the new Windows release, it's kinda over. A black screen is being seen when capturing from a fullscreen app, which is mainly games.

HitomiTenshi commented 8 years ago

I don't really think ShareX is designed for a gaming purpose, though recent Steam Greenlight integration may indicate otherwise. I would suggest going into your [Game]'s video settings and enabling Borderless Windowed / Windowed Fullscreen, which will fix your black-screen issue.

shavitush commented 8 years ago

Obviously, but in fast paced games such as CS:GO, osu! etc you can't play borderless with WIndows' DWM enabled, it adds some massive unbearable input lag.

HitomiTenshi commented 8 years ago

I have to admit that I have experienced lag in Windows 7 Borderless before, but I tried playing CS:GO on Windows 10 with Borderless + Raw Mouse Input yesterday and it had absolutely no input lag at all. It was actually faster than Fullscreen + No Vsync + Raw Mouse Input.

You should try Borderless Fullscreen again with Windows 10. I assume this dramatic change has something to do with Windows 10 not having Aero (which was managing Vsync in Windows 7).

Jaex commented 8 years ago

I'm gamer too and I hope someone will help adding DirectX/OpenGL capture support :(

shavitush commented 8 years ago

Argh that's a bummer. Guess we have to wait for some champion to send a pull request ;D

Jaex commented 8 years ago

I don't think it will happen because this is extremely difficult feature to implement.

master131 commented 8 years ago

@Jaex You may want to consider implementing bits and piece's of spazzarama's Direct3DHook project which is a .NET DirectX 9/10/11 hooking library. It contains a screenshot capture sample project too. Might be a bit of work adapting to ShareX but it is a possibility.

https://github.com/spazzarama/Direct3DHook

Jaex commented 8 years ago

I tried it before many times and it was not working in majority of games and was crashing games and other such problems. And that project not actively worked on.

master131 commented 8 years ago

Hmm, that's unfortunate then. What about the Desktop Duplication API?

EDIT - Used the sample code from SharpDX's sample repo, seems to sort of work; some of it is rendered incorrectly (background is entirely transparent).

http://i.imgur.com/jRU6dLg.png

Apparently there's some caveat that states the the Desktop Duplication API only works properly on DirectX 11.1 applications (unless they specifically opt-out). The only reliable way I can think of is to hook DirectX like what many video capture software do (eg. FRAPS).

http://blogs.msdn.com/b/dsui_team/archive/2013/03/25/ways-to-capture-the-screen.aspx

Jaex commented 8 years ago

I don't know is it allow to capture from DirectX games. But I don't think so. Just because it using DirectX to do stuff not means it can capture from DirectX games too.

master131 commented 8 years ago

Perhaps if I ever get the time I might fork ShareX (or Direct3DHook) and try get a working DirectX hook based off Open Broadcasting Software's Graphics Capture plugin which is proven to work and be pretty reliable (unless someone is willing to do it).

https://github.com/jp9000/OBS/tree/master/GraphicsCapture

Jaex commented 8 years ago

https://github.com/jasonpang/desktop-duplication-net

I found this but because I don't have much knowledge about DirectX programming, I can't figure out is it can do what we need.

master131 commented 8 years ago

I already tried using the Desktop Duplication API from the following sample: https://github.com/sharpdx/SharpDX-Samples/tree/master/Desktop/Direct3D11.1/ScreenCapture

If you look at my previous post, you can see a screenshot I took using the sample which isn't rendered correctly so it's no good. :pensive:

3941 commented 8 years ago

While I'd love to see built-in support for this, you can easily help yourself by using another software like MSI Afterburner to make screenshots of games. Then use ShareX's watchfolder feature to monitor the screenshot folder of your third party software and upload automatically.

Unless ShareX becomes really, really big, that's also your best bet on not being caught for "cheat injection" or the like. Because anti-cheat-software usually is making an exception for the big game hooking softwares out there. Like Afterburner.

What I'd really love to see is the annotation feature usable on watchfolder files. That's something you can probably fix easily and which would make the feature a lot better.

Jaex commented 8 years ago

@master131 http://blogs.msdn.com/b/dsui_team/archive/2013/03/25/ways-to-capture-the-screen.aspx (1) there tells Desktop Duplication API only can capture from Directx 11.1 > games.

bladecoding commented 8 years ago

Have you looked into using the hooks OBS does for game capture? If not then I may try implementing this using OBS hooks. Granted I have experienced OBS crashing a game(fallout 3). Though I think supporting most games is good enough(at least for me).

Jaex commented 8 years ago

@bladecoding you were in my Steam friends list before but can't find you now, did you removed me?

bladecoding commented 8 years ago

@Jaex Yes, sorry, my friends list was getting unruly with over 300+ people on it so I just removed everyone. Sent a friend request.

Vastrix commented 7 years ago

It not gonna happen this is extremely difficult thing to make.

Shame ;(

classyjakey commented 7 years ago

Stupid idea 1: Make program borderless, then screenshot, then fullscreen it again?

zeroxxx2 commented 7 years ago

This is doable.

http://hearthstonetracker.com/

Check this github project as well. Ask the author to let you take the module for hooking.

Jaex commented 7 years ago

That project using: https://github.com/spazzarama/Direct3DHook

DoumanAsh commented 7 years ago

Well, i found some hints on OpenGL games. http://stackoverflow.com/questions/5844858/how-to-take-screenshot-in-opengl

It seems that it is possible to get pixel data using glReadPixels I'll try to check it out myself also just out of curiosity.

UPD: IT would most likely require to inject own code into running game though

For DirectX i haven't found any hope...

bladecoding commented 7 years ago

@DoumanAsh Getting a screenshot from a game is not really that difficult. You can easily inject the OBS DLLs and grab the frames from memory. The problems are when do you hook the game, do you capture every frame for a responsive capture at the cost of performance and can you guarantee the hook won't trigger an anti-cheat.

McoreD commented 7 years ago

Just use Win+G in Windows 10 and have a watch folder to the save path?

DoumanAsh commented 7 years ago

@bladecoding The problem with anti-cheat is difficult one... Valve wouldn't let you know details of their algorithms, but i think it might possible to get in contact with them and try to find out... But then again it seems rather overly complex to implement and may not worth it

zeroxxx2 commented 7 years ago

Do not worry about VAC. They have their own detections, worrying about it will not go anywhere. I have never heard people getting banned for putting an overlay, let alone screenshot or recording programs.

On Mar 31, 2017 11:53, "Douman" notifications@github.com wrote:

@bladecoding https://github.com/bladecoding The problem with anti-cheat is difficult one... Valve wouldn't let you know details of their algorithms, but i think it might possible to get in contact with them and try to find out... But then again it seems rather overly complex to implement and may not worth it

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ShareX/ShareX/issues/848#issuecomment-290615573, or mute the thread https://github.com/notifications/unsubscribe-auth/ATCkt1VPT8rkn_W0gBHRsMK-w-J0CbnBks5rrIbTgaJpZM4FkJVX .

staplerx300 commented 7 years ago

People are able to use newer NVIDIA graphics cards to make WebMs while playing full screened games, where you can go into the past like 10 seconds or 10 minutes or whatever interval to splice out a recording of some kind.

If ShareX isn't planning on doing the OBS fork thing, does anyone know of a similar way to do fullscreen recording into video? I don't really want to buy a new graphics card just for that lol.

Wedmer commented 7 years ago

Use OBS. Also Raptr has built in Plays client and recorder.

aglasson commented 5 years ago

Perhaps an integration component with existing game capture technologies such as nVidia and OBS etc. Allow monitoring of their output files to use with ShareX's uploading functionality.