1. 下载FFmepg官网库直接使用即可。
  1. avdevice.lib
  2. avcodec.lib
  3. avfilter.lib
  4. avformat.lib
  5. avutil.lib
  6. postproc.lib
  7. swresample.lib
  8. swscale.lib
  1. // ConsoleFFmpeg.cpp : 定义控制台应用程序的入口点。
  2. //
  3. #include "stdafx.h"
  4. #include <iostream>
  5. #include <string>
  6. #include <stdlib.h>
  7. //#define __STDC_CONSTANT_MACROS
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. #include "libavcodec/avcodec.h" //编码/解码库
  12. #include "libavdevice/avdevice.h" //特殊设备复合/复制库
  13. #include "libavfilter/avfilter.h" //基于图形的框架编辑库
  14. #include "libavformat/avformat.h" // I/O 格式库
  15. #include "libavutil/avutil.h" //所有FFmpeg库共享的通用代码
  16. #include "libpostproc/postprocess.h" //视频后处理库
  17. #include "libswresample/swresample.h" //音频处理重采样,样本格式转换和混合的库
  18. #include "libswscale/swscale.h" //颜色转换和缩放库
  19. #ifdef __cplusplus
  20. }
  21. #endif
  22. void show_dshow_device()
  23. {
  24. AVFormatContext *pFormatCtx = avformat_alloc_context();
  25. AVDictionary* options = NULL;
  26. //设置键值对数组
  27. av_dict_set(&options, "list_devices", "true", 0);
  28. AVInputFormat *iformat = av_find_input_format("dshow");
  29. //ffmpeg -list_devices true -f dshow -i dummy
  30. avformat_open_input(&pFormatCtx, "video=dummy", iformat, &options);
  31. avformat_free_context(pFormatCtx);
  32. }
  33. int main()
  34. {
  35. avdevice_register_all();
  36. AVFormatContext *s = avformat_alloc_context();//分配一个结构体 free 释放
  37. AVInputFormat *input = NULL;
  38. AVOutputFormat *out = NULL;
  39. input = av_input_video_device_next(input);
  40. out = av_output_video_device_next(out);
  41. while (out)
  42. {
  43. std::cout << "输出视频设备:" << out->name << " " << out->long_name << std::endl;
  44. out = av_output_video_device_next(out);
  45. }
  46. while (input)
  47. {
  48. std::cout << "输入视频设备:" << input->name << " " << input->long_name << std::endl;
  49. input = av_input_video_device_next(input);
  50. }
  51. show_dshow_device();
  52. AVDeviceInfoList **device_list = NULL;
  53. AVInputFormat * dshow = av_find_input_format("dshow");
  54. AVInputFormat *avInput = NULL;
  55. AVOutputFormat *avOut = NULL;
  56. while (avInput)
  57. {
  58. std::cout << "xxx设备:" << avInput->name << " " << avInput->long_name << std::endl;
  59. avInput = av_iformat_next(avInput);
  60. }
  61. while (avOut)
  62. {
  63. std::cout << "xxx设备:" << avOut->name << " " << avOut->long_name << std::endl;
  64. avOut = av_oformat_next(avOut);
  65. }
  66. AVDeviceCapabilitiesQuery ** query = NULL;
  67. AVDictionary ** device_options;
  68. avformat_free_context(s);
  69. system("pause");
  70. return 0;
  71. }
  72. /*
  73. int avformat_open_input ( AVFormatContext ** ps,const char * url,AVInputFormat * fmt,AVDictionary ** options)
  74. */
  1. /*!
  2. 枚举设备
  3. ffmpeg -list_devices true -f dshow -i dummy
  4. 等价于如下代码
  5. */
  6. void listDShowDevice()
  7. {
  8. AVFormatContext *fmtCtx = avformat_alloc_context();
  9. AVDictionary *options = NULL;
  10. av_dict_set(&options,"list_devices","true",0);
  11. AVInputFormat *inputFmt = av_find_input_format("dshow");
  12. if(avformat_open_input(&fmtCtx,"video=dummy",inputFmt,&options) == 0){
  13. avformat_close_input(&fmtCtx);
  14. return;
  15. }
  16. avformat_free_context(fmtCtx);
  17. }
  18. /*!
  19. 枚举指定图像设备分辨率大小
  20. ffmpeg -list_options true -f dshow -i video=device_name
  21. 等价于如下代码
  22. */
  23. void listDShowDeviceOption(const char *deviceName)
  24. {
  25. AVFormatContext *fmtCtx = avformat_alloc_context();
  26. AVDictionary *options = NULL;
  27. av_dict_set(&options,"list_options","true",0);
  28. AVInputFormat *inputFmt = av_find_input_format("dshow");
  29. char buff[256] = {0};
  30. sprintf(buff,"video=%s",deviceName);
  31. if(avformat_open_input(&fmtCtx,buff,inputFmt,&options) == 0){
  32. avformat_close_input(&fmtCtx);
  33. return;
  34. }
  35. avformat_free_context(fmtCtx);
  36. }

FFmepg 如何在 window 上使用?的更多相关文章

  1. 如何在Window上使用Git

    开始的时候同事只给了一个地址,类似这样:git@111.111.1.1:ABCDEF (1)如何在Windows上使用Git 有一篇博客不错:http://www.tuicool.com/articl ...

  2. 如何在window上把你的项目提交到github

    1.首先你需要在https://github.com/ 上注册一个账户 2.注册成功以后,你需要新建一个repository(储藏室),这个用来存放你要上传的项目 点击中间的带加号的图标就可以新建re ...

  3. window上利用pip安装pandas

    官网推荐的是直接使用Anoconda,它集成了pandas,可以直接使用.安装挺简单的,有windows下的安装包.如果不想安装庞大的Anoconda,那就一步一步用pip来安装pandas.下面我主 ...

  4. 如何在MyEclipse上添加更换JRE

    如何在myeclipse上添加更换JRE 由于兼容性的问题,有些WEB项目会依赖jdk的版本.如果需要更换jdk,那么,知道如何更换JRE的方法很有必要. 一种在myeclipse上添加和更换JRE的 ...

  5. Redis简介以及如何在Windows上安装Redis

    Redis简介 Redis是一个速度非常快的非关系型内存数据库. Redis提供了Java,C/C++,C#,PHP,JavaScript,Perl,Object-C,Python,Ruby,Erla ...

  6. 如何在Zabbix上安装MySQL监控插件PMP

    PMP,全称是Percona Monitoring Plugins,是Percona公司为MySQL监控写的插件.支持Nagios,Cacti.从PMP 1.1开始,支持Zabbix. 下面,看看如何 ...

  7. 关于如何在github上创建团队开发环境

    今天想写个如何在github上创建团队开发环境的博客.送给那些还不知道如何在github上创建团队开发环境的开发人员. 1.首先,当然你要有个github的账号.具体怎么注册我这里就不说了.可以上gi ...

  8. 在window上安装pandas

    之前在ubuntu上安装pandas,用的easy_install.这次在window上同样方法装遇到"unable to find vcvarsall.bat",看一些网上帖子好 ...

  9. 如何在windows7上安装启明星系统。

    启明星系统提供多种安装方式.安装包里自带了setup.exe.每个程序的 install下有在线安装(例如请假应用程序为book,则默认为 http://localhost/book/install ...

随机推荐

  1. Java基础——反射 reflect

    什么是反射 (1)Java反射机制是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法:对于任意一个对象,都能够调用它的任意一个方法和属性:这种动态获取的信息以及动态调用对象的方法的功能称 ...

  2. duilib消息类型

    //定义所有消息类型 ////////////////////////////////////////////////////////////////////////// #define DUI_MS ...

  3. mysql主从配置主主配置

    一.     概述  MySQL从3.23.15版本以后提供数据库复制(replication)功能,利用该功能可以实现两个数据库同步.主从模式.互相备份模式的功能.本文档主要阐述了如何在linux系 ...

  4. 【转】Shell执行MySql操作

    mysql  -hhostname -Pport -uusername -ppassword  -e  相关mysql的sql语句,不用在mysql的提示符下运行mysql,即可以在shell中操作m ...

  5. 《.NET 设计规范》第 4 章:类型设计规范

    第 4 章:类型设计规范 4.1 类型和命名空间 要用命名空间把类型组织成一个由相关的功能区所构成的层次结构中. 避免非常深的命名空间层次.因为用户需要经常回找,所以这样的层次浏览起来很困难. 避免有 ...

  6. [DeeplearningAI笔记]ML strategy_1_3可避免误差与改善模型方法

    机器学习策略 ML strategy 觉得有用的话,欢迎一起讨论相互学习~Follow Me 1.8 为什么是人的表现 今天,机器学习算法可以与人类水平的表现性能竞争,因为它们在很多应用程序中更有生产 ...

  7. Redis .Net 基本类型使用之南

    前言 最近需要使用redis,看了一些文档,也在博客园里面看了很多文章,这里就记录下Redis常用类型的操作. String string是redis基本类型,一般通过Get,Set 命令进行操作,这 ...

  8. 基于 React + Webpack 的音乐相册项目(下)

    上一篇我们完成了音乐相册里面的播放图片的功能,这一篇主要完成的是音乐相册里面的音乐播放器功能.最终让我们基于 React 的音乐相册图文并茂.有声有色. 我们主要从以下几个部分来展开: 数据准备 进度 ...

  9. 给php加速安装APC

    说明:APC-3.1.13 适应于 php-5.4.27 下载: wget http://blog.xinfilm.com/softdir/APC-3.1.13.tgz tar -zxvf APC-3 ...

  10. BZOJ 3028: 食物 [生成函数 隔板法 | 广义二项式定理]

    3028: 食物 Time Limit: 3 Sec  Memory Limit: 128 MBSubmit: 497  Solved: 331[Submit][Status][Discuss] De ...