Hello,
Below script works fine when I manually enter required information for each file. When it comes to shell in auto mode, it gives various errors.
I am under ubuntu 14.04 / trusty.
manual_run.sh:
#!/bin/bash
/usr/bin/ffmpeg -start_at_zero -copyts -i nicki.mp4 -c:v mpeg2video \
-b:v 500k -minrate 500k -maxrate 500k \
-vf "[in]drawtext=fontsize=12:fontcolor=White:fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf':\
text='%{pts\:gmtime\:0\:%M\\\\\:%S}':x=60:y=20, \
drawtext=fontsize=12:fontcolor=Yellow:fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf':\
text='nicki':x=360:y=20,\
drawtext=fontsize=12:fontcolor=White:fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf':\
text='00\:05\:22.22':x=660:y=20:[out]" \
-metadata service_provider="stream" -metadata service_name="Info Kanalen" -f mpegts \
/var/www/html/output.mp4
auto_sh:
#!/bin/bash
while read -r COL1 COL2
do
/usr/bin/ffmpeg -start_at_zero -copyts -i "$COL1" -c:v mpeg2video \
-b:v 500k -minrate 500k -maxrate 500k \
-vf "[in]drawtext=fontsize=12:fontcolor=White:fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf':\
text='%{pts\:gmtime\:0\:%M\\\\\:%S}':x=60:y=20, \
drawtext=fontsize=12:fontcolor=Yellow:fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf':\
text='"$COL1"':x=360:y=20,\
drawtext=fontsize=12:fontcolor=White:fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf':\
text='"$COL2"':x=660:y=20:[out]" \
-metadata service_provider="stream" -metadata service_name="Info Kanalen" -f mpegts \
/var/www/html/$(basename "${COL1/.mp4}")_t.mp4
done < duration
duration:
restaurant.mp4 00:02:30.51
nicki.mp4 00:05:22.22
The difference between manual and auto sh files are subjected to column2
. Seems like I am unable to escape colon
( : ) sign as it was assigned to a variable.
output_error1:
[Parsed_drawtext_2 @ 0x286de80] Could not load font "02": cannot open resource
[AVFilterGraph @ 0x266a400] Error initializing filter 'drawtext' with args 'fontsize=12:fontcolor=White:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf:text=00:02:30.51:x=660:y=20:'
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
output_error2:
icki.mp4: No such file or directory
Also, I do not understand why it gives no file found error
, why the letter n
for nicki
is missed etc ..
I'd kindly appreciate your help
Many thanks
Boris