Last active
July 9, 2016 18:45
-
-
Save jmcveigh/63953fbe6648b5e8f5a90c98f79efc6e to your computer and use it in GitHub Desktop.
This is a commandlinefu application to download a YouTube video and save as WebM (HTML 5 Streaming).
This file contains hidden or 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
use common::sense; | |
# zenbae: you need -vf expand osd trick | |
# iive zenbae: -vf expand=osd=1 | |
package Command { | |
use common::sense; | |
use MooseX::App::Simple qw(Color); | |
with 'MooseX::Role::Tempdir'; | |
use Sed; | |
use FFmpeg::Stream::Helper; | |
use WWW::YouTube::Download; | |
use LWP::Simple; | |
use feature 'say'; | |
option 'in' => ( | |
is => 'ro', | |
isa => 'Str', | |
required => 1, | |
documentation => 'This argument is a string, accessible by the key titled id. This is used to reference the media source selection.', | |
); | |
option 'out' => ( | |
is => 'ro', | |
isa => 'Str', | |
required => 1, | |
documentation => 'This argument is a string, accessible by the key titled outfile. This is used to reference the webm output filename.', | |
); | |
sub youtube_video_outfile { | |
my ($self) = @_; | |
return($self->tmpdir . "\\" . "commandlinefu-youtube-to-webm.download.mp4"); | |
} | |
sub webm_outfile { | |
my ($self) = @_; | |
return($self->out); | |
} | |
sub run { | |
my ($self) = @_; | |
my $client1 = WWW::YouTube::Download->new; | |
$client1->download($self->in, { filename => $self->youtube_video_outfile }); | |
my $commandlinefu1 = 'ffmpeg -i ' . $self->youtube_video_outfile . ' ' . $self->webm_outfile; | |
my $buffer1 = `$commandlinefu1`; | |
} | |
} | |
my $cmd = Command->new_with_options->run unless caller; | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment