1. 下载FFmepg官网库直接使用即可。
avdevice.lib
avcodec.lib
avfilter.lib
avformat.lib
avutil.lib
postproc.lib
swresample.lib
swscale.lib
// ConsoleFFmpeg.cpp : 定义控制台应用程序的入口点。
// #include "stdafx.h"
#include <iostream>
#include <string>
#include <stdlib.h> //#define __STDC_CONSTANT_MACROS
#ifdef __cplusplus
extern "C" {
#endif #include "libavcodec/avcodec.h" //编码/解码库
#include "libavdevice/avdevice.h" //特殊设备复合/复制库
#include "libavfilter/avfilter.h" //基于图形的框架编辑库
#include "libavformat/avformat.h" // I/O 格式库
#include "libavutil/avutil.h" //所有FFmpeg库共享的通用代码
#include "libpostproc/postprocess.h" //视频后处理库
#include "libswresample/swresample.h" //音频处理重采样,样本格式转换和混合的库
#include "libswscale/swscale.h" //颜色转换和缩放库
#ifdef __cplusplus
}
#endif void show_dshow_device()
{
AVFormatContext *pFormatCtx = avformat_alloc_context();
AVDictionary* options = NULL;
//设置键值对数组
av_dict_set(&options, "list_devices", "true", 0);
AVInputFormat *iformat = av_find_input_format("dshow");
//ffmpeg -list_devices true -f dshow -i dummy
avformat_open_input(&pFormatCtx, "video=dummy", iformat, &options);
avformat_free_context(pFormatCtx);
} int main()
{
avdevice_register_all();
AVFormatContext *s = avformat_alloc_context();//分配一个结构体 free 释放
AVInputFormat *input = NULL;
AVOutputFormat *out = NULL;
input = av_input_video_device_next(input);
out = av_output_video_device_next(out);
while (out)
{
std::cout << "输出视频设备:" << out->name << " " << out->long_name << std::endl;
out = av_output_video_device_next(out);
}
while (input)
{
std::cout << "输入视频设备:" << input->name << " " << input->long_name << std::endl;
input = av_input_video_device_next(input);
}
show_dshow_device();
AVDeviceInfoList **device_list = NULL;
AVInputFormat * dshow = av_find_input_format("dshow");
AVInputFormat *avInput = NULL;
AVOutputFormat *avOut = NULL;
while (avInput)
{
std::cout << "xxx设备:" << avInput->name << " " << avInput->long_name << std::endl;
avInput = av_iformat_next(avInput);
}
while (avOut)
{
std::cout << "xxx设备:" << avOut->name << " " << avOut->long_name << std::endl;
avOut = av_oformat_next(avOut);
}
AVDeviceCapabilitiesQuery ** query = NULL;
AVDictionary ** device_options;
avformat_free_context(s);
system("pause");
return 0;
} /*
int avformat_open_input ( AVFormatContext ** ps,const char * url,AVInputFormat * fmt,AVDictionary ** options)
*/
/*!
枚举设备
ffmpeg -list_devices true -f dshow -i dummy
等价于如下代码
*/
void listDShowDevice()
{
AVFormatContext *fmtCtx = avformat_alloc_context();
AVDictionary *options = NULL;
av_dict_set(&options,"list_devices","true",0);
AVInputFormat *inputFmt = av_find_input_format("dshow");
if(avformat_open_input(&fmtCtx,"video=dummy",inputFmt,&options) == 0){
avformat_close_input(&fmtCtx);
return;
}
avformat_free_context(fmtCtx);
} /*!
枚举指定图像设备分辨率大小
ffmpeg -list_options true -f dshow -i video=device_name
等价于如下代码
*/
void listDShowDeviceOption(const char *deviceName)
{
AVFormatContext *fmtCtx = avformat_alloc_context();
AVDictionary *options = NULL;
av_dict_set(&options,"list_options","true",0);
AVInputFormat *inputFmt = av_find_input_format("dshow");
char buff[256] = {0};
sprintf(buff,"video=%s",deviceName);
if(avformat_open_input(&fmtCtx,buff,inputFmt,&options) == 0){
avformat_close_input(&fmtCtx);
return;
}
avformat_free_context(fmtCtx);
}

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. Altium designer知识总结

    原理图库文件 =原理图元件库 .schlibPCB库文件=封装库.pcblib 集成库=原理图库文件+封装库 .intlib

  2. python_如何在列表、字典中筛选数据?

    实际问题有哪些? 过滤掉列表[3,9,-1,10.-2......] 中负数 筛选出字典{'li_ming':90,'xiao_hong':60,'li_kang':95,'bei_men':98} ...

  3. linux各种顔色代表

    @linux中的各文件的颜色表示什么 白色:表示普通文件 蓝色:表示目录 绿色:表示可执行文件 红色:表示压缩文件 浅蓝色:链接文件 红色闪烁:表示链接的文件有问题 黄色:表示设备文件 灰色:表示其它 ...

  4. OpenFlow交换机的实现总结

    先粗略介绍,后续会逐渐完善. OpenFlow交换机通过使用OpenFlow协议的安全通道与控制器进行通信.其具体实现如下示意图所示: 对于一个新到达的数据流,交换机通常的做法是,把该数据包发送给控制 ...

  5. border-image用法详解

    图像边框 border-image使用方法:border-image:url('图像路径') 边距(不能带单位)/宽度 上下方式 左右方式:(四个边距,上右下左,相同时可缩写为一个)repeat平铺 ...

  6. TCP/IP网络协议基础知识集锦[转]

    引言 本篇属于TCP/IP协议的基础知识,重点介绍了TCP/IP协议簇的内容.作用以及TCP.UDP.IP三种常见网络协议相关的基础知识. 内容 TCP/IP协议簇是由OSI七层模型发展而来的,之所以 ...

  7. 渗透测试,form对象类型转换,简单demo

    最近公司的项目在进行国家某行业的安全检测,涉及到项目安全渗透等方面的问题: 参与项目的渗透等改造,是一个机遇与挑战,今后对与项目安全等方面会思考更多: 下面说说form表单对象提交,为了防止抓包,后台 ...

  8. 浅析调用JSR303的validate方法, 验证失败时抛出ConstraintViolationException

    废话不多说,直接进入正题:如何使用JSR303的validate,进行数据校验,失败后直接抛出异常加入流转信息中,并在form页面提示出来. 首先我们为了启用验证,需要向 项目中添加Bean验证的实现 ...

  9. [DeeplearningAI笔记]改善深层神经网络_深度学习的实用层面1.9_归一化normalization

    觉得有用的话,欢迎一起讨论相互学习~Follow Me 1.9 归一化Normaliation 训练神经网络,其中一个加速训练的方法就是归一化输入(normalize inputs). 假设我们有一个 ...

  10. 解决axios传递参数后台无法接收问题

    1.根据下面几个方法改变前台传递参数方式 这样后台就可以直接根据传递的参数获取数据,如下图用户登录时直接传递用户名和密码 2.不改变前台传递样式修改后台接收方式