FFMPEG 入门

Posted xiaokang088

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了FFMPEG 入门相关的知识,希望对你有一定的参考价值。

1. 下载网站:
https://ffmpeg.zeranoe.com/builds/

先后下载 Win32 Shared 和 Win32 Dev 两个版本,分别解压缩。

2. 用Visual Studio 创建项目,选择 “Create new project from existing Code files”

3. 设置 include path 和 library path, sample as follow,
记得把Shared里面的dll 拷贝到 debug目录。

技术分享图片
  1 <?xml version="1.0" encoding="utf-8"?>
  2 <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  3   <ItemGroup Label="ProjectConfigurations">
  4     <ProjectConfiguration Include="Debug|Win32">
  5       <Configuration>Debug</Configuration>
  6       <Platform>Win32</Platform>
  7     </ProjectConfiguration>
  8     <ProjectConfiguration Include="Release|Win32">
  9       <Configuration>Release</Configuration>
 10       <Platform>Win32</Platform>
 11     </ProjectConfiguration>
 12     <ProjectConfiguration Include="Debug|x64">
 13       <Configuration>Debug</Configuration>
 14       <Platform>x64</Platform>
 15     </ProjectConfiguration>
 16     <ProjectConfiguration Include="Release|x64">
 17       <Configuration>Release</Configuration>
 18       <Platform>x64</Platform>
 19     </ProjectConfiguration>
 20   </ItemGroup>
 21   <PropertyGroup Label="Globals">
 22     <VCProjectVersion>15.0</VCProjectVersion>
 23     <ProjectGuid>{89E103CB-891F-49CF-A157-A1E806687913}</ProjectGuid>
 24     <Keyword>Win32Proj</Keyword>
 25     <WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
 26   </PropertyGroup>
 27   <Import Project="$(VCTargetsPath)Microsoft.Cpp.Default.props" />
 28   <PropertyGroup Condition="‘$(Configuration)|$(Platform)‘==‘Debug|Win32‘" Label="Configuration">
 29     <ConfigurationType>Application</ConfigurationType>
 30     <UseDebugLibraries>true</UseDebugLibraries>
 31     <PlatformToolset>v141</PlatformToolset>
 32   </PropertyGroup>
 33   <PropertyGroup Condition="‘$(Configuration)|$(Platform)‘==‘Release|Win32‘" Label="Configuration">
 34     <ConfigurationType>Application</ConfigurationType>
 35     <UseDebugLibraries>false</UseDebugLibraries>
 36     <PlatformToolset>v141</PlatformToolset>
 37   </PropertyGroup>
 38   <PropertyGroup Condition="‘$(Configuration)|$(Platform)‘==‘Debug|x64‘" Label="Configuration">
 39     <ConfigurationType>Application</ConfigurationType>
 40     <UseDebugLibraries>true</UseDebugLibraries>
 41     <PlatformToolset>v141</PlatformToolset>
 42   </PropertyGroup>
 43   <PropertyGroup Condition="‘$(Configuration)|$(Platform)‘==‘Release|x64‘" Label="Configuration">
 44     <ConfigurationType>Application</ConfigurationType>
 45     <UseDebugLibraries>false</UseDebugLibraries>
 46     <PlatformToolset>v141</PlatformToolset>
 47   </PropertyGroup>
 48   <Import Project="$(VCTargetsPath)Microsoft.Cpp.props" />
 49   <ImportGroup Label="ExtensionSettings">
 50   </ImportGroup>
 51   <ImportGroup Label="Shared">
 52   </ImportGroup>
 53   <ImportGroup Label="PropertySheets" Condition="‘$(Configuration)|$(Platform)‘==‘Debug|Win32‘">
 54     <Import Project="$(UserRootDir)Microsoft.Cpp.$(Platform).user.props" Condition="exists(‘$(UserRootDir)Microsoft.Cpp.$(Platform).user.props‘)" Label="LocalAppDataPlatform" />
 55   </ImportGroup>
 56   <ImportGroup Label="PropertySheets" Condition="‘$(Configuration)|$(Platform)‘==‘Release|Win32‘">
 57     <Import Project="$(UserRootDir)Microsoft.Cpp.$(Platform).user.props" Condition="exists(‘$(UserRootDir)Microsoft.Cpp.$(Platform).user.props‘)" Label="LocalAppDataPlatform" />
 58   </ImportGroup>
 59   <ImportGroup Label="PropertySheets" Condition="‘$(Configuration)|$(Platform)‘==‘Debug|x64‘">
 60     <Import Project="$(UserRootDir)Microsoft.Cpp.$(Platform).user.props" Condition="exists(‘$(UserRootDir)Microsoft.Cpp.$(Platform).user.props‘)" Label="LocalAppDataPlatform" />
 61   </ImportGroup>
 62   <ImportGroup Label="PropertySheets" Condition="‘$(Configuration)|$(Platform)‘==‘Release|x64‘">
 63     <Import Project="$(UserRootDir)Microsoft.Cpp.$(Platform).user.props" Condition="exists(‘$(UserRootDir)Microsoft.Cpp.$(Platform).user.props‘)" Label="LocalAppDataPlatform" />
 64   </ImportGroup>
 65   <PropertyGroup Label="UserMacros" />
 66   <PropertyGroup Condition="‘$(Configuration)|$(Platform)‘==‘Debug|Win32‘">
 67     <LinkIncremental>true</LinkIncremental>
 68     <IncludePath>E:2.Codeffmpegffmpeg-20180930-b577153-win32-devinclude;$(IncludePath)</IncludePath>
 69     <LibraryPath>E:2.Codeffmpegffmpeg-20180930-b577153-win32-devlib;$(LibraryPath)</LibraryPath>
 70   </PropertyGroup>
 71   <PropertyGroup Condition="‘$(Configuration)|$(Platform)‘==‘Release|Win32‘">
 72     <LinkIncremental>true</LinkIncremental>
 73   </PropertyGroup>
 74   <ItemDefinitionGroup Condition="‘$(Configuration)|$(Platform)‘==‘Debug|Win32‘">
 75     <ClCompile>
 76       <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 77       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
 78       <WarningLevel>Level3</WarningLevel>
 79       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
 80       <Optimization>Disabled</Optimization>
 81       <AdditionalIncludeDirectories>E:2.Codeffmpegffmpeg-20180930-b577153-win32-devinclude;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
 82     </ClCompile>
 83     <Link>
 84       <TargetMachine>MachineX86</TargetMachine>
 85       <GenerateDebugInformation>true</GenerateDebugInformation>
 86       <SubSystem>Console</SubSystem>
 87       <AdditionalLibraryDirectories>E:2.Codeffmpegffmpeg-20180930-b577153-win32-devlib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
 88       <AdditionalDependencies>avcodec.lib;avdevice.lib;avfilter.lib;avformat.lib;avutil.lib;postproc.lib;swresample.lib;swscale.lib;%(AdditionalDependencies)</AdditionalDependencies>
 89     </Link>
 90   </ItemDefinitionGroup>
 91   <ItemDefinitionGroup Condition="‘$(Configuration)|$(Platform)‘==‘Release|Win32‘">
 92     <ClCompile>
 93       <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
 94       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
 95       <WarningLevel>Level3</WarningLevel>
 96       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
 97     </ClCompile>
 98     <Link>
 99       <TargetMachine>MachineX86</TargetMachine>
100       <GenerateDebugInformation>true</GenerateDebugInformation>
101       <SubSystem>Console</SubSystem>
102       <EnableCOMDATFolding>true</EnableCOMDATFolding>
103       <OptimizeReferences>true</OptimizeReferences>
104     </Link>
105   </ItemDefinitionGroup>
106   <ItemGroup>
107     <ClCompile Include="..examples	ranscoding.c" />
108   </ItemGroup>
109   <Import Project="$(VCTargetsPath)Microsoft.Cpp.targets" />
110   <ImportGroup Label="ExtensionTargets">
111   </ImportGroup>
112 </Project>
Project

技术分享图片

 

 

技术分享图片

技术分享图片

 

以上是关于FFMPEG 入门的主要内容,如果未能解决你的问题,请参考以下文章

PHP ffmpeg_php测试片段

使用 ffmpeg 生成单个 MPEG-Dash 片段

Ffmpeg入门级教程(Java代码开发)

如何用ffmpeg截取视频片段&截取时间不准确的坑

FFmpeg入门测试

如何利用ffmpeg将一小段视频截取成图片