Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TimeStamp variable stopped working in bash script with avconv

The following script was working fine until I upgraded all my Raspberry Pis to Release 9:

#!/bin/bash

cd /home/pi/Videos/SecurityCam/
DToday=`date '+%Y%m%d-%H%M%S'`
fn="VID $DToday"
SubT="PP $PB $DToday"

avconv -f video4linux2 -i /dev/video0 -t 3600 -r 4 -vf "drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf: \text=\'$SubT \%T \' : [email protected]: x=7: y=460" -vcodec libx264 -vb 2000k \-y ${fn}.avi

It is now choking on the %T. Why would that be and what is the right way to get a rolling timestamp in the video?

like image 534
Chiwda Avatar asked Aug 10 '26 06:08

Chiwda


1 Answers

try with this:

#!/bin/bash
cd /home/pi/Videos/SecurityCam/ || exit
DToday=$(date '+%Y%m%d-%H%M%S')
fn="VID $DToday"
SubT="PP $PB $DToday"

avconv -f video4linux2 -i /dev/video0 -t 3600 -r 4 -vf "drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf: \text=\'$SubT \%T \' : [email protected]: x=7: y=460"
 -vcodec libx264 -vb 2000k -y "${fn}.avi"
like image 53
PaulRM Avatar answered Aug 13 '26 03:08

PaulRM



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!