zoukankan      html  css  js  c++  java
  • VS2013+ffmpeg开发环境搭建

    VS2013+ffmpeg开发环境搭建

    一、准备ffmpeg相对应开发dll、include、lib

    包含三个版本:Static、Shared以及Dev

    • Static — 包含3个应用程序:ffmpeg.exe , ffplay.exe , ffprobe.exe,体积都很大,相关的DLL已经被编译到exe里面去了。
    • Shared — 除了ffmpeg.exe , ffplay.exe , ffprobe.exe之外还有一些DLL,exe体积很小,在运行时到相应的DLL中调用功能。
    • Dev — 开发者(developer)版本,里面包含了库文件xxx.lib以及头文件xxx.h,这个版本不含exe文件
      在这里插入图片描述

    二、开发者版本配置相关环境

    1.新建工程
    在这里插入图片描述

    2.把一中ffmpeg准备的dll、include、lib拷贝到工程目录下
    在这里插入图片描述
    3.右击工程“属性”
    在这里插入图片描述
    4.“C/C++”——>“附加包含目录”——>添加3中拷贝到工程“include”文件
    在这里插入图片描述
    注意:平台会默认选择win32,我们下载的是Windows 64-bit的ffmpeg,因此要把平台改成活动(x64)!

    5.“链接器”——>“常规”——>附加库目录”——>添加3中拷贝到工程“lib”文件
    在这里插入图片描述
    6.“链接器”——>“输入”——>附加依赖项”——>添加“avcodec.lib;avformat.lib;avutil.lib;avdevice.lib;avfilter.lib;postproc.lib;swresample.lib;swscale.lib;”
    在这里插入图片描述
    7.将文件夹内的dll文件拷贝到ffavmuxer里
    在这里插入图片描述
    8.测试

    #include "stdafx.h"
    #include <stdio.h>
    #include"stdlib.h"
    //#include <rational.h>
    
    extern "C"
    {
    #include <libavformat/avformat.h>
    #include <libavutil/dict.h>
    };
    #pragma comment (lib,"avformat.lib")
    #pragma comment (lib,"avutil.lib")
    
    int main(int argc, char **argv)
    {
    	AVFormatContext *fmt_ctx = NULL;
    	AVDictionaryEntry *tag = NULL;
    	int ret;
    
    	//if (argc != 2) {
    	//	printf("usage: %s <input_file>
    "
    	//		"example program to demonstrate the use of the libavformat metadata API.
    "
    	//		"
    ", argv[0]);
    	//	return 1;
    	//}
    
    	if ((ret = avformat_open_input(&fmt_ctx, "la.mp3", NULL, NULL)))
    
    	{
    		
    		return ret;
    	}
    
    	while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
    		printf("%s=%s
    ", tag->key, tag->value);
    
    	avformat_close_input(&fmt_ctx);
    	
    	return 0;
    }
    

    在这里插入图片描述
    运行成功!环境配置完成!如果还有其他问题,请留言。

  • 相关阅读:
    shell脚本通过ping命令来获取平均延时
    源码大招:不服来战!撸这些完整项目,你不牛逼都难!
    最新最全的 Android 开源项目合集
    3.环境搭建-Hadoop(CDH)集群搭建
    mycat安装和测试
    LVS+keepalived
    Linux上利用NFS实现远程挂载
    CentOS下MySQL主从同步配置
    Nginx配置文件(nginx.conf)配置详解
    Storm集群搭建
  • 原文地址:https://www.cnblogs.com/it-tsz/p/10772100.html
Copyright © 2011-2022 走看看