Qt 或 OpenCV : print out the codec of a video file

标签 qt opencv codec

我想知道如何在使用 VideoCapture(在 OSX 或 Ubuntu 上)打开视频文件后打印出其编解码器。

该文件在 qt 应用程序中由 opencv 正确加载和可视化。

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 数组的结果:

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 : print out the codec of a video file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16108298/

相关文章:

html - 如何使 QTextDocument 适合打印机的整个页面宽度

python - 又是 : UnicodeEncodeError: ascii codec can't encode

python - pandas read_csv 中的编解码器问题

c++ - 与已知图像匹配的局部二进制模式

Java openCV - 使用 Imgproc.matchTemplate 方法后,如何检查结果?

audio - 音频文件转换0x0135(Sipro Lab KELVIN)

c++ - QtCreator 如何在构建 Windows 应用程序时避免控制台窗口?

c++ - 通过引用传递空 QString

qt - QT : core gui widgets 中的未知模块

python - Tesseract OCR 无法检测数字