Opened 5 years ago

Closed 5 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)

comment:1 in reply to: ↑ description ; follow-up: Changed 5 years ago by 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?

comment:2 in reply to: ↑ 1 Changed 5 years ago by synth

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 5 years ago by synth (previous) (diff)

comment:3 Changed 5 years ago by saste

  • Resolution set to fixed
  • Status changed from new to closed

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.