Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

Adding border bands, padding instead of rescaling while transcoding

shavkat_n_
Beginner
411 Views

Doing video transcoding with different aspect ratio 

Input :

Codec Type          : Advanced Video Coding (H.264) (AVC1)
 Format Profile      : Main@L4.0
 CABAC               : Yes
 Image Size          : 1280 x 536 (160 : 67)
 Frame Rate          : 7200.00 Frame/Sec

Output:

 Codec Type          : Advanced Video Coding (H.264) (AVC1)
 Format Profile      : Baseline@L3.1
 CABAC               : No
 Image Size          : 1280 x 720 (16 : 9)
 Average Bit Rate    : 1.84 MBits/Sec
 Frame Rate          : 35.00 Frame/Sec

As you can see aspect is changed, and frame height is changed which is ok. But by default frame is scaled in height ( frame is unnaturally elongated in height, example: round face becomes oval face, ie: longer face), but need to keep original picture ratio but add border padding on top, bottom instead.

How can it be transcoded without rescaling/resizing picture but just adding border padding on top and bottom position?

Which parameters in Intel Media sdk needs to be changed ? 

I couldn't get meaningful info from mfxVideoParam. mfxFrameInfo has  AspectRatioW, AspectRatioH  & crop x,y,w,h. Do I have to use that?

Please provide steps, parameters...

 

 

 

0 Kudos
2 Replies
jimdempseyatthecove
Honored Contributor III
411 Views

Add 92 rows(lines) at the top and 92 at the bottom, each row(line) 1280. Choose whatever color you want.

IOW preallocate 720 lines of 1280, prefill top 92 and bottom 92 with color of choice, and either copy frames into buffer at 92*128, or use that as your input frame and avoid the copy.

Jim Demspey

0 Kudos
shavkat_n_
Beginner
411 Views

Thank you Jim

 

 

0 Kudos
Reply