Last active
November 17, 2022 03:00
-
-
Save mamemomonga/542e1c4799358cae14223c52aeef0c25 to your computer and use it in GitHub Desktop.
マストドンとかへの投稿に便利なGIFV(音声なしMP4)動画を作るツール。要ffmpeg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use feature 'say'; | |
use File::Basename; | |
sub usage() { | |
say ""; | |
say "[USAGE]"; | |
say " $0 [INFILE]"; | |
say ""; | |
exit(1); | |
} | |
usage() if($#ARGV != 0); | |
my $srcfile=$ARGV[0]; | |
my $dstfile=""; | |
{ | |
my ($basename, $dirname, $ext) = fileparse($srcfile, qr/\..*$/); | |
$dstfile=$dirname.$basename."_gifv".$ext; | |
} | |
say " Source: $srcfile"; | |
say " Destination: $dstfile"; | |
my @cmd=('ffmpeg','-i',$srcfile,'-vf','scale=1280:-1','-an','-b:v','4000K',$dstfile); | |
say join(' ',@cmd); | |
system(@cmd); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment