<commit_before>#!/bin/bash

usage()
{
echo "usage: $0 'text' video_length_in_sec

example:
$0 'hello world' 5
"
}

if [ $# -ne 2 ]
then
  usage
  exit 1
fi

OUTPUT_TEXT=$1
#OUTPUT_IMG=$(awk -F: '$0=$1' <<<"${OUTPUT_TEXT}")
OUTPUT_IMG="`echo ${OUTPUT_TEXT} | cut -c 1-6 | tr ' ' '_'`.png"
VIDEO_LENGTH=$2

echo "generating ${VIDEO_LENGTH} s video from ${OUTPUT_TEXT}"
echo "generating image: ${OUTPUT_IMG} from text: ${OUTPUT_TEXT}"
convert -size 1280x720 xc:white -font FreeMono-Regular -pointsize 72 -fill black  -gravity center caption:"${OUTPUT_TEXT}" -flatten ${OUTPUT_IMG}

exit 0

#convert -size 1280x720 xc:white -font FreeMono-Regular -pointsize 72 -fill black  -gravity center -draw "text 0,0 'Linux\nand\nLife'" linuxandlife.png<commit_msg>add text to video convertion using avconv<commit_after>#!/bin/bash

usage()
{
echo "usage: $0 'text' video_length_in_sec

example:
$0 'hello world' 5
"
}

if [ $# -ne 2 ]
then
  usage
  exit 1
fi

OUTPUT_TEXT=$1
#OUTPUT_IMG=$(awk -F: '$0=$1' <<<"${OUTPUT_TEXT}")
OUTPUT_NAME=`echo ${OUTPUT_TEXT} | cut -c 1-6 | tr ' ' '_'`
OUTPUT_IMG="${OUTPUT_NAME}.png"
OUTPUT_VIDEO="${OUTPUT_NAME}.avi"
VIDEO_LENGTH=$2
RATIO=1280x720

echo "generating image: ${OUTPUT_IMG} from text: ${OUTPUT_TEXT}"
convert -size ${RATIO} xc:white -font FreeMono-Regular -pointsize 72 -fill black  -gravity center caption:"${OUTPUT_TEXT}" -flatten ${OUTPUT_IMG}
echo "generating ${VIDEO_LENGTH} s video from ${OUTPUT_TEXT} with ${OUTPUT_IMG}"
avconv -f image2 -i ${OUTPUT_IMG} -r "1/${VIDEO_LENGTH}" -s "${RATIO}" ${OUTPUT_VIDEO} -t "00:00:${VIDEO_LENGTH}"
exit 0

#convert -size 1280x720 xc:white -font FreeMono-Regular -pointsize 72 -fill black  -gravity center -draw "text 0,0 'Linux\nand\nLife'" linuxandlife.png
{'fraction_non_alphanumeric': 0.1641705069124424, 'fraction_numerical': 0.04032258064516129, 'mean_word_length': 5.116197183098592, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4403574', 'n_tokens_mistral': 716, 'n_tokens_neox': 666, 'n_words': 183}