texxer
Nov 18, 2009
a flv to ascii conversion script Show Plain Text
- #!/bin/bash
- ############
- #Texxer v.1
- #by mutexkid
- #josh@joshskeen.com
- #requires ffmpeg and caca-utils (at least thats the package name on ubuntu
- ############
- #change this to wherever you unzip texxer to#
- texxer_base="/home/joshskeen/code/bash/texxer"
- #############################################
- #bash built-in random integer function
- texxer_out=$texxer_base"/output"
- texxer_tmp=$texxer_out"/tmp"
- rand_dir=$RANDOM
- #arg1: flv file name
- echo "name of flv to process (should be in /flv_source dir):"
- read flvname
- echo "Framerate:"
- read framerate
- clear
- echo "converting flv to frames"
- rm $texxer_tmp/*
- ffmpeg -i $texxer_base/flv_source/$flvname -an -r $framerate -y -s 320x240 $texxer_base/output/tmp/frame%d.jpg
- echo "complete"
- numfiles=$(find "$texxer_base""/output/tmp" | wc -l )
- echo $numfiles
- echo "random is "$rand_dir
- mkdir $texxer_base/output/$rand_dir
- for((i=1;i<$numfiles;i+=1)); do
- img2txt -W 120 -H 40 -f tga $texxer_base/output/tmp/frame$i.jpg > $texxer_base/output/$rand_dir/$i.tga
- echo "processed $i of $numfiles"
- done
- read -p "flv texxified. frames are in $texxer_base/output/$rand_dir. press any key to convert these to mpeg"
- ffmpeg -r 30 -f image2 -i $texxer_base/output/$rand_dir/%d.tga $texxer_base/output/$flvname.mpeg
result