vtpl
1
Hi,
Can anyone please help me to figure out how to decode raw h264 bitstream from memory and use it with opencv.
From one of the thread posts I understand that the decoding is supported through gstreamer framework and not through ffmpeg.
Please suggest.
DaneLLL
2
Hi,
There is a post about camera source + opencv:
[url]https://devtalk.nvidia.com/default/topic/1024245/jetson-tx2/opencv-3-3-and-integrated-camera-problems-/post/5210735/#5210735[/url]
You can achieve your usecase by replacing camera source with h264 decoding.
vtpl
3
Hi DaneLLL
Thank you for the link. But I could not play the video file with the following piece of code:
cv::VideoCapture cap("filesrc location=/home/ubuntu/test/720p_Ducks_Take_Off.264 ! video/x-raw, width=1280, height=720,format=NV12, framerate=30/1 ! nvvidconv ! video/x-raw,format=I420 ! appsink");
if (!cap.isOpened())
{
std::cout << "Failed to open camera." << std::endl;
return -1;
}
for (;;)
{
cv::Mat frame;
cap >> frame;
cv::Mat bgr;
cv::cvtColor(frame, bgr, CV_YUV2BGR_I420);
cv::imshow("original", bgr);
cv::waitKey(1);
}
cap.release();
720p_Ducks_Take_Off.264 is in annex b byte stream format.
DaneLLL
4