mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Added option -o to pic2mpg
This commit is contained in:
parent
e197b04e4d
commit
d661735e15
@ -59,3 +59,7 @@ VDR Plugin 'pictures' Revision History
|
|||||||
2011-11-02:
|
2011-11-02:
|
||||||
|
|
||||||
- Fixed handling images that are rotated by 180 degrees in pic2mpg.
|
- Fixed handling images that are rotated by 180 degrees in pic2mpg.
|
||||||
|
|
||||||
|
2012-01-08:
|
||||||
|
|
||||||
|
- Added option -o to pic2mpg.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
# See the README file for copyright information and how to reach the author.
|
# 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::Path;
|
||||||
use File::Spec;
|
use File::Spec;
|
||||||
@ -20,15 +20,17 @@ Usage: $0 [options] picture-dir mpeg-dir
|
|||||||
|
|
||||||
Options: -f Force conversion
|
Options: -f Force conversion
|
||||||
-h print Help
|
-h print Help
|
||||||
|
-o percent overscan in percent
|
||||||
-s size Screen size (WIDTHxHEIGHT, default is 1920x1080)
|
-s size Screen size (WIDTHxHEIGHT, default is 1920x1080)
|
||||||
-v num Verbose (0=none, 1=list files, 2=detailed)
|
-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;
|
die $Usage if $opt_h;
|
||||||
|
|
||||||
$Force = $opt_f;
|
$Force = $opt_f;
|
||||||
|
$Overscan = $opt_o || 0;
|
||||||
$Size = $opt_s || "1920x1080";
|
$Size = $opt_s || "1920x1080";
|
||||||
$Verbose = $opt_v;
|
$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: 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];
|
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:
|
# Convert a single file:
|
||||||
|
|
||||||
if (-f $ARGV[0]) {
|
if (-f $ARGV[0]) {
|
||||||
@ -130,7 +141,7 @@ sub ConvertFile
|
|||||||
$Pict = EscapeMeta($Pict);
|
$Pict = EscapeMeta($Pict);
|
||||||
$Mpeg = EscapeMeta($Mpeg);
|
$Mpeg = EscapeMeta($Mpeg);
|
||||||
print "$Pict -> $Mpeg $Rotate\n" if $ListFiles;
|
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 "
|
. "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");
|
. ($Detailed ? "" : "2>/dev/null");
|
||||||
!system($Cmd) || die "$Cmd: $!\n";
|
!system($Cmd) || die "$Cmd: $!\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user