Skip to content

Instantly share code, notes, and snippets.

@banthar
Created December 27, 2010 22:09
Show Gist options
  • Save banthar/756620 to your computer and use it in GitHub Desktop.
Save banthar/756620 to your computer and use it in GitHub Desktop.
movie converter
#/bin/bash
filmy=0
udane=0
nieudane=0
pominiete=0
while [ $# -gt 0 ] ; do
if [ ! -f "${1%.???}.psp.mp4" ] ; then
`mplayer -vo null -ao null -frames 0 -identify -really-quiet "${1}" 2> /dev/null | sed -n 's/^\(\w\w*=[0-9]\+\)$/export \1/p'`
scale="unknown"
if ((ID_VIDEO_WIDTH*1024/ID_VIDEO_HEIGHT > 368*1024/208)) ; then
scale="368:-10"
else
scale="-10:208"
fi
echo ${1} ${ID_VIDEO_WIDTH}x${ID_VIDEO_HEIGHT} "skalujemy do" $scale
mencoder -af lavcresample=24000 -vf harddup,scale=$scale -oac lavc -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=libfaac -of lavf -lavfopts format=psp "${1}" -o ${1%.???}.psp.mp4
if [ $? -eq 0 ] ; then
((udane++))
else
((nieudane++))
fi
ffmpegthumbnailer -cpng -s160 "-i${1%.???}.psp.mp4" "-o${1%.???}.psp.png"
anytopnm "${1%.???}.psp.png" | pnmcut -width 160 -height 120 | pnmtojpeg > "${1%.???}.psp.thm"
rm "${1%.???}.psp.png"
else
echo "${1} juz przekonwertowany"
((pominiete++))
fi
shift
echo skonwertowane: $udane pominiete: $pominiete nieudane: $nieudane
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment