Y
Y
YaroslavKleyno2018-04-18 22:32:07
cmd/bat
YaroslavKleyno, 2018-04-18 22:32:07

Why is the time variable not processed in the batch file?

Good afternoon! The bottom line is this: you need to overlay the current system time on the video stream.
Does not work.
When I run it via cmd it works:

mpv.exe --geometry=0:0 --autofit=960x540 --ontop --no-border --lavfi-complex=[aid1]asplit[ao][a];[a]showvolume=o=v:w=1000:h=60:r=50:b=5:f=0.001[a1];[vid1]drawtext=fontfile='C\:\\Windows\\Fonts\\Arial.ttf':fontsize=90:fontcolor=white:text='%{localtime\:%X}'[vout1];[vout1]drawtext=fontfile='C\:\\Windows\\Fonts\\Arial.ttf':text='online-ru-hotbird-high':fontcolor=white:fontsize=72:box=1:boxcolor=black:x=720:y=10[vout1];[vout1]drawtext=fontfile='C\:\\Windows\\Fonts\\Arial.ttf':timecode='00\:00\:00\:00':rate=24/1.001:fontsize=72:fontcolor=white:boxcolor=0x000000AA:box=1:x=main_w/2-text_w/2:y=main_h-text_h-20:boxborderw=10[vout2];[vout2][a1]overlay=x=(main_w-overlay_w):y=(main_h-overlay_h)[vo] --alpha=no stream.mp4

When I run it from a batch file, it doesn't work.
It does not work because it is not executed in the cmd environment and the variable does not work '%{localtime\:%X}'
Tell me how to win?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Moskus, 2018-04-18
@YaroslavKleyno

In batch files, the percent symbol must be escaped. Look carefully which command is actually executed from batch - percentages will be skipped there (both, or only one). Those that are skipped should be doubled.

E
Ezhyg, 2018-04-19
@Ezhyg

Why are there apostrophes instead of quotes in paths?
Why are the paths indicated ... through some kind of asshole C\:\\?

drawtext="fontfile=%Windir%/Fonts/arial.ttf:fontsize=90:fontcolor=white:text='%{localtime\:%X}'"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question