In my bash
(zsh
) script, I am receiving a string that represents a UNIX epoch, like:
<code>myTimestamp="1719742786"
</code>
<code>myTimestamp="1719742786"
</code>
myTimestamp="1719742786"
I want to change that date into a formatted string, and then store it in a variable so it can be used in an upcoming ffmpeg
script. I’m doing it this way:
<code>theDate=$(date -u -r "$myTimestamp" "+%b %d, %H:%M:%S")
echo "$theDate"
</code>
<code>theDate=$(date -u -r "$myTimestamp" "+%b %d, %H:%M:%S")
echo "$theDate"
</code>
theDate=$(date -u -r "$myTimestamp" "+%b %d, %H:%M:%S")
echo "$theDate"
which prints to my screen what I want:
<code>(prints -> Jun 30, 06:19:48)
</code>
<code>(prints -> Jun 30, 06:19:48)
</code>
(prints -> Jun 30, 06:19:48)
but when I try to use this variable in my ffmpeg script, I get errors:
<code>ffmpeg -y -i "$file" -vf
"drawtext=text='$theDate':fontcolor=gray:fontsize=$fontSize:x=$width:y=$height:"
"$output"
</code>
<code>ffmpeg -y -i "$file" -vf
"drawtext=text='$theDate':fontcolor=gray:fontsize=$fontSize:x=$width:y=$height:"
"$output"
</code>
ffmpeg -y -i "$file" -vf
"drawtext=text='$theDate':fontcolor=gray:fontsize=$fontSize:x=$width:y=$height:"
"$output"
Note that if I change out '$theDate'
in the script (to something like '$myTimestamp'
), I do not get errors.
What I do get, along with Error initializing filters
, is this (possibly important?) error:
<code>Both text and text file provided. Please provide only one
</code>
<code>Both text and text file provided. Please provide only one
</code>
Both text and text file provided. Please provide only one
Thank you.