Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于RV1126读取实时视频存在延迟问题 #64

Open
kzp828 opened this issue Oct 17, 2024 · 0 comments
Open

关于RV1126读取实时视频存在延迟问题 #64

kzp828 opened this issue Oct 17, 2024 · 0 comments

Comments

@kzp828
Copy link

kzp828 commented Oct 17, 2024

int main() {
// 加载图像

// std::string video_path = "/data/ai_monitor/simulate/video/channels/1";
std::string video_path = "rtsp://admin:antong%40%21%40%23%24@192.168.1.88:554/h264/ch0/main/av_stream";
std::shared_ptrcv::Mat mat_;
std::shared_ptrcv::VideoCapture cap = nullptr;
cap = std::make_sharedcv::VideoCapture(video_path, cv::CAP_ANY);
// VideoCapture cap(video_path,CAP_ANY);

if (!cap->isOpened() || cap == nullptr)
{
std::cout <<"open faild !" << std::endl;
return -1;
}

int frame_cout = 0;
mat_ = std::make_sharedcv::Mat();
while (true)
{
if (!cap->read(*mat_))
{
break;
}
auto now = std::chrono::system_clock::now();
auto time_point = std::chrono::system_clock::to_time_t(now);
std::stringstream ss;
ss << std::put_time(std::localtime(&time_point), "%H:%M:%S");
std::string formatted_time = ss.str();
std::cout << formatted_time << std::endl;
std::string filename = "./image/" + formatted_time + "" + std::to_string(frame_cout) + ".jpg";
std::string filename = "./image/" + std::to_string(frame_cout) + ".jpg";
imwrite(filename,*mat
);
frame_cout++;
}
cap->release();
return 0;
}
这样读取实时视频咋存在延迟呢,直接用VLC拉流是正常的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant