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

Peter Tap ptrtap at yahoo.com
Tue Apr 24 18:49:34 CEST 2012


Thank you very much for your help.

So my basic assumption that a picture that is displayed for just one or two frames within a second will not be visible to naked eye was flawed:-(.


----- Original Message -----
From: Laurent Aimar <fenrir at elivagar.org>
To: Mailing list for VLC media player developers <vlc-devel at videolan.org>
Sent: Tuesday, April 24, 2012 1:45 AM
Subject: Re: [vlc-devel] Why is my subpicture getting displayed for more time than specified?

On Mon, Apr 23, 2012 at 03:47:01PM -0700, Peter Tap wrote:
> 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.
With VLC, a subpicture will always be displayed for a duration that is a
multiple of the associated video frame duration. For a movie at 24 fps, it
means a duration that is a multiple of 41.6ms. Also, I think (but I am unsure)
that if your start time is not equal to the pts of a video frame, the subpicture
may be displayed over 2 video frames.

I think that a text displayed for such a duration ( 1 or 2 * 41.6ms) will be
visible to the naked eye (I don't mean that someone will be able to read it,
but will be able to notice that something was displayed).


vlc-devel mailing list
To unsubscribe or modify your subscription options:

More information about the vlc-devel mailing list