I'm trying to generate videos using ffmpeg that display a burnt in timecode of the source video. I'm using a bash script in OS X. video 1 has a starting timecode of 09:59:30:00
In order to use the drawtext filter in ffmpeg, I need to close the colons, as they are used to delimit the filter.
They need to be in this format in the script timecode='00\:00\:00\:00'
and they will ultimately show up like this in the actual terminal window: timecode='\''00\:00\:00\:00'\''
Is there some way to transform the values stored in the $timecode variable, using sed or awk, or something similar?
I'm using ffprobe to generate the timecode and adding it as a variable
$ timecode=($(ffprobe -v error -show_entries format_tags=timecode -of default=noprint_wrappers=1:nokey=1 "$1" ))
$ echo $timecode
09:59:30:00
When I add the variable $timecode in this fashion to my script:
ffmpeg -i "$1" -c:v libx264 -crf 23 -pix_fmt yuv420p -vf drawtext="fontsize=45":"fontfile=/Library/Fonts/Arial\ Black.ttf:fontcolor=white:timecode="$timecode":rate=$framerate:boxcolor=0x000000AA:box=1:x=360-text_w/2:y=480" ""$mezzanine"/"$filenoext"_PRORES.mov"
the timecode shows up without anything closed when I use bash -x:
+ ffmpeg -i /Users/kieranoleary/Downloads/AS11_DPP_HD_OEM_SAMPLE_136_1.mxf -c:v libx264 -crf 23 -pix_fmt yuv420p -vf 'drawtext=fontsize=45:fontfile=/Library/Fonts/Arial\ Black.ttf:fontcolor=white:timecode=09:59:30:00:rate=25/1:boxcolor=0x000000AA:box=1:x=360-text_w/2:y=480' /Users/kieranoleary/Downloads/AS11_DPP_HD_OEM_SAMPLE_136_1/mezzanine/AS11_DPP_HD_OEM_SAMPLE_136_1_PRORES.mov
and I get the following error:
[Parsed_drawtext_0 @ 0x7f9dc242e360] Both text and text file provided. Please provide only one
[AVFilterGraph @ 0x7f9dc242e4e0] Error initializing filter 'drawtext' with args 'fontsize=45:fontfile=/Library/Fonts/Arial Black.ttf:fontcolor=white:timecode=09:59:30:00:rate=25/1:boxcolor=0x000000 A:box=1:x=360-text_w/2:y=480'
Error opening filters!