-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Opencv-librealsense not saving video at 60 fps. #9826
Comments
Hi @Toonkirby The video speed issue that you have encountered is a widely reported problem with OpenCV video recording with VideoWriter in general, not just with RealSense. In the link below, a comment at the bottom of the page seems to use a method that is close to your own code to capture 60 FPS. They set VideoWriter.fourcc('M', 'J', 'P', 'G'); like you did in your commented-out line, but followed immediately after that line with a call to fourcc:
https://answers.opencv.org/question/160142/streaming-a-webcam-at-60-fps/ |
Thanks for the labels! The commented out line was when I was attempting to use solely opencv, in which that line was there when I previously attempted that person's method, which, unfortunately, did not work. The current code uses librealsense with opencv, so I do not have a VideoCapture object. Is there perhaps a better way to save the video other than the VideoWriter and not as a bag file? |
You could capture a video from outside of the RealSense SDK by using live screen-capture software and putting the RealSense Viewer into fullscreen mode by toggling the F8 key, as described in #6841 (comment) If you need to use C++ within the SDK, there was a recent discussion in #9541 about saving to .avi using that language, though it again uses VideoWriter. Others have made use of gstreamer to obtain a video feed from their RealSense camera. One example of this is in the link below. https://support.intelrealsense.com/hc/en-us/community/posts/360052840153/comments/360013915474 |
H @Toonkirby Do you require further assistance with this case, please? Thanks! |
Case closed due to no further comments received. |
Issue Description
Hello, I cannot save video at 60 fps through opencv-libsense with an intel realsense D435. It simply saves the video at twice the speed. I originally tried only using opencv's videocapture method, but now I use the librealsense sdk to pass through opencv, but the videocapture method does not save video at 60 fps. Below is my code. Please ignore the several includes and comments, I have been working on this issue for a few weeks and have tried a variety of different methods:
`// cvtest.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/imgproc/imgproc_c.h>
#include "opencv2/videoio.hpp"
#include <opencv2/video.hpp>
#include "opencv2/imgcodecs.hpp"
#include "opencv2/opencv.hpp"
#include
#include <string.h>
#include <limits.h>
#include
#include <opencv2/core/utils/logger.hpp>
#include <librealsense2/rs.hpp>
#include
//#include <opencv2/videoio/registry.hpp>
using namespace cv;
using namespace std;
using namespace utils;
using namespace logging;
using namespace rs2;
LogLevel setLogLevel(LogLevel LOG_LEVEL_SILENT);
//LogLevel(LOG_LEVEL_SILENT);
chrono::high_resolution_clock::time_point start_time = chrono::high_resolution_clock::now();
int main(int argc, char** argv)
{
//rs2::log_to_console(RS2_LOG_SEVERITY_ERROR);
}
`
Any help would be immensely appreciated. I feel as if I have exhausted all avenues to achieve 60 fps.
The text was updated successfully, but these errors were encountered: