当前位置:   article > 正文

c++OpenCV操作mp4_c++ opencv打开mp4

c++ opencv打开mp4

注意:

读取mp4文件时,需要把opencv_videoio_ffmpeg动态库dll文件拷贝到可执行程序exe所在目录,

否则读取mp4文件时,读取的视频为空,宽高等参数都为0。

比如:

opencv_videoio_ffmpeg454_64.dll

读取视频保存mp4:

  1. #include <iostream>
  2. #include <opencv2/opencv.hpp>
  3. int main(int argc, const char ** argv){
  4. cv::String base_dir = "d:/data/shanghai/2019-09-21";
  5. cv::String video_id = "011400.mp4";
  6. cv::String video_save = "011400_save.mp4";
  7. double beg_, end_;
  8. double freq = cv::getTickFrequency();
  9. cv::String input_video = base_dir + "/" + video_id;
  10. cv::VideoCapture input_stream(input_video);
  11. float frame_width = input_stream.get(cv::CAP_PROP_FRAME_WIDTH);
  12. float frame_height = input_stream.get(cv::CAP_PROP_FRAME_HEIGHT);
  13. int frame_count = input_stream.get(cv::CAP_PROP_FRAME_COUNT);
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/484836
推荐阅读
相关标签
  

闽ICP备14008679号