Shell-script: Conversor flv - avi
Salvar vídeos do youtube não é mais segredo, extensões para o firefox, como o Fast Video Download fazem esse trabalho de maneira simples. Entretanto, a extensão dos vídeos é flv (macromedia FLash Video). Fiz um script para converter flv para avi de maneira simples utilizando o mencoder.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | #!/bin/bash # # Author: Renê de Souza Pinto <rene@renesp.com.br> # Date: 07/02/2008 # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # echo echo -e "flv\033[40;31;1m2\033[mavi" echo if [ $# -lt 1 ]; then echo "Use:" echo " $0 <flv_files>" echo exit 0 fi for FFLV; do # Output filename FAVI=$(echo $FFLV | sed "s/.flv/.avi/") # Check file if [ -f "$FFLV" ]; then FTYPE="`file "$FFLV" | cut -d':' -f2`" if [ "$FTYPE" != " Macromedia Flash Video" ]; then echo -e "\033[40;36;1m$FFLV\033[m it's not a Macromedia Flash Video file" echo continue fi else echo -e "Error on open \033[40;31;1m$FFLV\033[m file" echo continue fi # Get video info mplayer "$FFLV" -vo /dev/null -nosound > /tmp/$$ 2> /dev/null VINFO=`cat /tmp/$$ | grep "VIDEO:"` rm /tmp/$$ 2> /dev/null FRAMES=`echo $VINFO | cut -d" " -f5` SCALE=`echo $VINFO | cut -d" " -f3 | cut -d"x" -f1` # Start conversion echo -ne "Converting \033[40;36;1m$FFLV\033[m ... " mencoder "$FFLV" -ofps $FRAMES -vf scale=$SCALE:-2 -oac mp3lame -ovc lavc -lavcopts vcodec=msmpeg4v2:acodec=mp3 -o "$FAVI" -msglevel all=-1 > /dev/null 2> /tmp/$$ if [ $? -eq 0 ]; then echo -e "[\033[40;32;1m DONE \033[m]" else echo -e "[\033[40;31;1m FAIL \033[m]" echo echo "Errors:" echo cat /tmp/$$ rm /tmp/$$ 2> /dev/null fi echo done |
Baixar script
Deixe um comentário