summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-01-08 13:29:01 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2012-01-08 13:29:01 +0100
commitd661735e15bd01dc7c2bfffb3a6eaefd5a4d06e5 (patch)
treeca6c03f237c129e4ba79b85d25b38e0c629a8495
parente197b04e4db7c01e977d9dd4caccbbfe3cfc564f (diff)
downloadvdr-d661735e15bd01dc7c2bfffb3a6eaefd5a4d06e5.tar.gz
vdr-d661735e15bd01dc7c2bfffb3a6eaefd5a4d06e5.tar.bz2
Added option -o to pic2mpg
-rw-r--r--PLUGINS/src/pictures/HISTORY4
-rwxr-xr-xPLUGINS/src/pictures/pic2mpg17
2 files changed, 18 insertions, 3 deletions
diff --git a/PLUGINS/src/pictures/HISTORY b/PLUGINS/src/pictures/HISTORY
index d2d727fa..7c2f89f8 100644
--- a/PLUGINS/src/pictures/HISTORY
+++ b/PLUGINS/src/pictures/HISTORY
@@ -59,3 +59,7 @@ VDR Plugin 'pictures' Revision History
2011-11-02:
- Fixed handling images that are rotated by 180 degrees in pic2mpg.
+
+2012-01-08:
+
+- Added option -o to pic2mpg.
diff --git a/PLUGINS/src/pictures/pic2mpg b/PLUGINS/src/pictures/pic2mpg
index c64cddf0..2895ca8c 100755
--- a/PLUGINS/src/pictures/pic2mpg
+++ b/PLUGINS/src/pictures/pic2mpg
@@ -7,7 +7,7 @@
#
# See the README file for copyright information and how to reach the author.
#
-# $Id: pic2mpg 2.3 2011/12/04 12:50:00 kls Exp $
+# $Id: pic2mpg 2.4 2012/01/08 13:27:17 kls Exp $
use File::Path;
use File::Spec;
@@ -20,15 +20,17 @@ Usage: $0 [options] picture-dir mpeg-dir
Options: -f Force conversion
-h print Help
+ -o percent overscan in percent
-s size Screen size (WIDTHxHEIGHT, default is 1920x1080)
-v num Verbose (0=none, 1=list files, 2=detailed)
};
-getopts("fhs:v:") || die $Usage;
+getopts("fho:s:v:") || die $Usage;
die $Usage if $opt_h;
$Force = $opt_f;
+$Overscan = $opt_o || 0;
$Size = $opt_s || "1920x1080";
$Verbose = $opt_v;
@@ -54,6 +56,15 @@ die "$0: missing parameter\n" unless $ARGV[0] && $ARGV[1];
die "$0: file or directory not found: $ARGV[0]\n" unless -e $ARGV[0];
die "$0: source and destination must be different\n" if $ARGV[0] eq $ARGV[1];
+$Extent = $Size;
+if ($Overscan > 0) {
+ my ($x, $y) = $Size =~ /(.*)x(.*)/;
+ my $r = (100 + $Overscan) / 100;
+ $x = int($x * $r + 0.5);
+ $y = int($y * $r + 0.5);
+ $Extent = "${x}x$y";
+ }
+
# Convert a single file:
if (-f $ARGV[0]) {
@@ -130,7 +141,7 @@ sub ConvertFile
$Pict = EscapeMeta($Pict);
$Mpeg = EscapeMeta($Mpeg);
print "$Pict -> $Mpeg $Rotate\n" if $ListFiles;
- my $Cmd = "convert $Pict -background '#000000' $Rotate -resize $Size -gravity center -extent $Size ppm:- | "
+ my $Cmd = "convert $Pict -background '#000000' $Rotate -resize $Size -gravity center -extent $Extent ppm:- | "
. "ffmpeg -f image2pipe -vcodec ppm -i pipe:0 -an -vcodec libx264 -vpre baseline -s $Size -qscale 2 -f mpegts -y $Mpeg "
. ($Detailed ? "" : "2>/dev/null");
!system($Cmd) || die "$Cmd: $!\n";