summaryrefslogtreecommitdiff
path: root/scripts/muggle-image-convert
diff options
context:
space:
mode:
authorworo <woro@e10066b5-e1e2-0310-b819-94efdf66514b>2008-04-11 20:11:00 +0000
committerworo <woro@e10066b5-e1e2-0310-b819-94efdf66514b>2008-04-11 20:11:00 +0000
commit57d7ee812c8be1bd118471512682cb3393ce595f (patch)
tree2e0d792fc74eda1661b439853c004e2ed5c06820 /scripts/muggle-image-convert
parentb2550195d6b61f9be3470679082b8d6b5159aa83 (diff)
downloadvdr-plugin-muggle-57d7ee812c8be1bd118471512682cb3393ce595f.tar.gz
vdr-plugin-muggle-57d7ee812c8be1bd118471512682cb3393ce595f.tar.bz2
merge mp3ng branch into trunk
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@1173 e10066b5-e1e2-0310-b819-94efdf66514b
Diffstat (limited to 'scripts/muggle-image-convert')
-rwxr-xr-xscripts/muggle-image-convert42
1 files changed, 21 insertions, 21 deletions
diff --git a/scripts/muggle-image-convert b/scripts/muggle-image-convert
index 34ed8d5..3348a69 100755
--- a/scripts/muggle-image-convert
+++ b/scripts/muggle-image-convert
@@ -9,17 +9,25 @@ FORMAT=pal
# target image width/height (taking into account visible screen area)
if [ "$FORMAT" = "ntsc" ]; then
- TW=600
- TH=420
+ TW=704
+ TH=480
else
- TW=632
- TH=512
+ TW=704
+ TH=576
fi
TMP=$(mktemp ${TMPDIR:-/tmp}/image_convert.pnm.XXXXXX) || exit 2
IMG=$1
MPG=$2
+left=$3
+top=$4
+width=$5
+height=$6
+right=`expr $TW - $left - $width`
+bottom=`expr $TH - $top - $height`
+
+
DIR=$(dirname "$MPG")
if [ ! -d "$DIR" ]; then
mkdir -p "$DIR" || exit 2
@@ -60,27 +68,19 @@ case "$FILE_TYPE" in
;;
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; }')
-#
-# now run the conversion
-#
if [ "$FORMAT" = "ntsc" ]; then
- pnmscale $S "$TMP" | \
- pnmpad -black -width 704 -height 480 | \
- ppmntsc | \
- ppmtoy4m -v 0 -n 1 -r -S 420mpeg2 -F 30000:1001 | \
+# untested
+ pnmscale -width $width -height $height "$TMP" |
+ pnmpad -black -left $left -top $top -right $right -bottom $bottom |
+ 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" | \
- pnmpad -black -width 704 -height 576 | \
- ppmntsc --pal | \
- ppmtoy4m -v 0 -n 1 -r -S 420mpeg2 -F 25:1 | \
+ pnmscale -width $width -height $height "$TMP" |
+ pnmpad -black -left $left -top $top -right $right -bottom $bottom |
+ ppmntsc --pal |
+ ppmtoy4m -v 0 -n 1 -r -S 420mpeg2 -F 25:1 |
mpeg2enc -f 7 -T 90 -F 3 -np -a 2 -v 0 -o "$MPG"
fi