I want to know obs's virtual camera technology. #5416
Unanswered
Teruya-Inoue
asked this question in
Development Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd like to use obs's virtual camera technology.
I found out that shared memory is used.
Use the following program as a reference
I tried to write to the shared memory to see if the image would be displayed, but it did not work.
Please let me know if there is a better way.
The following is the source code.
`#include <opencv2/opencv.hpp>
#include
#include <windows.h>
using namespace std;
#define VIDEO_NAME L"OBSVirtualCamVideo"
#define ALIGN_SIZE(size, align) size = (((size) + (align - 1)) & (~(align - 1)))
#define FRAME_HEADER_SIZE 32
struct queue_header {
volatile uint32_t write_idx;
volatile uint32_t read_idx;
volatile uint32_t state;
};
struct video_queue {
HANDLE handle;
bool ready_to_read;
struct queue_header* header;
uint64_t* ts[3];
uint8_t* frame[3];
long last_inc;
int dup_counter;
bool is_writer;
};
int main(void)
{
cv::Mat img = cv::imread("1.jpg");
int cx = img.rows;
int cy = img.cols;
cv::cvtColor(img, img, cv::COLOR_BGR2YUV);
}`
Beta Was this translation helpful? Give feedback.
All reactions