Produce video from text and stream it over RTP

This forum is about all development around libVLC.
romix
New Cone
New Cone
Posts: 1
Joined: 10 Oct 2012 22:48

Produce video from text and stream it over RTP

Postby romix » 10 Oct 2012 23:12

Hi,

I have a task with the following conditions:
- I get a new piece of text (e.g. a few sentences or a paragraph. something like a tweet or a header from an rss-feed) every 2-3 seconds
- I need to produce from this text a H264 encoded video displaying this text. The video should have a given resolution WxH
- This resulting video should be streamed over RTP
- Eventually, the resulting video should overlay another existing video (e.g. a movie) and then streamed over RTP
- If possible, the whole thing should be implemented in Java

When I first faced this task, I realized that producing H264 is one of the most difficult parts and VLC can do it for me. If I need to use Java, I can use the vlcj bindings for libVLC.

But how can I produce a video from a text?

My first attempt was to produce an image file from a text, e.g. a JPG file. And then I can tell VLC to stream this image using H264 over RTP. It even seems to work, but is a bit slow. It is slow because for each new piece of text I produce a new image and when I tell libVLC to encode H264 and then stream this image it usually takes 2-4 seconds before it really starts streaming.

The second idea I had is to use direct rendering. I thought that I could intercept every frame of a simple background video (e.g. only white background), draw a text in the framebuffer, update the frame and then let the rest of the pipeline do its job, i.e. encode this frame using H264 and then send it over RTP. But this does not work quite as expected. If I enable H264 transcoding and RTP in the sout pipeline, my direct rendering callback is not invoked at all for some reason (is it normal?). And if I do not enable transcoding and RTP in the sout pipeline, then my callback is invoked, but no H264 output is produce and streamed.

Yet another idea is that this task is somehow similar to (dynamic) subtitles, or? But in my case I need subtitles to become a part of a video being streamed, i.e. they need to be overlayed by the server instead of being rendered by the client. But I'm not sure if libVLC supports something like this...

At the moment I don't know how to proceed further. I'm very new to libVLC and don't really know what is possible and what's not.

I'm not sure if my idea with direct rendering is valid at all when used together with streaming. May be it would only work if I render the video locally?
And may be there are also easier ways to produce video from a text using libVLC?


And suggestions and comments are very welcome!

Thanks,
romix

Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 53 guests