FFmpegInterop 库在 Windows 10 应用中的编译使用
FFmpegInterop 簡(jiǎn)介
FFmpegInterop 是微軟推出的封裝 FFmpeg 的一個(gè)開(kāi)源庫(kù),旨在方便在 Windows 10、Windows 8.1 以及 Windows Phone 8.1 應(yīng)用中使用 FFmpeg 進(jìn)行媒體內(nèi)容播放。FFmpegInterop 實(shí)現(xiàn)了一個(gè) MediaStreamSource 以便通過(guò) FFmpeg 對(duì)媒體內(nèi)容進(jìn)行解碼后輸送到 Windows 多媒體管線進(jìn)行播放。
FFmpegInterop 項(xiàng)目托管于 Github,項(xiàng)目地址:FFmpegInterop?。
原文地址:http://validvoid.net/build-and-use-ffmpeginterop-win10/
?
編譯步驟
FFmpegInterop 是對(duì) FFmpeg 的封裝,依賴(lài) FFmpeg 庫(kù)本身。要使用 FFmpegInterop 需要首先手動(dòng)編譯 FFmpeg 和 FFmpegInterop 庫(kù)。
獲取文件到本地
使用 git 命令或任意 git 工具將 FFmpegInterop 項(xiàng)目文件 clone 到本地:
git clone --recursive git://github.com/microsoft/FFmpegInterop.git獲取最新的 FFmpeg 代碼:
git clone git://github.com/microsoft/FFmpegInterop.gitcd FFmpegInteropgit clone git://source.ffmpeg.org/ffmpeg.gitFFmpegInterop 的 github 倉(cāng)庫(kù) 中鏈接的是 commit 620197d 的 FFmpeg 代碼。不同版本的 FFmpeg 編譯后實(shí)際表現(xiàn)可能有所不同。
進(jìn)行以上操作后,你的本地目錄結(jié)構(gòu)應(yīng)該同以下結(jié)構(gòu)相同:
FFmpegInterop\
├ ffmpeg\ - FFmpeg 庫(kù)代碼目錄
├ FFmpegInterop\ - FFmpegInterop WinRT 組件代碼目錄
├ Samples\ - 使用 C++, C# 以及 JavaScript 分別實(shí)現(xiàn)的例子
├ Tests\ - FFmpegInterop 的單元測(cè)試
├ BuildFFmpeg.bat - 用于編譯 FFmpeg 庫(kù)的批處理文件
├ FFmpegConfig.sh - FFmpeg 配置腳本
├ FFmpegWin8.1.sln - 用于 Windows 8.1 Windows Phone 8.1 開(kāi)發(fā)的 Visual Studio 2013 解決方案
├ FFmpegWin10.sln - 用于 Windows 10 開(kāi)發(fā)的 Visual Studio 2015 解決方案
├ LICENSE
└ README.md
編譯 FFmpeg
編譯 FFmpegInterop 之前,我們首先需要編譯 FFmpeg 本體。編譯 FFmpeg 需要先準(zhǔn)備特定的編譯環(huán)境。
Visual Studio
對(duì)于 Windows 8.1,要求使用 Visual Studio 2013 Update 3 RTM 或更新的版本。 對(duì)于 Windows 10,要求使用 Visual Studio 2015。
安裝配置 MSYS2
MSYS2 是一個(gè)用于 Windows 平臺(tái)的 GNU 編譯環(huán)境套件。要編譯 FFmpeg,必須安裝使用 MSYS2。
MSYS2 下載地址:http://msys2.github.io/
下載頁(yè)面提供了 x86 和 x64 兩種架構(gòu)對(duì)應(yīng)的版本,選擇當(dāng)前計(jì)算機(jī)對(duì)應(yīng)版本下載即可。下載啟動(dòng)安裝程序后選擇一個(gè)安裝路徑,注意盡量選擇類(lèi)似?C:\msys32?這樣由字母數(shù)字構(gòu)成的簡(jiǎn)單短路徑,路徑中不能包含中文、特殊字符、空格等。安裝完成后立即運(yùn)行 MSYS2。
啟動(dòng) MSYS2 后,需要更新 MSYS2 提供的 GNU 環(huán)境,在 MSYS2 的終端中輸入命令?update-core?進(jìn)行更新。更新完畢后,關(guān)閉 MSYS2 再通過(guò)開(kāi)始菜單重啟 MSYS2。重啟后,再輸入?pacman -Su?同步 MSYS2 環(huán)境的包數(shù)據(jù)庫(kù)。
有關(guān) MSYS2 安裝使用的更多內(nèi)容,可參閱?MSYS2 Wiki
安裝配置 YASM
YASM 一個(gè)完全重寫(xiě) NASM 編譯器的匯編語(yǔ)言編譯器,也是編譯 FFmpeg 的必要工具之一。有關(guān) YASM 的更多信息,可以訪問(wèn)其官網(wǎng)?yasm.tortall.net。
YASM 下載地址:http://yasm.tortall.net/Download.html
截至目前 YASM 的最新版本為 2014 年 8 月 10 日發(fā)布的 1.3.0 版。注意 YASM 在其下載頁(yè)面上列舉了多個(gè)不同的版本可供下載:
- Source .tar.gz (源代碼)
- Win32 VS2010 .zip (用于 VS2010+ 和 32 位 Windows)
- Win64 VS2010 .zip (用于 VS2010+ 和 64 位 Windows)
- Win32 .exe (32 位 Windows 通用)
- Win64 .exe (64 位 Windows 通用)
- CygWin32 .exe (用于 CygWin)
- DOS .exe (用于純 DOS 或 DJGPP)
注意我們需要的是上述列表中加粗的兩個(gè)通用版本。根據(jù)自己使用計(jì)算器的架構(gòu)選擇對(duì)應(yīng)的通用版本下載即可。下載后,將下載回來(lái)的?yasm-1.3.0-win64.exe?改名為 yaml.exe,并放置于 MSYS2 安裝目錄中。例如,MSYS2 安裝在?C:\msys64,則將?yaml.exe?放置到c:\msys64\usr\bin\?中。
安裝配置 gas-preprocessor
gas-preprocessor 是用于編譯 FFmpeg 的 perl 預(yù)處理腳本。
gas-preprocessor 下載地址:https://github.com/FFmpeg/gas-preprocessor
下載 gas-preprocessor.pl 文件后放置于 MSYS2 安裝目錄中。例如,MSYS2 安裝在?C:\msys64,則將?gas-preprocessor.pl?放置到?c:\msys64\usr\bin\?中。
驗(yàn)證 FFmpeg 編譯環(huán)境
進(jìn)行以上步驟之后,編譯 FFmpeg 的環(huán)境已經(jīng)基本準(zhǔn)備就緒。我們還需要對(duì)環(huán)境進(jìn)行一下驗(yàn)證,以保證環(huán)境確實(shí)準(zhǔn)備完畢能夠順利進(jìn)行編譯。
通過(guò)開(kāi)始菜單找到 Visual Studio 2013 或 Visual Studio 2015 菜單組,在其中找到?VS2015 x86 ARM Cross Tools Command Prompt?啟動(dòng)。注意,菜單組中可能存在多個(gè)名稱(chēng)類(lèi)似的命令行快捷方式,需要選擇?x86 ARM Cross Tools。?啟動(dòng)?VS2015 x86 ARM Cross Tools Command Prompt?后,在命令行中定位到 MSYS2 的安裝目錄,啟動(dòng) MSYS2:C:\msys64\msys2_shell.bat。(這樣通過(guò) VS 提供的命令行啟動(dòng) MSYS2 的目的在于讓 MSYS2 能夠檢測(cè)到部分由 VS 提供的編譯工具。)
在啟動(dòng)的 MSYS2 終端中分別運(yùn)行一下命令觀察各便于工具組件是否被正確找到:
$ which cl /c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/x86_ARM/cl $ which link /c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/x86_ARM/link $ which armasm /c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/x86_ARM/armasm $ which yasm /usr/bin/yasm $ which cpp /usr/bin/cpp $ which gas-preprocessor.pl /usr/bin/gas-preprocessor.pl如果所有組件均在指定位置被找到,則表示 FFmpeg 編譯環(huán)境已經(jīng)準(zhǔn)備就緒,可以進(jìn)入下一步驟編譯 FFmpeg。如果沒(méi)有通過(guò) VS 提供的?x86 ARM Cross Tools?命令行啟動(dòng) MSYS2,則 cl, link, armasam 這幾個(gè)組件有可能定位不到。也可以選擇將?c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_ARM?這個(gè)目錄加入系統(tǒng)的環(huán)境變量。
編譯 FFmpeg
在 FFmpegInterop 中,微軟已經(jīng)提供了方便的編譯批處理用于自動(dòng)編譯 FFmpeg,如果你想手動(dòng)編譯 FFmpeg,可以參閱?Compile and Use FFmpeg Libraries for Windows Runtime。
FFmpegInterop 項(xiàng)目中提供了一個(gè)名為?BuildFFmpeg.bat?的批處理文件,借助該批處理,可以輕松進(jìn)行 FFmpeg 的編譯工作。BuildFFmpeg.bat?接受兩個(gè)可選參數(shù),第一個(gè)參數(shù)表明目標(biāo)平臺(tái),第二個(gè)參數(shù)表明目標(biāo)架構(gòu),例如:
BuildFFmpeg.bat win10 - 為 Windows 10 的 ARM, x64 和 x86 編譯 BuildFFmpeg.bat phone8.1 ARM - 為 Windows Phone 8.1 的 ARM 編譯 BuildFFmpeg.bat win8.1 x86 x64 - 為 Windows 8.1 的 x86 和 x64 編譯 BuildFFmpeg.bat phone8.1 win10 ARM - 為 Windows 10 和 Windows Phone 8.1 的 ARM 編譯 BuildFFmpeg.bat win8.1 phone8.1 win10 - 為 所有平臺(tái)所有架構(gòu)編譯編譯時(shí)間較長(zhǎng),編譯完成后批處理會(huì)自動(dòng)退出。編譯后的輸出的文件位于項(xiàng)目的?ffmpeg/Build/目標(biāo)平臺(tái)/架構(gòu)?目錄內(nèi)。
編譯 FFmpegInterop
打開(kāi) Win 8.1 或 Win 10 對(duì)應(yīng)的 項(xiàng)目解決方案文件。可見(jiàn)到 FFmpegInterop 解決方案整體的結(jié)構(gòu):
Solution "FFmpegWin10" ├ FFmpegInterop (Universal Windows, C++) ├ MediaPlayerCPP (Universal Windows, C++) ├ MediaPlayerCS (Universal Windows, C#) ├ MediaPlayerJS (Universal Windows, Javascript) └ UnitTest而解決方案的文件目錄結(jié)構(gòu)為
FFmpegInterop-master ├ FFmpegWin10.sln/ FFmpegWin8.1.sln (Visual Studio Solution) ├ BuildFFmpeg.bat (Build script) ├ FFmpegConfig.sh (Build script) ├ FFmpegInterop (Project folder of FFmpegInterop) └ Samples (Project folder of sample players)├ SamplesWin10└ SamplesWin8.1需要注意的是,在項(xiàng)目中使用 FFmpegInterop 時(shí)需要按照 FFmpegInterop 的文件目錄結(jié)構(gòu)對(duì)項(xiàng)目文件進(jìn)行安放。如果沒(méi)有直接使用 FFmpegInterop 提供的項(xiàng)目文件,記得配置 interop 項(xiàng)目對(duì) FFmpeg 的引用:
?
另外 FFmpeg 編譯后是區(qū)分 x86, x64, ARM 三種不同目標(biāo)架構(gòu)的,不同架構(gòu)輸出的目錄并不相同,例如面向 ARM 平臺(tái)的 Windows 10 版本的 FFmpeg 編譯輸出的文件位于?FFmpegInterop-master\ffmpeg\Build\Windows10\ARM?目錄中。在 C# 版的播放器示例項(xiàng)目中,FFmpeg 的幾個(gè) .dll 文件是以鏈接的方式直接從 FFmpeg 的 build 目錄引入項(xiàng)目的,這樣在應(yīng)用打包時(shí),會(huì)將對(duì)應(yīng)架構(gòu)的 FFmpeg 庫(kù)文件自動(dòng)封入應(yīng)用包中。
FFmpegInterop 提供的 MediaPlayerCS 項(xiàng)目已經(jīng)做好了相關(guān)配置,如果需要在自己的項(xiàng)目中使用如上文所述的鏈接方式為項(xiàng)目添加 FFmpeg 庫(kù)文件,需要手動(dòng)配置項(xiàng)目文件:
C# 項(xiàng)目
使用文本編輯器(推薦 Sublime Text/Atom,不要使用記事本)或以 Visual Studio 文本模式(只打開(kāi)文件不打開(kāi)整個(gè)項(xiàng)目)打開(kāi)項(xiàng)目的 .csproj 文件,找到?<ItemGroup></ItemGroup>?節(jié)點(diǎn),在其中添加以下內(nèi)容:
<Content Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\avcodec-56.dll" /> <Content Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\avdevice-56.dll" /> <Content Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\avfilter-5.dll" /> <Content Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\avformat-56.dll" /> <Content Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\avutil-54.dll" /> <Content Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\swresample-1.dll" /> <Content Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\swscale-3.dll" /><ItemGroup>?節(jié)點(diǎn)代表項(xiàng)目包含的文件組,<Content>?代表項(xiàng)目中的“內(nèi)容”類(lèi)型文件。$(SolutionDir)?和?$(PlatformTarget)?均為 Visual Studio 所用生成器可以識(shí)別的宏,$(SolutionDir)?代表解決方案目錄;$(PlatformTarget)?代表目標(biāo)平臺(tái)。采用以上配置,C# 項(xiàng)目即可引入對(duì)應(yīng)平臺(tái)的 FFmpeg 庫(kù)文件了。項(xiàng)目配置文件全文可參考MediaPlayerCS.csproj?。
Javascript 項(xiàng)目
Javascript 項(xiàng)目與 C# 項(xiàng)目類(lèi)似,使用文本編輯器(推薦 Sublime Text/Atom,不要使用記事本)或以 Visual Studio 文本模式(只打開(kāi)文件不打開(kāi)整個(gè)項(xiàng)目)打開(kāi)項(xiàng)目的 .jsproj 文件,找到?<ItemGroup></ItemGroup>?節(jié)點(diǎn),在其中?<AppxManifest></AppxManifest>節(jié)點(diǎn)之后添加以下內(nèi)容:
<Content Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\avcodec-56.dll" /> <Content Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\avdevice-56.dll" /> <Content Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\avfilter-5.dll" /> <Content Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\avformat-56.dll" /> <Content Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\avutil-54.dll" /> <Content Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\swresample-1.dll" /> <Content Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\swscale-3.dll" />項(xiàng)目配置文件全文可參考?MediaPlayerJS.jsproj?。
C++ 項(xiàng)目
C++ 項(xiàng)目與 C# 和 Javascript 項(xiàng)目稍有不同,使用文本編輯器(推薦 Sublime Text/Atom,不要使用記事本)或以 Visual Studio 文本模式(只打開(kāi)文件不打開(kāi)整個(gè)項(xiàng)目)打開(kāi)項(xiàng)目的 .vcxproj 文件,找到?<ItemGroup></ItemGroup>?節(jié)點(diǎn),在其中?<AppxManifest></AppxManifest>?節(jié)點(diǎn)之后添加以下內(nèi)容:
<None Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\avcodec-56.dll"> <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent> </None> <None Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\avdevice-56.dll"> <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent> </None> <None Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\avfilter-5.dll"> <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent> </None> <None Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\avformat-56.dll"> <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent> </None> <None Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\avutil-54.dll"> <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent> </None> <None Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\swresample-1.dll"> <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent> </None> <None Include="$(SolutionDir)ffmpeg\Build\Windows10\$(PlatformTarget)\bin\swscale-3.dll"> <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent><DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent> </None>完整的 C++ 項(xiàng)目配置文件可以參考?MediaPlayerCPP.vcxproj?。
可以看到 FFmpeg 的幾個(gè) .dll 文件名中都有數(shù)字,例如?avformat-56.dll,不同版本的 FFmpeg 編譯出來(lái)的文件名中這個(gè)版本號(hào)數(shù)字是不一樣的,如果手動(dòng)獲取了不同版本的 FFmpeg 代碼進(jìn)行編譯,注意在項(xiàng)目中添加 FFmpeg 的 .dll 時(shí)正確填寫(xiě)文件名。
如果在之前獲取代碼文件到本地的步驟中,你獲取了最新版本的 FFmpeg 代碼,則需要對(duì) FFmpegInterop 項(xiàng)目進(jìn)行一些改動(dòng)才能夠順利編譯。
在最新版本的 FFmpeg 代碼中,FFmpegInterop 在?FFmpegReader.cpp?中調(diào)用的?av_free_packet?已被棄用,FFmpeg 在 commit ce70f28a1732c74a9cd7fec2d56178750bd6e457 中已經(jīng)使用?av_packet_unref?替換了?av_free_packet,因此我們需要在?FFmpegReader.cpp?中改為使用?av_packet_unref。相關(guān)討論可參見(jiàn)?Build error: avfreepacket deprecated?。
使用 FFmpegInterop
FFmpegInterop 的工作流程是:
FFmpegInteropMSS?中提供了兩個(gè)用于創(chuàng)建?FFmpegInteropObject:
CreateFFmpegInteropMSSFromStream?方法接收三個(gè)參數(shù)?IRandomAccessStream^ stream, bool forceAudioDecode, bool forceVideoDecode,stream?即輸入的待播放媒體文件流;forceAudioDecode?用于設(shè)置是否強(qiáng)制使用 FFmpeg 對(duì)音頻進(jìn)行軟解;forceVideoDecode?用于設(shè)置是否強(qiáng)制使用 FFmpeg 對(duì)視頻進(jìn)行軟解。如果不設(shè)置強(qiáng)制使用 FFmpeg 進(jìn)行軟解,那么?MediaStreamSource?會(huì)把壓縮數(shù)據(jù)直接送入?MediaElement進(jìn)行播放,目前只有 mp3、aac 和 H.264 支持硬解播放。
關(guān)于 Windows 10 系統(tǒng)本身支持硬解的格式,可以參考?Supported codecs。
除了上述三個(gè)參數(shù),CreateFFmpegInteropMSSFromStream?方法還有一個(gè)重載接收第四個(gè)參數(shù)?PropertySet^ ffmpegOptions。ffmpegOptions?用于設(shè)置 FFmpeg 中 libavformat 庫(kù)所使用的訪問(wèn)資源時(shí)要求的協(xié)議。所有屬性列表可以參閱?FFmpeg Protocols。
CreateFFmpegInteropMSSFromUri?方法用于播放一個(gè) URI 提供的媒體流,其接收參數(shù)為?String^ uri, bool forceAudioDecode, bool forceVideoDecode,并且同樣有一個(gè)接收?PropertySet^ ffmpegOptions?參數(shù)的重載用于指定協(xié)議設(shè)置。
轉(zhuǎn)載于:https://www.cnblogs.com/validvoid/p/build-and-use-ffmpeginterop-win10.html
總結(jié)
以上是生活随笔為你收集整理的FFmpegInterop 库在 Windows 10 应用中的编译使用的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 清除浮动6中方法
- 下一篇: 进程守护系统,你懂吗?