texxer

a flv to ascii conversion script Show Plain Text
  1.  
  2. #!/bin/bash
  3.  
  4. ############
  5. #Texxer v.1
  6. #by mutexkid
  7. #josh@joshskeen.com
  8. #requires ffmpeg and caca-utils (at least thats the package name on ubuntu
  9. ############
  10.  
  11. #change this to wherever you unzip texxer to#
  12. texxer_base="/home/joshskeen/code/bash/texxer"
  13. #############################################
  14.  
  15. #bash built-in random integer function
  16. texxer_out=$texxer_base"/output"
  17. texxer_tmp=$texxer_out"/tmp"
  18. rand_dir=$RANDOM
  19. #arg1: flv file name
  20. echo "name of flv to process (should be in /flv_source dir):"
  21. read flvname
  22. echo "Framerate:"
  23. read framerate
  24. clear
  25. echo "converting flv to frames"
  26. rm $texxer_tmp/*
  27. ffmpeg -i $texxer_base/flv_source/$flvname -an -r $framerate -y -s 320x240 $texxer_base/output/tmp/frame%d.jpg
  28. echo "complete"
  29. numfiles=$(find "$texxer_base""/output/tmp" | wc -l )
  30. echo $numfiles
  31. echo "random is "$rand_dir
  32. mkdir $texxer_base/output/$rand_dir
  33. for((i=1;i<$numfiles;i+=1)); do
  34.     img2txt -W 120 -H 40 -f tga $texxer_base/output/tmp/frame$i.jpg > $texxer_base/output/$rand_dir/$i.tga
  35.     echo "processed $i of $numfiles"
  36. done
  37. read -p "flv texxified. frames are in $texxer_base/output/$rand_dir. press any key to convert these to mpeg"
  38. ffmpeg -r 30 -f image2 -i $texxer_base/output/$rand_dir/%d.tga $texxer_base/output/$flvname.mpeg
  39.  

result

download