Reputation: 10400
Text overlay does not work if framenum 1..n
and timecode hh:mm:ss:frame
attributes are used together, how do overlay both running values?
Does not work, only timecode is incrementing and framenum is a as a text:
ffmpeg.exe -hide_banner -nostats ^
-i "video_25fps.mp4" -threads 4 -preset fast ^
-c:v libx264 -profile:v main -level 4.0 -s:v 640x360 -b:v 512k -pix_fmt yuv420p ^
-refs 3 -bf 3 -g 50 -keyint_min 25 -b_strategy 1 -flags +cgop -sc_threshold 0 ^
-movflags "negative_cts_offsets+faststart" ^
-vf "drawtext=fontfile=/fonts/Roboto-Regular.ttf:fontcolor=White:fontsize=38:box=1:boxcolor=black:x=(w-text_w)/2:y=text_h-line_h+60:text='H264\ 640x360\ 512k\ frame\: %{frame_num}\ ':start_number=1:timecode=00\\:00\\:00\\:00:rate=25" ^
-an -sn -t 30 -y output.mp4
Works if framenum only:
-vf "drawtext=fontfile=/fonts/Roboto-Regular.ttf:fontcolor=White:fontsize=38:box=1:boxcolor=black:x=(w-text_w)/2:y=text_h-line_h+60:text='H264\ 640x360\ 512k\ frame\: %{frame_num}':start_number=1"
Works if timecode only:
-vf "drawtext=fontfile=/fonts/Roboto-Regular.ttf:fontcolor=White:fontsize=38:box=1:boxcolor=black:x=(w-text_w)/2:y=text_h-line_h+60:text='H264\ 640x360\ 512k\ ':timecode='00\:00\:00\:00':rate=25"
Upvotes: 0
Views: 883
Reputation: 22438
You need to double up on the drawtext
instruction, separating them with a comma.
i.e.
ffmpeg -i input.mp4 -vf "drawtext=text='Frame\: %{frame_num}': start_number=1: x=(w-tw)/2: y=h-(2*lh):font='Noto mono':fontsize=40:alpha=0.5:box=1:boxborderw=4,drawtext=text='':x=(w-tw)/2:y=(lh):fontsize=40:fontcolor=white:timecode='00\:00\:00\:00':timecode_rate=25" -c:a copy output2.mp4
Upvotes: 1