Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Ramashankar
New Contributor III
254 Views

Writing Text in YUV frame

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
254 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

Ramashankar
New Contributor III
254 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

OTorg
New Contributor II
254 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.

 

Petter_L_Intel
Employee
254 Views

Thanks for your insight dj_alek.

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

Regards,
Petter

Reply