[FFmpeg-user] Overlay Filter: eval n value

Joshua Ostrom josh at optionmarketmentor.com
Thu Jun 27 02:44:25 CEST 2013


Thanks, the -loglevel debug gives some clues:

Stream mapping:
  Stream #0:0 (h264) -> overlay:main (graph 0)
  Stream #1:0 (png) -> overlay:overlay (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (aac -> libfaac)
Press [q] to stop, [?] for help
[aac @ 0x2a13360] skip whole frame, skip left: 0
[Parsed_overlay_0 @ 0x2a27860] Copying data in avfilter.
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:04.73 bitrate=   0.1kbits/s    
frame=    0 fps=0.0 q=0.0 size=       0kB time=00:00:04.73 bitrate=   0.1kbits/s    
n:1.000000 t:4.343975 pos:22723.000000 x:0.000000 xi:0 y:0.000000 yi:0
*** 55 dup!
[libx264 @ 0x2a4e0c0] frame=   0 QP=22.41 NAL=3 Slice:I Poc:0   I:1900 P:0    SKIP:0    size=44772 bytes
[libx264 @ 0x2a4e0c0] frame=   1 QP=23.76 NAL=2 Slice:P Poc:2   I:15   P:95   SKIP:1790 size=643 bytes

[libx264 @ 0x2a4e0c0] frame=   2 QP=23.28 NAL=2 Slice:P Poc:4   I:3    P:29   SKIP:1868 size=124 bytes
frame=   56 fps= 33 q=47.0 size=      46kB time=00:00:04.73 bitrate=  78.9kbits/s dup=55 drop=0    
Copying data in avfilter.
[Parsed_overlay_0 @ 0x2a27860] n:2.000000 t:4.420898 pos:76070.000000 x:0.000000 xi:0 y:0.000000 yi:0

[libx264 @ 0x2a4e0c0] frame=   3 QP=24.00 NAL=2 Slice:P Poc:6   I:3    P:5    SKIP:1892 size=40 bytes
[Parsed_overlay_0 @ 0x2a27860] Copying data in avfilter.
[Parsed_overlay_0 @ 0x2a27860] n:3.000000 t:4.497822 pos:84586.000000 x:0.000000 xi:0 y:0.000000 yi:0

[libx264 @ 0x2a4e0c0] frame=   4 QP=24.00 NAL=2 Slice:P Poc:8   I:2    P:0    SKIP:1898 size=23 bytes
[AVIOContext @ 0x2a30a60] Statistics: 40820 bytes read, 0 seeks
[Parsed_overlay_0 @ 0x2a27860] Copying data in avfilter.
[AVIOContext @ 0x2a27c60] Statistics: 40820 bytes read, 0 seeks
[Parsed_overlay_0 @ 0x2a27860] n:4.000000 t:4.574745 pos:87867.000000 x:0.000000 xi:0 y:0.000000 yi:0

[libx264 @ 0x2a4e0c0] frame=   5 QP=24.00 NAL=2 Slice:P Poc:10  I:2    P:0    SKIP:1898 size=24 bytes
[AVIOContext @ 0x2a27c60] Statistics: 40820 bytes read, 0 seeks
[Parsed_overlay_0 @ 0x2a27860] Copying data in avfilter.
[AVIOContext @ 0x2a5daa0] Statistics: 40820 bytes read, 0 seeks
[Parsed_overlay_0 @ 0x2a27860] n:5.000000 t:4.651668 pos:90889.000000 x:0.000000 xi:0 y:0.000000 yi:0

[libx264 @ 0x2a4e0c0] frame=   6 QP=24.00 NAL=2 Slice:P Poc:12  I:2    P:0    SKIP:1898 size=24 bytes
[AVIOContext @ 0x2a4c0a0] Statistics: 40820 bytes read, 0 seeks
[Parsed_overlay_0 @ 0x2a27860] Copying data in avfilter.
[AVIOContext @ 0x2a55840] Statistics: 40820 bytes read, 0 seeks
[Parsed_overlay_0 @ 0x2a27860] n:6.000000 t:4.728591 pos:93715.000000 x:0.000000 xi:0 y:0.000000 yi:0

[libx264 @ 0x2a4e0c0] frame=   7 QP=24.00 NAL=2 Slice:P Poc:14  I:2    P:0    SKIP:1898 size=24 bytes
[AVIOContext @ 0x6a93da0] Statistics: 40820 bytes read, 0 seeks
[Parsed_overlay_0 @ 0x2a27860] Copying data in avfilter.
[AVIOContext @ 0x2a559a0] Statistics: 40820 bytes read, 0 seeks
[Parsed_overlay_0 @ 0x2a27860] n:7.000000 t:4.805514 pos:96262.000000 x:0.000000 xi:0 y:0.000000 yi:0

… continues on for all frames

So frame 1 (n:1.000000 )  is already at t:4.343975 seconds if I"m reading that correctly.  I assume that's related to the 55 dup message nearby.


If I enable the overlay I *have* to use a value greater than 4.3

No overlay shown at all
-filter_complex overlay=enable='between(t\,1\,4.3)' \

Overlay shown for the first 4.4 seconds then removed
-filter_complex overlay=enable='between(t\,1\,4.4)' \


Is there anyway to process (ffmpeg options etc) this so that I can either move the graphic or just disable (I prefer move as it looks a little more appealing) *before* that 4.4 second mark?

Thanks




On Jun 26, 2013, at 7:08 PM, Stefano Sabatini <stefasab at gmail.com> wrote:

> On date Wednesday 2013-06-26 16:57:28 -0400, Joshua Ostrom wrote:
>> I'm using the overlay filter to simply show a graphic a remove it x frames later.
>> 
>> ffmpeg -y -i myvido.mp4 \
>> -loop 1 -i mygraphic.png \
>> -filter_complex overlay=x=0:y='if(gte(n\,26)\,(n-26)*600\,0)' \
>> myoutput.mp4
>> 
>> My understanding is that with the default of 'frame' for eval 'n'
>> should be the frame number (from the input stream).
>> 
>> The input video has a frame rate of 13, so I assumed 26 would be ~ 2
>> seconds into the video (26 / 13 = 2) however the output hows the
>> graphic moving away at about 6 seconds (not 2).  If I reduce the
>> check to 13 the graphic moves away after about 5 seconds.
>> 
>> Why doesn't n seem to match up with the expected frame *number* (why
>> am I seeing the graphic move away after 6 seconds and not two
>> seconds)?
> 
> -loglevel debug should help you to debug it.
> 
>> I've tried using t as that would be most convenient, however the
>> graphic is initially offset by 600(I assume because it's getting a
>> NAN value initially that's not properly handled [bug])
> 
> Show the command. Keep in mind that if the PTS is not defined, t is
> set to NAN, you can check those cases with isnan(t).
> 
> Also for enabling/disabling you should use the "enable" option (check
> the Timeline section in man ffmpeg-filters).
> -- 
> FFmpeg = Fast and Forgiving Multipurpose Patchable Egregious Gem
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user




More information about the ffmpeg-user mailing list