The title says it all, I have a folder of videos, and want to have them play on my Nexus 7 Android device.
In other words, I want to be able to do this:-
~$ cd Videos ~$ somescript *.avi|*.mov|*.mpeg
then go to bed and wake up with nexus 7 supported files.
Here is my version of that script.
#! /bin/bash
############################################################
# script to convert video files to nexus (android) devices #
############################################################
HELP="\n
This script will convert video files to the preferred format for android devices\n
It uses ffmpeg to do a 2 pass encoding.\n
See http://patdavila.wordpress.com/2010/03/10/re-encoding-mythtv-recordings-for-viewing-on-your-android-phone/\n
\n
EXAMPLES\n
convert quicktime movies\n
~$ ./android_video.sh video_file.mov\n
\n
convert mpgs\n
~$ ./android_video.sh video_file.mpg\n
\n
convert avis\n
~$ ./android_video.sh video_file.avi\n
\n
wildcard use is supported, and unique filenames for the output
videos should ensue by simply prefixing .mp4\n
eg.\n
~$ ./android_video.sh *.avi\n
"
function show_help {
echo -e $HELP
exit 1
}
convert()
{
SRC=$1
DEST=$1.mp4
ffmpeg -i $SRC -aspect 16:9 -s 800x480 -vcodec libx264 -b 480k -r 13 -acodec libfaac -ab 128k -sameq -pass 1 -f rawvideo -an -y /dev/null && \
ffmpeg -i $SRC -aspect 16:9 -s 800x480 -vcodec libx264 -b 480k -r 13 -acodec libfaac -ab 128k -ac 2 -sameq -pass 2 $DEST
}
if [[ "$1" == "" ]]
then
show_help
fi
while [[ "$1" != "" ]]; do
convert $1
shift
done
exit 1
1 comment:
Thanks for providing this coding with this blog... I have a project and your blog helps me alot. Really thank you for this.
Convert to DVD
Post a Comment