Opened 10 years ago

Closed 10 years ago

#3699 closed enhancement (fixed)

Ability to use expressions using Drawtext to offset frame number without returning double

Reported by: synth Owned by:
Priority: wish Component: avfilter
Version: git-master Keywords: drawtext
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

We have a need for displaying exact frame numbers on generated media from ffmpeg. I work in VFX so our input frame sequences can start at any arbitrary number for reasons of preroll visualization, not rendering 3d elements in the handles of a shot or for frame ranges that start at 1001. Currently the only way I've seen for offsetting the drawtext is to do:

text='%{expr\:n+OFFSET}'

where OFFSET is the number used for -start_frame. Unfortunately this won't work for us because the return value from expr is a double like 1001.000000 and it doesn't seem there's a way to convert that to int or convert it to a value like %04d.

For us, adding this feature would be incredibly valuable since we rely on seeing frame numbers when reviewing media so that we can make notes on frames that have errors which is then relayed back to the artist.

Change History (3)

in reply to:  description ; comment:1 by Carl Eugen Hoyos, 10 years ago

Replying to synth:

Currently the only way I've seen for offsetting the drawtext is to do:

text='%{expr\:n+OFFSET}'

where OFFSET is the number used for -start_frame. Unfortunately this won't work for us because the return value from expr is a double like 1001.000000 and it doesn't seem there's a way to convert that to int or convert it to a value like %04d.

Did you consider providing a command line (including complete, uncut console output) that allows to reproduce this?

in reply to:  1 comment:2 by synth, 10 years ago

Replying to cehoyos:

Replying to synth:

Currently the only way I've seen for offsetting the drawtext is to do:

text='%{expr\:n+OFFSET}'

where OFFSET is the number used for -start_frame. Unfortunately this won't work for us because the return value from expr is a double like 1001.000000 and it doesn't seem there's a way to convert that to int or convert it to a value like %04d.

Did you consider providing a command line (including complete, uncut console output) that allows to reproduce this?


You can find the full command and output at: http://mellow.me/ffmpeg_debug/output.txt

The input frame range is 0050-0168

Last edited 10 years ago by synth (previous) (diff)

comment:3 by Stefano Sabatini, 10 years ago

Resolution: fixed
Status: newclosed

It is something like text='%{eif\:n+OFFSET}'

Since commit:

commit dec87454deb2f2a314f309cd6c1fa636503a70ae
Author: Andrey Utkin <andrey.krieger.utkin@gmail.com>
Date:   Fri Jul 4 12:16:16 2014 +0300

    lavfi/drawtext: add expansion function eif()
    
    It evaluates expression and outputs it as integer value, using specified
    format.
    
    Address trac ticket #3699.
    
    Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
Note: See TracTickets for help on using tickets.