Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

Writing Text in YUV frame

Ramashankar
New Contributor III
984 Views

Hi,

I want to write some text (like subtitles) in yuv frames. Unlike the subtitles, the text data must become the part of video frame itself. So does IPP or Media SDK provide any lib/APIs to perform this operation?

For the time being, I have an alternative solution where first I encode the YUV frame into jpg, then by using some Microsoft APIs I merge the text data into jpg image, and then decode this final jpg image again to get YUV.

Though this approach is working fine from output point of view but it is consuming unnecessary of CPU and memory. So I am looking for any approach where I can write the text string directly into YUV frame.

Any suggestions? 

 

0 Kudos
4 Replies
Petter_L_Intel
Employee
984 Views

Hi Ramashankar,

Intel Media SDK unfortunately does not provide such feature. You will have to find a third party solution for this or use for instance DirectX to compose a texture in which you can overlay text then extract surface for use with Media SDK.

On a side note. Linux Media SDK does have some new features allowing frame compositing, but no capabilities to insert text into frame.

Regards,
Petter

0 Kudos
Ramashankar
New Contributor III
984 Views

Hi Petter,

Thanks for your reply. I understood your points.

I feel that using DirectX to compose texture, then Overlaying text and then extraction of surface may also take more time and CPU. It might be same in performance as our current approach (encode to Jpeg using IMSDK, merge text using Micorsoft API, then decode the Jpeg using IMSDK).

What do you think?

On more query: In our current approach, we are observing that most of CPU is being consumed only in merging of Text in Jpeg using Microsoft APIs. So Does Intel Media SDK provide any similar option of merging text in Jpeg?

~

Ramashankar

0 Kudos
OTorg
New Contributor III
984 Views

> encode to Jpeg using IMSDK, merge text using Micorsoft API, then decode the Jpeg using IMSDK

I want to offer you two other techniques, with higher performance and less quality loss.

1. YUV -> RGB -> attach (without copying!) to gdiplus engine, draw text with it's means, detach -> YUV

2. Draw text with any engine, that supports alpha-channel output (text frame can be smaller than YUV-target) -> convert to ~AYUV, if need -> apply alpha blending straight on YUV color space to mix frames.

 

0 Kudos
Petter_L_Intel
Employee
984 Views

Thanks for your insight dj_alek.

Ramashankar: Intel Media SDK does not have any support for inserting text into JPEG.

Regards,
Petter

0 Kudos
Reply