How to create video wall with Intel® Media SDK sample_multi_transcode

ID 671661
Updated 11/3/2017
Version Latest




Intel® Media SDK is a powerful toolkit to use the hardware video acceleration on graphic processor. It has 3 components decode, encode and video process; each component has rich features. They can be integrated together to create many video applications. This article describes how to use its sample—"sample_multi_transcode"—to input video clip(s) and compose them into a single video.

Operation Instructions

In this article, we will use "sample_multi_transcode" to generate four videos by input from the same video file and compose them to one video then render output video on the screen, as showed in the following screen capture:Merged video clips

We will use an 1080p raw video file as input, each video will shrink half both vertical and horizontal directions so that 4 videos will be composed into one 1080p video. The input videos are independent from each other, so they can be the same file or different files.

Prepare the input video

Media SDK sample requires the input video file with a format of Elementary Stream which you can extract from a standard media container with the tool like FFmpeg. You can download the online free video to extract it, for example, download a video from Big Buck Bunny.

For example, to extract a H.264 ES stream from a media container file, you can use following FFmpeg command:

ffmpeg -i <input.file> -vcodec copy -an -f h 264 -bsf h264_mp4toannexb <video_only.264>

In this article, we use a video with resolution of 1920x1080 and the codec of H.264. You can use the other video content with different resolution but the correspond parameters must be changed.

Download and install Intel® Media SDK samples

There are several ways to install samples, if you installed Media SDK binary release; you can install binary sample package by downloading  from /content/www/us/en/develop/tools/media-sdk/code-samples.html. For Windows OS, you can install from *.msi file; for Linux, you can unzip the sample package. If you choose to use Open Source Media SDK, you can refer its wiki page to build samples.

Except the open source code which you have to build whole Media SDK binary including samples, the installation should have pre-built binary with a simple video content ready to run. The video content is in directory <sample root>/_bin/content, the pre-build sample binary is in directory <sample root>/_bin/x64.


Create par file for sample_multi_transcode for video wall

"sample_multi_transcode" can accept a parameter file in case of complicated parameters, this is a good feature since you don't have to remember and type many parameters for each execution.

Here is the par file content, you can copy and paste to a text file and replace <1080p h264 ES file x> with the actual file you prepared; in this case, the file is assumed in the same directory as the sample_multi_transcode execution file.

-i::h264 <1080p h264 ES file 1> -vpp_comp_dst_x 0 -vpp_comp_dst_y 0 -vpp_comp_dst_w 960 -vpp_comp_dst_h 540 -join -o::sink
-i::h264 <1080p h264 ES file 2> -vpp_comp_dst_x 960 -vpp_comp_dst_y 0 -vpp_comp_dst_w 960 -vpp_comp_dst_h 540 -join -o::sink
-i::h264 <1080p h264 ES file 3> -vpp_comp_dst_x 0 -vpp_comp_dst_y 540 -vpp_comp_dst_w 960 -vpp_comp_dst_h 540 -join -o::sink
-i::h264 <1080p h264 ES file 4> -vpp_comp_dst_x 960 -vpp_comp_dst_y 540 -vpp_comp_dst_w 960 -vpp_comp_dst_h 540 -join -o::sink
-vpp_comp_only 4 -join -i::source

Run the par file

Run the par file with following command under different platform.

sample_multi_trancode.exe -par <par file name>
sample_multi_transcode -par <par file name>

Parameters usage in sample_multi_transcode

  • -o::sink: Output of this session serves as input for all sessions using the -i::source.
  • -i::source: The session receives the output of the session using the -o::sink option at input.
  • -join: Join the session to another session.
  • -vpp_comp_dst_x/y: the position where the left upper corner of the video starts rendering, this position is a coordination relative to the upper left corner of the screen. The coordinations in this par file assume input 1080p video downscaled 1/4.
  • -vpp_comp_dst_w/h: the output resolution of the video, we have to shrink the input resolution in order to fit.
  • -vpp_comp_only: force the output stream to render on screen.

About the coordination

In this article, the resolution of input video is 1080p, the resolution will be downscaled 1/4 in area, so the coordination of 4 video positions are,

(0,0), (960, 0), (0, 540), (960, 540)

If you want to use the test video clips in <sample root>/_bin/content, its resolution is 176x96; then you can ignore parameters "-vpp_comp_dst_w/h" and coordination will be,

(0,0), (176, 0), (0, 96), (176, 96)

The output resolution will be 352x182 and this resolution is good enough to fit most computer screen.

Next step

The current par file setting allows it to run as faster as the system can handle; so you can observe the video rendering faster than normal video. To force the rendering at the normal speed, like 30 FPS, you can add "-fps 30" at the end of the last line in the par file.

"sample_multi_transcode" has a lot of cool features, it can be used to check a lot of usages of Media SDK. To learn more about its parameter, checkout this document.