Archive for the “Codigo” Category


Pues hoy me levante con ganas de hacer algo que sea util para mi, y para los demas, por eso hice este pequeño bash script para transformar cualquier formato (flv, mpeg, avi, wmv, etc; siempre y cuando tengas las librerias para leerlos con mplayer) a mp4 por medio de la libreria ffmpeg, y despues para subirlos a tu iPod con una aplicacion como gtkpod o similar; pues… aqui se los dejo, a mi me a sido muy util para hacer mis videos pequeños y para verlos en mi iPod Video 5.5G. Click en read more… para verlo

#!/bin/bash
################
#Script name: ituxvid
#Author: arkoldthos
#Date: Wed Jun 6 15:59:42 CDT 2007
#Made with: vcrear 0.1 by David Barreda
################
# Description
#
# This script was made for learning purpose
# I am not responsible of what content do you
# do with this script, and this one is under GPL
# This script was supposed to make videos of any
# kind of redeable videos by mplayer to be resided
# and converted to a mp4, and then upload to your
# iPod with gtkpod or a similar application.
# The size is 320x180 but can be changed to other
# purposes.
################
# Sintax
#
# ./ituxvid
#
# Please note that you need to write the extension
# of the input file, the .mp4 of the output will
# be autommatly added.
#
# http://ark.pekay.co.uk/
################
# By David Barreda.
################

# Check for the input
if [ -z $1 ]; then
read -e -p “Give the name of the input file: ” INPUT
if [ -z $INPUT ]; then
echo “You need to specify one.”
exit 1
fi

else
INPUT=$1
fi

# Check for the output
if [ -z $2 ]; then
read -e -p “You need to specify a name for the output: ” OUTPUT
if [ -z $OUTPUT ]; then
echo “You need to specify one.”
exit 1
fi
else
OUTPUT=$2
fi

ffmpeg -i $1 -f mp4 -vcodec mpeg4 -maxrate 1000 -b 700 -qmin 3 -qmax 5 -bufsize 4096 -g 300 -acodec aac -ab 192 -s 320×180 -aspect 16:9 $2.mp4

Comments 1 Comment »

Pues bien, en el curso de Introduccion a GNU/Linux me encargaron hacer un programa que se llame ‘crear’ este debe de crear un archivo que tenga el header de un script de bash, este, debe cambiarle los permisos al final de su ejecucion al archivo generado y durante la creacion ver si se especifico un nombre para el script, si no lo hizo, tiene que preguntar y pues si ya existe lo abre, aqui se los dejo para que mis compañeros puedan darse una idea y crear su version…

#!/bin/bash
# Check if the filename was specified at the start of the script; if not ask for it
if [ -z $1 ]; then
read -e -p “You need to specify a name for the script: ” FILE
if [ -z $FILE ]; then
echo “You need to specify one.”
exit 1
fi
else
FILE=$1
fi

# Check if the filename already exists, if it exists, open it with nano
if [ -e $FILE ]; then
echo ‘Already exists, opening’
echo ‘Loading…’
sleep 3
nano $FILE
exit 0
fi

echo “#!/bin/bash” > $FILE
echo “################” >> $FILE
echo “#Nombre del script $FILE” >> $FILE
echo “#Creador $(whoami)” >> $FILE
echo “#Fecha: $(date)” >> $FILE
echo “################” >> $FILE

echo “Creating file $FILE”
echo ‘Loading…. ‘
sleep 3
nano $FILE && echo “Saving $FILE …”
chmod 755 $FILE && echo ‘Changing CHMOD permission for executing’;

Espero y les sirva…

Comments 1 Comment »