Hello,
I’m making a CUDA application that uses video from a file.
I’m using cv::VideoCapture to get frame from video file.
But cv::VideoCapture.read() takes about 10ms/frame on Jetson TX2.
The video is 1920*1080 size.
jetson_clocks is enabled, and nvp model in MAXN.
My kernel is faster than 10ms, so the input is bottlenecking.
I’ve tried to use Gstreamer, but no change appears.
Is it normal that cv::VideoCapture.read() takes about 10ms/frame?
And if there are any ways to make reading faster, please let me know.
Thank you.
This is my test code.
#include <opencv2/opencv.hpp>
#include <chrono>
int main()
{
cv::VideoCapture cap("filesrc location=myvideo.mp4 ! qtdemux name=demux demux.video_0 ! queue ! h264parse ! omxh264dec ! nvvidconv ! video/x-raw, format=(string)BGRx ! queue ! videoconvert ! queue ! video/x-raw, format=(string)BGR ! appsink sync=false", cv::CAP_GSTREAMER);
cv::Mat frame;
for(int i=0; i < 100; i++)
{
auto time_start = std::chrono::high_resolution_clock::now();
cap.read(frame);
auto duration = std::chrono::high_resolution_clock::now() - time_start;
std::cout << std::chrono::duration_cast<std::chrono::microseconds>(duration).count() << std::endl;
}
return 0;
}