理系学生日記

おまえはいつまで学生気分なのか

ディレクトリに入ってる FLV を AAC に変換しましょう

使いすてスクリプト。

use strict;
use warnings;
use Path::Class qw(dir);
use IPC::Run qw(run);

my $dir = shift @ARGV;
-d $dir or die "cannot find $dir\n directory";

dir($dir)->recurse(
    callback => sub {
        my $file = shift;
        return if "$file" !~ /\.flv$/ or $file->is_dir;
        run [ qw(ffmpeg -i), "$file", qw(-f aac -vn -acodec libfaac -ab 256k), "$file.m4a" ];
    }
);

Audio 用 codec を copy にしなかったのはそれなりの事情がある。