签署人: Petter Larsson Sravanthi Kota Venkata
已发布:09/06/2012 最后更新时间:10/07/2015
Download Integrating Intel® Media SDK with FFmpeg for mux/demuxing and audio encode/decode usages (PDF 568KB)
Download Source Code. (ZIP 98KB) (Note: Licensing terms match Media SDK 2012)
Note: This article is based on FFmpeg APIs from 2012. Please watch for updates. See also: Accessing Intel® Media Server Studio for Linux* codecs with FFmpeg
The provided samples intend to illustrate how Intel® Media SDK / Intel(R) Media Server Studio SDK can be used together with the popular FFmpeg suite of components to perform container muxing and demuxing (splitting). The samples also showcase integration of rudimentary FFmpeg audio decode and encode.
The sample projects are based on the Intel Media SDK samples with only small modifications to original code such as adding new mux/demux command line directives.
Modified areas of the code with new integration code are tagged with
"// =========== ffmpeg … integration ============".
FFmpeg integration functionality resides in the FFMPEGWriter and FFMPEGReader classes, which are subclasses of the generic Intel Media SDK sample file reader/writer CSmplBitstreamWriter and CSmplBitstreamReader classes, respectively.
To enable simplistic implementation of FFmpeg audio processing functionality, just enable the DECODE_AUDIO or ENCODE_AUDIO define directive.
Since the provided samples are based on the Intel Media SDK decode/encode samples where video stream processing is in focus, the integration of FFmpeg container handling and audio processing may seem somewhat artificial. However, the samples should sufficiently illustrate the required Intel Media SDK and FFmpeg integration points making it quite straightforward to adapt to real-life applications, which would likely entail more sophisticated approaches such as threading, etc.
The provided samples illustrate the following use cases:
The audio encode part of the sample assumes input of raw PCM data as follows:
You can generate raw PCM audio input file by demuxing a 2 channel @ 44100Hz audio stream using the provided decode sample. The encode sample can also easily be modified to support other audio input configurations. You can use such tools as "Audacity" to convert to/from different raw formats.
The current set of samples were tested and integrated using build "2012-08-27" of FFmpeg from: http://ffmpeg.zeranoe.com/builds/
Please understand that this set of samples provides a snapshot of FFmpeg integration. The FFmpeg interfaces may change at any time, thus requiring modifications to the integration code.
Folder | Content | Notes |
---|---|---|
sample_decode – ffmpeg |
- sample_decode.sln - include - src |
Contains decode/demux sample project. FFMPEGReader class located in pipeline_decode.h/cpp |
sample_encode – ffmpeg |
- sample_encode.sln - include - src |
Contains encode/mux sample project. FFMPEGWriter class located in pipeline_encode.h/cpp |
ffmpeg |
- include - lib_win32 - lib_x64 |
Contains FFmpeg component include files and pre-built binaries. See below "Requirements" section for details |
sample_common |
- include - src |
Contains common Intel® Media SDK sample code functionality (this is a copy of the Intel Media SDK 2012 R3 sample_common folder) |
Intel Media SDK
The sample projects depend on Intel Media SDK API include files and dispatcher library. To be able to build the provided sample code, Intel Media SDK must be installed.
For more details about the Intel Media SDK samples, and SDK specific requirements or limitations, please refer to documentation and manuals of the SDK package.
FFmpeg
The provided sample projects do not include FFmpeg include and binary files. To be able to build the projects the required FFmpeg files for Windows* must therefore be downloaded from http://ffmpeg.zeranoe.com/builds/ (other Windows builds of FFmpeg also exists, but these have not been verified with this integration code)
Download the following packages:
From the above packages:
Note: "<arch>" is either win32 or x64.
msinttypes
The folder "ffmpeg/include/msinttypes-r26" contains parameter type bridge required to be able to build FFmpeg project in Microsoft Visual Studio.
Download the required include files from http://code.google.com/p/msinttypes/
Note: The solution/projects were created using Microsoft Visual Studio* 2010, but there is nothing preventing the environment to be back-ported to older versions of Visual Studio, if needed.
Below are some example command line workloads.
sample_decode.exe h264 –i file.mp4 -hw -d3d -split –o video.yuv
sample_decode.exe mpeg2 –i file.mpg -hw -d3d -split –o video.yuv
sample_encode.exe h264 -i video.yuv -w 640 -h 480 -o out.mp4 -hw -d3d -mux -b 1000 -f 30
sample_encode.exe mpeg2 -i video.yuv -w 640 -h 480 -o out.mpg -hw -d3d -mux -b 1000 -f 30
sample_encode.exe h264 -i video.yuv -w 640 -h 480 -o out.mkv -hw -d3d -mkv -b 1000 -f 30
- MPEG2 muxing results in "buffer underflow" warning. However, the warning does not seem to impact the content or validity of the resulting mpeg container.
附件 | 尺寸 |
---|---|
msdk-ffmpeg-white-paper.pdf | 567.6 KB |
性能因用途、配置和其他因素而异。请访问 www.Intel.com/PerformanceIndex 了解更多信息。