Qt或OpenCV:打印视频文件的编解码器 [英] Qt or OpenCV: print out the codec of a video file
本文介绍了Qt或OpenCV:打印视频文件的编解码器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道在使用VideoCapture(在OSX或Ubuntu上)打开视频文件后,如何打印出该视频文件的编解码器.
I'd like to know how i can print out the codec of a video file after opening it with VideoCapture (on OSX or Ubuntu).
该文件已由qt应用程序中的opencv正确加载并可视化.
The file is correctly loaded and visualized by opencv inside a qt application.
QString filename = QFileDialog::getOpenFileName(...)
cout << filename.size() << endl; // size in byte
VideoCapture cap = VideoCapture(filename.toStdString());
cout << cap.get(CV_CAP_PROP_FRAME_HEIGHT) << endl; // print the height
cout << cap.get(CV_CAP_PROP_FPS) << endl; // print the fps
codec ??
推荐答案
尝试
cap.get(CV_CAP_PROP_FOURCC);
获取编解码器.
修改:我不是C ++程序员,但这是我发现在四处搜索以将其更改为char数组的结果:
I am not a C++ programmer, but this is what I found searching around to change it to a char array:
int ex = static_cast<int>(inputVideo.get(CV_CAP_PROP_FOURCC));
char EXT[] = {ex & 0XFF , (ex & 0XFF00) >> 8,(ex & 0XFF0000) >> 16,(ex & 0XFF000000) >> 24, 0};
请参阅: http://docs.opencv.org/doc/tutorials/highgui/video-write/video-write.html
这篇关于Qt或OpenCV:打印视频文件的编解码器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文