Last active
October 17, 2016 12:34
-
-
Save neowinx/ee964455d8330c0673126ad7ac74cb3b to your computer and use it in GitHub Desktop.
Convertir archivos mp4 a formato avi soportado por la autoraio sony xav-65
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Convertir videos mp4 utilizando ffmpeg al formato soportado por la autoradio sony xav-65 | |
# Author: Pedro Flores | |
# Fecha: 12/12/2011 | |
function printe { | |
echo -e "\033[1;37m$1\033[0m" | |
} | |
printe "Este script convierte archivos \033[0m\033[1;33m.mp4\033[0m\033[1;37m del directorio actual al archivos .avi soportados por la autoradio sony xav-65." | |
printe "Presione enter para continuar." | |
read | |
for i in *.mp4 | |
do | |
popo=`echo $i | sed 's/\(.*\).mp4/\1/g'` | |
if [ -f "$popo.avi" ]; then | |
printe "ya existe \033[0m\033[1;33m$popo.avi\033[0m\033[1;37m... ignorando." | |
else | |
printe "analizando $popo.mp4..." | |
ARCHIVO="conv-$( date '+%F-%H-%M-%N' ).txt" | |
export FFREPORT="file=$ARCHIVO" | |
ffmpeg -i "$popo.mp4" -af "volumedetect" -f null -report -loglevel 16 /dev/null | |
MAX_VOLUME=$( grep max_volume $ARCHIVO | cut -d ' ' -f 5 ) | |
printe " max_volume = $MAX_VOLUME" | |
echo "$MAX_VOLUME" | grep - | |
if [ $? == 0 ]; then | |
printe "Extrayendo \033[0m\033[1;33m$popo.avi\033[0m\033[1;37m..." | |
ffmpeg -i "$popo.mp4" -c:v mpeg4 -vtag xvid -vf scale=720:480 -r 25 -af "volume=`echo $MAX_VOLUME | sed -e s/-//g`" -c:a libmp3lame -q:a 2 "$popo.avi" | |
else | |
if [ "$MAX_VOLUME" == "0.0" ]; then | |
printe "Extrayendo \033[0m\033[1;33m$popo.avi\033[0m\033[1;37m..." | |
echo ffmpeg -i "$popo.mp4" -c:v mpeg4 -vtag xvid -vf scale=720:480 -r 25 "$popo.avi" | |
else | |
printe "Extrayendo \033[0m\033[1;33m$popo.avi\033[0m\033[1;37m..." | |
ffmpeg -i "$popo.mp4" -c:v mpeg4 -vtag xvid -vf scale=720:480 -r 25 -af "volume=-$MAX_VOLUME" -c:a libmp3lame -q:a 2 "$popo.avi" | |
fi | |
fi | |
#printe "Extrayendo \033[0m\033[1;33m$popo.avi\033[0m\033[1;37m..." | |
#ffmpeg -i "$popo.mp4" -c:v mpeg4 -vtag xvid -vf scale=720:480 -r 25 "$popo.avi" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment