diff options
| author | scop <scop@e10066b5-e1e2-0310-b819-94efdf66514b> | 2008-01-01 11:35:06 +0000 |
|---|---|---|
| committer | scop <scop@e10066b5-e1e2-0310-b819-94efdf66514b> | 2008-01-01 11:35:06 +0000 |
| commit | 46fd0b6a3ef6cbd8cbcfc26f4399103d33c5d8fd (patch) | |
| tree | e1721130ed098ff781ef04d4af150d81e87f27c2 /scripts | |
| parent | 94aa0f84541e2cd34cf330ac8b5ca80b3d4e7e89 (diff) | |
| download | vdr-plugin-muggle-46fd0b6a3ef6cbd8cbcfc26f4399103d33c5d8fd.tar.gz vdr-plugin-muggle-46fd0b6a3ef6cbd8cbcfc26f4399103d33c5d8fd.tar.bz2 | |
Various small improvements.
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@969 e10066b5-e1e2-0310-b819-94efdf66514b
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/image_convert.sh | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/scripts/image_convert.sh b/scripts/image_convert.sh index 3a97c3d..34ed8d5 100755 --- a/scripts/image_convert.sh +++ b/scripts/image_convert.sh @@ -20,9 +20,9 @@ TMP=$(mktemp ${TMPDIR:-/tmp}/image_convert.pnm.XXXXXX) || exit 2 IMG=$1 MPG=$2 -DIR=`dirname "$MPG"` +DIR=$(dirname "$MPG") if [ ! -d "$DIR" ]; then - mkdir -p "$DIR" + mkdir -p "$DIR" || exit 2 fi trap cleanup EXIT @@ -34,7 +34,7 @@ cleanup() # # get the file type and set the according converter to PNM # -FILE_TYPE=`file -i -L -b "$IMG" 2>/dev/null | cut -f2 -d/` +FILE_TYPE=$(file -i -L -b "$IMG" 2>/dev/null | cut -f2 -d/) case "$FILE_TYPE" in jpg | jpeg) TO_PNM=jpegtopnm @@ -59,24 +59,26 @@ case "$FILE_TYPE" in exit 1 ;; esac + # # extract the image size & compute scale value # LANG=C # get the decimal point right -$TO_PNM "$IMG" >$TMP 2>/dev/null -S=`pnmfile $TMP | awk '{ printf "%d %d ",$4,$6 }'` -S=`echo $S $TW $TH | awk '{ sw=$3/$1; sh=$4/$2; s=(sw<sh)?sw:sh; printf "%.4f\n",(s>1)?1.0:s; }'` +$TO_PNM "$IMG" >"$TMP" 2>/dev/null +S=$(pnmfile "$TMP" | awk '{ printf "%d %d ",$4,$6 }') +S=$(echo $S $TW $TH | awk '{ sw=$3/$1; sh=$4/$2; s=(sw<sh)?sw:sh; printf "%.4f\n",(s>1)?1.0:s; }') + # # now run the conversion # if [ "$FORMAT" = "ntsc" ]; then - pnmscale $S $TMP | \ + pnmscale $S "$TMP" | \ pnmpad -black -width 704 -height 480 | \ ppmntsc | \ ppmtoy4m -v 0 -n 1 -r -S 420mpeg2 -F 30000:1001 | \ mpeg2enc -f 7 -T 90 -F 4 -nn -a 2 -v 0 -o "$MPG" else - pnmscale $S $TMP | \ + pnmscale $S "$TMP" | \ pnmpad -black -width 704 -height 576 | \ ppmntsc --pal | \ ppmtoy4m -v 0 -n 1 -r -S 420mpeg2 -F 25:1 | \ |
