[vlc-devel] Why is my subpicture getting displayed for more time than specified?

Peter Tap ptrtap at yahoo.com
Tue Apr 24 00:47:01 CEST 2012


Folks,

I have developed a video filter module. The idea is to display some text at random location while a movie is playing. This is our idea of watermarking. However, the text has to be displayed only for a fraction of a second so that it is not visible to the naked eye but would be captured by camera or by screen recording applications. Assuming there are 24 frames per second, the duration to display the text would be (1000*1000/24) ns. 


VLC calls my "Filter" routine at regular time intervals. Here is the pseudo logic for my function:

1. timeOut = 1000 * 1000 / 24

2. If (currentTime < (lastTimeOfSubpicture + timeOut)) then simply return. The last subpicture would continue to display.
3. Create new subpicture and set the values:


    p_spu->p_region->i_x = x;
    p_spu->p_region->i_y = y;
    p_spu->p_region->psz_text = psz_text;
    p_spu->i_start = date;
    p_spu->i_stop  = date + timeOut;
    p_spu->b_ephemer = false;
    p_spu->b_fade = false;
    p_spu->b_subtitle = true;

The logic works in the sense that the text is created at a random location on screen. However, I can see the logo momentarily on the screen. Given my timeout value, I would think I should not see it. 


I tried playing with the timeout value between 5000ns and 10000ns. When it is a smaller value, I don't see anything. However, screen recording also does not show the text either.

I debugged through vlc/src/video_output/video_output.c and vout_subpictures.c but could not figure out why the text subpicture gets displayed for a longer time. I would appreciate it if someone can please help me.

Thank you in advance for your help.

Regards,
Peter



More information about the vlc-devel mailing list