[FFmpeg-user] How add expression in drawtext's text

qw applemax82 at 163.com
Tue Jun 5 05:03:52 EEST 2018


wangqiang10 at jd.com


| |
qw
邮箱:applemax82 at 163.com
|

签名由 网易邮箱大师 定制

在2018年06月05日 06:18,DopeLabs 写道:
i think this is what your looking for...

this will pad 0's to the left to achieve a 5 digit number

please note the level of escaping you need depends on your environment


text='%{eif\\:n+1\\:d\\:5}'



> On Jun 3, 2018, at 8:54 46PM, qw <applemax82 at 163.com> wrote:
>
> Hi,
>
>
> I can use the following command to add frame number on video:
>
>
> /usr/local/bin/ffmpeg -t 180 -i input.mp4 -acodec libfdk_aac -ac 2 -b:a 48k -vcodec libx264 -b:v 500k -g 25 \
> -vf "fps=fps=25, scale=w=320:h=240, drawtext='box=1:fontcolor=red:fontsize=20:fontfile=OpenSans-Regular.ttf:text=%{frame_num}'" \
> -f mp4 out.mp4
>
>
> But the width of the text box will increase as frame number increases. I want to make the width of the text box unchanged. If the largest frame number is 99999, I want to make the width of the text is of 5 numbers. How to do it?
>
>
>
>
> Another question:
>
>
> I want to make the following logic for text:
>
>
> if frame number < 10
>    text=0000%{frame_num}
> else if frame number < 100
>    text=000%{frame_num}
> else if frame number < 1000
>    text=00%{frame_num}
> else if frame number < 10000
>    text=0%{frame_num}
> else
>    text=%{frame_num}
>
>
> How to do it? How can I add expression in text? Is there any command example?
>
>
> Thanks
>
> regards
>
> andrew
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list