Skip to content

Instantly share code, notes, and snippets.

@mamemomonga
Last active November 17, 2022 03:00
Show Gist options
  • Save mamemomonga/542e1c4799358cae14223c52aeef0c25 to your computer and use it in GitHub Desktop.
Save mamemomonga/542e1c4799358cae14223c52aeef0c25 to your computer and use it in GitHub Desktop.
マストドンとかへの投稿に便利なGIFV(音声なしMP4)動画を作るツール。要ffmpeg
#!/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