(转)Integrating Intel® Media SDK with FFmpeg for mux/demuxing and audio encode/decode usages 1
Download Article and Source Code
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)
Introduction
The provided samples intend to illustrate how Intel® Media 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 2012 R3 samples (http://software.intel.com/en-us/articles/vcsource-tools-media-sdk/) 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 orENCODE_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:
- Demux “mp4″ container file containing AVC(H.264) video stream and any FFmpeg supported audio stream. Decode the AVC(H.264) video stream and audio stream.
(using “-split” option) - Encode to AVC(H.264) video stream and AAC audio stream. Mux streams into “mp4″ container.
(using “-mux” option) - Demux “mpeg” container file containing MPEG-2 video stream and any FFmpeg supported audio stream. Decode the MPEG-2 video stream and audio stream.
(using “-split” option) - Encode to MPEG-2 video stream and MPEG audio stream. Mux streams into “mpeg” container.
(using “-mux” option) - Encode to AVC(H.264) or MPEG-2 video stream and Ogg Vorbis audio stream. Mux streams into “mkv” container (Matroska).
(using “-mkv” option)
The audio encode part of the sample assumes input of raw PCM data as follows:
- Using “mp4″ or “mpeg” container: 16-bit signed integer samples, 2 channels
- Using “mkv” container: 32-bit float samples, 2 channels
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.
Project file structure
| 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) |
Requirements
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 2012 R2 or later must be installed. The SDK can be found here: http://software.intel.com/en-us/articles/vcsource-tools-media-sdk/
For more details about the Intel Media SDK samples, and Media 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:
- “<build_id>-<arch>-dev.7z” archive file (from “<arch>-bit Builds (Dev)” section on the webpage)
- “<build_id>-<arch>-shared.7z” archive file (from “<arch>-bit Builds (Shared)” section on the webpage)
From the above packages:
- Copy content of “include” folder in (1) to “ffmpeg/include” folder
- Copy *.lib content of “lib” folder in (1) to “ffmpeg/lib_<arch>” folder
- Copy *.dll content of “bin” folder in (2) to “ffmpeg/lib_<arch>” folder
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.
How to build
- Open the solution (“.sln”) file in either “sample_decode – ffmpeg” or “sample_encode – ffmpeg” folder
- Select desired build configuration: Debug/Release, Win32/x64
- Build the solution
How to execute workloads
Below are some example command line workloads.
- Demux mp4 container and decode the AVC(H.264) video stream. If the container includes audio stream, it will be decoded into “audio.dat” (assuming sample has been built with “DECODE_AUDIO”)
1<b>sample_decode.exe h264 –i file.mp4 -hw -d3d -split –o video.yuv</b>
- Demux mpeg container and decode the MPEG-2 video stream. If the container includes audio stream, it will be decoded into “audio.dat” (assuming the sample was built with “DECODE_AUDIO”)
1<b>sample_decode.exe mpeg2 –i file.mpg -hw -d3d -split –o video.yuv</b>
- Encode raw YUV video data into AVC(H.264) video stream. Mux into mp4 container. If the sample was built with “ENCODE_AUDIO” the audio will be encoded using AAC encoder (raw audio PCM data read from file “audio.dat”).
1<b>sample_encode.exe h264 -i video.yuv -w 640 -h 480 -o out.mp4 -hw -d3d -mux -b 1000 -f 30</b>
- Encode raw YUV video data into MPEG-2 video stream. Mux into mpeg container. If the sample was built with “ENCODE_AUDIO” the audio will be encoded using mpeg encoder (raw audio PCM data read from file “audio.dat”).
1<b>sample_encode.exe mpeg2 -i video.yuv -w 640 -h 480 -o out.mpg -hw -d3d -mux -b 1000 -f 30</b>
- Encode raw YUV video data into the AVC(H.264) video stream. Mux into Matroska (mkv) container. If the sample was built with “ENCODE_AUDIO” the audio will be encoded using Ogg Vorbis encoder (raw audio PCM data read from file “audio.dat”).
1<b>sample_encode.exe h264 -i video.yuv -w 640 -h 480 -o out.mkv -hw -d3d -mkv -b 1000 -f 30</b>
Known issues
– MPEG2 muxing results in “buffer underflow” warning. However, the warning does not seem to impact the content or validity of the resulting mpeg container.
References
- Intel Media SDK
http://software.intel.com/en-us/articles/vcsource-tools-media-sdk/ - Intel Media SDK forum
http://software.intel.com/en-us/forums/intel-media-sdk/ - FFmpeg
http://ffmpeg.org/ - FFmpeg Windows builds
http://ffmpeg.zeranoe.com/builds/ - FFmpeg tutorial
http://www.codediesel.com/tutorial/ffmpeg-a-beginners-guide-part-1/
This post comes from: http://software.intel.com/en-us/articles/integrating-intel-media-sdk-with-ffmpeg-for-muxdemuxing-and-audio-encodedecode-usages
转自:http://rg4.net/archives/966.html
(转)Integrating Intel® Media SDK with FFmpeg for mux/demuxing and audio encode/decode usages 1的更多相关文章
- Intel® Media SDK Media Samples Linux 学习笔记(转)
最近折腾intel media sdk,主要硬件平台是在HD4600的核显上进行测试,intel media sdk是intel提供的一种基于核显的硬件编解码的解决方案,之前已经有使用ffmpeg进行 ...
- Intel Media SDK H264 encoder GOP setting
1 I帧,P帧,B帧,IDR帧,NAL单元 I frame:帧内编码帧,又称intra picture,I 帧通常是每个 GOP(MPEG 所使用的一种视频压缩技术)的第一个帧,经过适度地压缩,做为随 ...
- Getting Started with the Intel Media SDK
By Gael Hofemeier on March 19, 2015 Follow Gael on Twitter: @GaelHof Media SDK Developer’s Guide Med ...
- Intel® Media SDK(一)
A cross-platform API for developing media applications on Windows* Fast video playback, encode, proc ...
- Intel Media SDK安装步骤
!!!(gcc/g++版本要在4.8以上,本人使用的是5.4版本) 要先安装依赖,按以下步骤依次执行 1.LIBVA git clone https://github.com/intel/libva. ...
- Intel Media SDK 性能測试
经过測试,发如今windows 7上 i3 i5 上Intel Media SDK 1080P仅仅能解6路,720P仅仅能解8路, 不知大家有没有測试过?
- 微软商店一直安装不上Intel Media SDK DFP
具体表现为一直安装失败,但是下载进度条一直在,无法去除. 此方法来自 https://answers.microsoft.com/en-us/windows/forum/all/error-code- ...
- Intel® Media Server Studio Support
复制自网址:https://software.intel.com/en-us/intel-media-server-studio-support/code-samples Code Samples M ...
- How to run Media SDK samples on Skylake【转载】
In the last few days, we have seen lot of concern for using Intel® Media 2016 on 6th generation Inte ...
随机推荐
- 解密OpenTSDB的表存储优化【转】
https://yq.aliyun.com/articles/54785 摘要: 本篇文章会详细讲解OpenTSDB的表结构设计,在理解它的表结构设计的同时,分析其采取该设计的深层次原因以及优缺点.它 ...
- 【驱动】MTD子系统分析
MTD介绍 MTD,Memory Technology Device即内存技术设备 字符设备和块设备的区别在于前者只能被顺序读写,后者可以随机访问:同时,两者读写数据的基本单元不同. 字符设备,以字节 ...
- 【C/C++】程序如何来,编译全过程
概述 编译的目的是把人书写的高级语言代码翻译成目标程序的语言处理程序,编译用的程序(例如gcc)称为编译系统. 一个编译系统把一个源程序翻译成目标程序的工作过程分为5个阶段:词法分析.语法分析. ...
- 【Linux】linux下gzip的压缩/解压缩详解
Linux压缩保留源文件的方法: gzip –c filename > filename.gz Linux解压缩保留源文件的方法: gunzip –c filename.gz > file ...
- Android开发(四)——Android中的颜色
Android开发中关于资源文件的存储操作.对于Android资源也是非常重要的,主要包括文本字符串(strings).颜色(colors).数组(arrays).动画(anim).布局(layout ...
- 消息队列RabbitMQ基础知识详解
一: 什么是MQ? MQ全称为Message Queue, 消息队列(MQ)是一种应用程序对应用程序或者模块对模块的通信方法.MQ是消费-生产者模型的一个典型的代表,一端往消息队列中不断写入消息,而另 ...
- 3. 文本相似度计算-DSSM算法
1. 文本相似度计算-文本向量化 2. 文本相似度计算-距离的度量 3. 文本相似度计算-DSSM算法 4. 文本相似度计算-CNN-DSSM算法 1. 前言 最近在学习文本相似度的计算,前面两篇文章 ...
- Android 好用和常用的控件
好用的库 https://github.com/daimajia/AndroidSwipeLayout 拖动删除 https://github.com/bingoogolapple/BG ...
- Android 日历控件PickTime
最近做项目,需要设置用户的生日,所以做这样一个功能. 开始发觉自带的 DatePicker 很是不好用. 上代码: <DatePicker android:id="@+id/dpPic ...
- 将安卓手机短信导入到iPhone6 plus中
不越狱的情况下短信不能直接同步到iphone手机,视频.图片.联系人可以直接使用itools的手机搬家功能超方便从android到iphone中.短信得变通的处理才能导入. 工具: 安卓手机iPhon ...