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;
    }
    

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

  • 相关阅读:
    Android中连接蓝牙设备时遇到createRfcommSocketToServiceRecord的UUID问题和BluetoothSocket的connect失败
    android4.0蓝牙使能的详细解析 (转载)
    蓝牙介绍
    Bluetooth 4.0之Android 讲解
    jQuery来源学习笔记:扩展的实用功能
    Linux 0.12 内核管理存储器
    java战斗系列-战斗MAVENPW结构
    牟大哥:《App自我促销》连载2 直立人迁移走
    AC自己主动机 总结
    SpringMVC 上下文webApplicationContext
  • 原文地址:https://www.cnblogs.com/it-tsz/p/10772100.html
Copyright © 2011-2022 走看看