screenRecoder

ffmpeg
This commit is contained in:
Vladimir Golubev 2023-03-31 06:54:57 +03:00
parent 6a860b632f
commit a3f88b6fd4
9 changed files with 26 additions and 5 deletions

View File

@ -2,4 +2,5 @@
#include "Include.h"
#include "Options.h"
#include "../functions/addWatermark.h"
#include "../functions/captureScreen.h"
#include "../functions/captureScreen.h"
#include "../functions/screenRecoder.h"

View File

@ -133,6 +133,7 @@
<ItemGroup>
<ClInclude Include="functions\addWatermark.h" />
<ClInclude Include="functions\captureScreen.h" />
<ClInclude Include="functions\screenRecoder.h" />
<ClInclude Include="Include\Include.h" />
<ClInclude Include="Include\Options.h" />
<ClInclude Include="Include\Overlay.h" />

View File

@ -27,5 +27,8 @@
<ClInclude Include="Include\Overlay.h">
<Filter>Include</Filter>
</ClInclude>
<ClInclude Include="functions\screenRecoder.h">
<Filter>functions</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -1,7 +1,7 @@
#pragma once
#include "addWatermark.h"
void captureScreen(std::string file_Name)
void captureScreen(std::string file_screenshot)
{
HDC hdcScreen;
HDC hdcDIB;
@ -28,7 +28,7 @@ void captureScreen(std::string file_Name)
// Äîáàâëåíèå âàòåðìàðêè íà êîíòåêñò
addWatermark(hdcScreen, hdcDIB, bmi);
hFile = CreateFile(("C:\\Users\\" + (std::string)std::getenv("USERNAME") + "\\Documents\\vos.team\\" + file_Name).c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
hFile = CreateFile(("C:\\Users\\" + (std::string)std::getenv("USERNAME") + "\\Documents\\vos.team\\" + file_screenshot).c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
BITMAPFILEHEADER hdr = { };
hdr.bfType = 0x4d42; // Áóêâû 'B' è 'M'
hdr.bfOffBits = sizeof(hdr) + sizeof(BITMAPINFOHEADER);

View File

@ -0,0 +1,8 @@
#pragma once
#include "addWatermark.h"
void screenRecoder(std::string file_video)
{
std::string command = "ffmpeg -f gdigrab -framerate 30 -i desktop -c:v libx264 -preset ultrafast -tune zerolatency -crf 25 -pix_fmt yuv420p " + ("C:\\Users\\" + (std::string)std::getenv("USERNAME") + "\\Documents\\vos.team\\" + file_video);
system(command.c_str());
}

View File

@ -2,7 +2,9 @@
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
std::string file_Name = "screenshot_" + std::to_string(time(NULL)) + ".bmp";
std::string file_screenshot = "screenshot_" + std::to_string(time(NULL)) + ".bmp";
std::string file_video = "video_" + std::to_string(time(NULL)) + ".mp4";
switch (msg)
{
case WM_HOTKEY:
@ -17,7 +19,11 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
else if (wParam == 3)
{
captureScreen(file_Name);
captureScreen(file_screenshot);
}
else if (wParam == 4)
{
screenRecoder(file_video);
}
break;
case WM_PAINT:
@ -83,6 +89,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
RegisterHotKey(hwnd, 1, MOD_ALT, 0x5A);
RegisterHotKey(hwnd, 2, MOD_ALT, 0x58);
RegisterHotKey(hwnd, 3, MOD_ALT, 0x50);
RegisterHotKey(hwnd, 4, MOD_ALT, 0x56);
while (GetMessage(&Msg, NULL, 0, 0) > 0)
{
@ -100,6 +107,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
UnregisterHotKey(hwnd, 1);
UnregisterHotKey(hwnd, 2);
UnregisterHotKey(hwnd, 3);
UnregisterHotKey(hwnd, 4);
exit(0);
return Msg.wParam;

Binary file not shown.

Binary file not shown.

Binary file not shown.