FFmpeg/FFmpeg — pull request #24 by mjmvisser (2013-06-14 18:38:45+00:00)
Title: added start_number parameter to drawtext to permit an offset to n/frame_...

This was first opened here: https://github.com/FFmpeg/FFmpeg/pull/18

On the advice of ubitux, I reset the branch to upstream master and moved the patch to a branch, but forgot to withdraw the pull request. It was subsequently merged, but contained no commits.

I finally had a chance to revisit this patch with regards to ubitux's comments. n/frame_num is not a common filter variable, as implied by ubitux, but is local to the vf_drawtext filter. Making n/frame_num and start_number common to all filters would be a much bigger undertaking involving a lot of refactoring. Thus I'm resubmitting this patch as-is.

> In reference to https://ffmpeg.org/trac/ffmpeg/ticket/1949
>
> The suggested workaround to use `expr\\\:n+1` doesn't solve the problem, as the frame > number is drawn as a double (1.000000000) instead of as an integer.
>
> I followed the example set by the image2 format and added a start_number parameter. For example, the following draws the frame number at the bottom right, starting at 30:
>
> -vf drawtext="fontsize=15:fontfile=/path/to/font.ttf:text=%{n}:start_number=30:fontsize=25:fontcolor='white':x=w-text_w-line_h:\y=h-text_h-line_h"