
Recoding Video from Intel Quick Sync Video - Make It Fast

Four times faster than today's top-end solutions from NVidia and AMD. What is it? "The Secret Weapon of Sandy Bridge: Quick Sync." That's what Tom's hardware article called last year . "Why Quick Sync is Intel's secret weapon" - and this is already a techradar publication . In fact, there is nothing secret in the Intel Quick Sync Video (Intel QSV) technology, but most unfortunately do not have full clarity what it is, where it is, and, most importantly, how to use it effectively. It will be difficult to answer these questions not only a simple user, but even almost any Intel employee,
In the Russian spelling, the abbreviation Intel QSV looks like “IKSV”, which brings even more suspense - “X”, and even “in”? Therefore (and not only therefore) the name is better to simply translate.
The full translation is “Fast Video Sync.” What is a "video" - you probably know yourself. "Synchronization" is the ability to convert video from the original "desktop", i.e. high-resolution formats, to formats supported by mobile devices and video hosting. Although, this is far from the only possible use of QSV.
The adjective “fast” here reflects the fact that, according to all independent transcoding tests, QSV video significantly, at times, beats not only software coding on the CPU, but also on the hi-end GPU!
Intel Quick Sync Video Is a marketing term for hardware decoding and encoding of video content in H.264 / MPEG-4 AVC, VC-1 and MPEG-2 formats (so far only decoding), implemented in Intel integrated GPUs - from ultrabooks to servers, starting from the second Generations of Core (Sandy Bridge) microarchitecture.
That is, you can transcode video from DVD or Blu-ray.
In addition to general-purpose executive devices (Execution Units or simply EU), Intel’s built-in GPUs have a special hardware module, Multi-Format Codec Engine (MFX), which implements video decoding and encoding:

Such a fixed hardware solution not only speeds up video processing, but also unloads CPU, and also reduces the power consumption of the system.
At the same time, decoding is entirely carried out in the mentioned hardware module,
and encoding takes place in two stages: one on the GPU actuators, the second on the hardware.
The slide from the presentation at the Intel Developer Forum shows which coding stages are done where. I emphasize once again that everything happens on the GPU, i.e. in hardware, and “Hybrid HW / SW solution” means only the fact of using programmable EU GPU units.

It should be noted that these two stages of coding are well conveyed, i.e. while the MFX handles one frame in hardware, the
EUs that have completed their part of this frame already process the next one to transfer it to the hardware,
which naturally increases the overall system performance.
In the Ivy Bridge processors, that is, in the second version of Quick Sync, the Sandy Bridge hardware modules have been improved - encoding speed and quality have been improved, support for ultra-high resolutions up to 4K Video has been added. The system is even capable of decoding multiple Quad HD video streams simultaneously.
Find another appropriate monitor ....
There were no tests for working with such a QuadHD resolution, but the usual tests showing the speed of Quick Sync are more than enough for statistics.
For example, last year's experience vilianov Happy with Quick Sync .
And here is relatively recent information - Anandtech reviews the Intel Ivy Bridge (Core i7 3770K with HD Graphics 4000, Quick Sync of the second version) and compares the Blu-ray source transcoding speed on the iPad:

Measurement is in frames per second, and the QSV Ivy Bridge does not compare only with external GPUs, but also with the Core i7 2000K (Sandy Bridge with the first generation QuickSync - Intel HD Graphics 3000 on board), as well as Handbrake - an open source software solution that does not use QuickSync.
We also note that the advantage of QuickSync is especially noticeable when transcoding to low resolutions:

At the same time, the anecdote " prints at a speed of 1000 characters per minute, but this garbage turns out " is inappropriate here - the encoding quality, although slightly inferior to purely soft, but always wins, or in the worst case, it is on par with any other GPU coding. Pruflinks with a discussion of quality can be cited a lot (here is a good example in Russian), we just note that quality is almost always evaluated subjectively, “by eye”, and, moreover, it substantially depends on a specific coding program.
Access to QSV hardware video processing is provided through the Intel HD graphics driver, the interface to it is not public, primarily because it is unstable - it depends on the specific hardware and version of the driver. Although, a few small development companies, if necessary, by special agreement with Intel, gain access to the coveted API.
All other companies wishing to take advantage of Quick Sync Video can do this (and they do, of course) using a special SDK - Intel Media SDK , which provides a fixed interface for working with video. At the same time, automatically, "behind the scenes", MSDK uses all the capabilities of Intel hardware acceleration for each given system: Quick Sync, if available, otherwise - software libraries optimized for a specific CPU.
In general, the thing is great. Yes, and free ...
Therefore, in the list of companies using MSDK, you can find such well-known companies as MainConcept, Nero, Corel, CyberLink ...But, not all applications are equally useful, i.e. productive (you know, you can build different houses from the same bricks). Here is an interesting and useful performance comparison from the same vilianov - “ Faster to where ”
So, if you want your video to be transcoded just as quickly, then this requires:
1. The processor has an integrated GPU with Quick Sync support.
As already mentioned, the CPU should not be older than the second generation of Core (Sandy Bridge) microarchitecture.
In addition, its integrated graphics should also be of the second generation - starting withIntel HD Graphics 2000 . This is important because the initial Sandy Bridge models, sold under the Pentium brand name, feature Intel's unmistakable HD graphics, which doesn't support Quick Sync.
Today, support for Quick Sync for mobile and desktop computers is present in Intel HD Graphics 2000, 2500, 3000 and 4000, and for servers in the P3000 and P4000 models.
2. Support for GPU chipset (motherboard) .
In order for the GPU to transmit data to the south bridge of the motherboard - that is, ultimately, to the display port (DisplayPort), the chipset must support Flexible Display Interface (FDI) - a "bridge" between the GPU and the display. The current list of models of chipsets and CPUs with FDI support is in the corresponding article on wikipedia
By the way, this requirement is not specifically related to support for Quick Sync Video, but is simply a prerequisite for Intel HD Graphics to work in the system.
And of course, if the system uses an external graphics card that disables the integrated graphics of the CPU, it is generally impossible to use Quick Sync. Solutions to this problem for some cases:
- For laptops - use the ability to switch system graphics from external to internal (switchable graphics)
- For desktop computers - connect a second monitor to the integrated graphics port, allowing its use in the BIOS and making it primary.
- Use LucidLogix Virtu Graphic Virtualization Solution
3. Support by video driver.
QSV is currently supported by the Windows 7, Windows 8, and Mac OS Mountain Lion drivers.
It is also possible to install the appropriate Windows 7 drivers on Windows Server 2008 (with the Desktop Experience component installed).
Fresh drivers for Intel HD Graphics (by the way, not only for the systems mentioned above) can be found here .
To make sure that you have an up-to-date driver that correctly understands your hardware, check for the presence of a library like libmfxhw * .dll in the system . If it was found, for example, libmfxhw64-s1.dll in the case of a 64-bit system with a Sandy Bridge processor, everything is OK.
4. Support software.
An up-to-date list of Intel recommended commercial Windows applications using Quick Sync through MSDK is here .
There is also an open source application - Quick Sync Decoder , which uses Quick Sync decoding of H.264, MPEG2 and VC-1 video through the ffdshow filter.
OS X Mountain Lion QSVs support AirPlay Mirroring and QuickTime X.
Но, во-первых, приложений для обработки видео в природе имеется на порядок больше, чем в приведенном списке. И какие-то из них вполне могут использовать QSV, не сообщая об этом из скромности. А во-вторых, заявленная поддержка QSV и его реальное задействование вашей задачей – это две большие разницы. Во многих приложениях для активации QSV надо выставить галочку в совершенно неожиданном месте или поменять какую-то неочевидную настройку, которую, возможно, стоит поискать, если QSV почему-то не работает.
Все это приводит нас к задаче – проверить, было ли реально использовано аппаратное ускорение при обработке вашего видео.
Для приложений из вышеприведенного списка, а также тех, которые вы подозреваете в использовании Intel Media SDK (улики – использование приложением библиотеки libmfxsw*.dll) сделать это можно так:
- Download and install Intel Media SDK
- In folder "
\ tools \ mediasdk_tracer \ ”find and run the MSDK profiler - tracer.exe - We start logging with the Start button, start video processing in your experimental application, after a few seconds we stop logging by clicking Stop.
- In the log file specified in the Output File field, look for the lines
• MFXInit.impl = HARDWARE or MFXInit.impl = AUTO
• MFXInit.status = MFX_ERR_NONE
If they are found - everything is in order, QSV is used. Otherwise, no, or you were mistaken, and the application does not use MSDK.
In the latter case, another test performed by the iron will help dispel doubts:
- Download and install Intel Graphics Performance Analyzer (GPA)
- We launch the GPA Monitor, then right-click on the GPA Monitor icon in the system tray to open the context menu and select Media Performance in it: The
window that opens shows the loading of executive devices (EU) and hardware video processor (MFX) of the Intel GPU. - We start the video processing in your application, and in real time we look at the tables of use of the Intel GPU components. Or - we don’t look, but save this data in the log by pressing Capture. If the lines “decoding” (DECODING) and “encoding” (ENCODE) flash in the tables or logfile, as shown below, then QSV is used.
How complicated it is ... but not easier? Can. In all ultrabooks, Quick Sync Video works initially by definition, and using the free Intel MSDK, you can easily write an application that uses QSV by default.