【问题标题】:Qt or OpenCV: print out the codec of a video fileQt 或 OpenCV:打印出视频文件的编解码器
【发布时间】:2013-04-19 15:35:55
【问题描述】:

我想知道如何在使用 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 ??

【问题讨论】:

    标签: qt opencv codec


    【解决方案1】:

    试试

    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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-15
      • 1970-01-01
      • 2019-01-02
      • 1970-01-01
      • 2018-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多