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.
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.
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?
> 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.