-
Notifications
You must be signed in to change notification settings - Fork 19
Home
Intel Quick Sync Video refers to the dedicated media processing capabilities of Intel Processor Graphics Technology. The searchable processor specification list at http://ark.intel.com is the authoritative site for intel processor capabilities. Intel Media Server Studio(aslo named intel MSS, https://software.intel.com/en-us/intel-media-server-studio/details) used with the latest Intel® platforms enables development of awe-inspiring and visually enriching media solutions and readies the industry for these challenges. QSV transcode acceleration on Linux systems are enabled from FFMPEG 2.8 and forward.
With this repo, you can get the following benefits:
- Older version support, for example: 2.6.3, 2.8.1, 3.2.2,3.3.1, 3.4.1
- Performance tuning;
- Enabled more QSV features: HW Video processing acceleration (vpp filters), mjpeg_qsv, etc.
- Support QSV features continuously along with the development of Intel Processor Graphics Technology
MSS has recommended OS version and support specific hardware. Please refer media_server_studio_getting_started_guide.pdf in MSS release package. CentOS image can be got from http://archive.kernel.org/centos-vault/. For 2017 R3 MSS release, it is highly recommend CentOS 7.3.1611 and installed on SKL(KBL unsupported).
Get MSS from https://software.intel.com/en-us/intel-media-server-studio
Install MSS referring to the documentation in the installation package
Following https://trac.ffmpeg.org/wiki/CompilationGuide/Centos to get the dependencies.
mkdir /opt/intel/mediasdk/include/mfx
cp /opt/intel/mediasdk/include/*.h /opt/intel/mediasdk/include/mfx
Same search rules apply as for other pkg-config configurations. A good place to start is the same directory as an already searchable config like libdrm.pc, but the PKG_CONFIG_PATH environment variable can be used to customize the search path (export PKG_CONFIG_PATH= $location:$PKG_CONFIG_PATH, replace the "$location" with the path of libmfx.pc).
libmfx.pc example:
prefix=/opt/intel/mediasdk
exec_prefix=/opt/intel/mediasdk/
libdir=${prefix}/lib/lin_x64/
includedir=${prefix}/include/
Name: libmfx
Description: mfx
Version: 1.0.0
Cflags: -I${includedir}
Libs: -L${libdir} -lmfx -ldl -lstdc++ -lrt -lva -lva-drm
Libs.private: -lstdc++ -ldl
Get FFMPEG source code. To get full features of QSV, you can check out the following branches in this repo: qsv-2.6.3, qsv-2.8.1, qsv-3.2.2
Example: get qsv-3.2.2 code
git clone https://github.com/Intel-FFmpeg-Plugin/Intel_FFmpeg_plugins.git
git checkout origin/qsv-3.2.2 –b 3.2.2
Configure FFMPEG with "--enable-libmfx" to enable QSV when building FFMPEG; for example:
#./configure --enable-libmfx
#make -j4
#sudo make install
Please mail to secure-opensource@intel.com directly for security issue
FFmpeg command for qsv accelerator has some difference with FFmpeg 3.x after hwcontext is introduced. The following are some examples
Example 1:
ffmpeg –c:v h264_qsv –i input.file –b:v 2M -preset veryfast –c:v h264_qsv out.file
Example 2:
ffmpeg -vcodec h264_qsv -i input.file -vcodec h264_qsv -vb 550k -acodec copy -vf "movie=04.png[wm];[0:v][wm]vpp=framerate=23:w=960:h=540:overlay_type=1:overlay_pixel_alpha=1:overlay_x=main_w*0.975-overlay_w:overlay_y=main_h*0.025:overlay_w=96:overlay_h=27" -force_key_frames "expr:gte(t,n_forced*3)" -f flv -vframes 1000 -y out.file
Example 1:
ffmpeg -hwaccel qsv -c:v h264_qsv -i input.file -b:v 2M -preset veryfast -c:v h264_qsv out.file
Example 2:
ffmpeg -hwaccel qsv -c:v h264_qsv -i input.file -c:v h264_qsv -vb 550k -c:a copy -vf "vpp_qsv=framerate=23:w=960:h=540[v];movie=04.png,hwupload,format=qsv[wm];[v][wm]overlay_qsv=x=W*0.975-overlay_iw:y=H*0.025:w=96:h=27" -f flv -vframes 1000 -y out.file
For ffmpeg-3.4.1, if the "-hwaccel qsv" option is unset, must add option "-init_hw_device" and "-filter_hw_device" (if qsv vpp is used) to init hardware device, else ffmpeg will report an error: "No hw context provided."
Example 1:
ffmpeg -f rawvideo -pix_fmt yuv420p -video_size widthxheight -i in_widthxheight.yuv -init_hw_device qsv=foo -filter_hw_device foo -vf vpp_qsv=denoise=20 -f rawvideo -y out.yuv
Example 2:
ffmpeg -y -i in.mp4 -init_hw_device qsv=foo -filter_hw_device foo -an -vcodec h264_qsv -preset slow -profile:v high -level:v 31 -g 72 -aspect 16/9 -look_ahead 1 -look_ahead_depth 30 -b:v 2000000 -vsync 1 -r 24.000000 -vf '[main]vpp_qsv=w=1280:h=720[out]' out.mp4