1106 shaares
6 results
tagged
ffmpeg
for i in *.flac; do ffmpeg -i "$i" -map 0:0 -vn -y -f ogg -acodec libvorbis -ab 320k -ar 44100 -ac 2 "${i:0:-5}.ogg"; done
320k étant le bitrate
44100 étant l'échantillonage (sample rate)
320k étant le bitrate
44100 étant l'échantillonage (sample rate)
un GUI de plus pour ffmpeg
EDIT après test : je l'aime bien car il donne la ligne de commande avant de faire la job. Pratique pour automatiser dans un script après.
EDIT après test : je l'aime bien car il donne la ligne de commande avant de faire la job. Pratique pour automatiser dans un script après.
GUI pour ffmpeg simpliste.
EDIT: mediainfo me semble plus explicite (yaourt -S mediainfo dans community)
Script perl pour afficher des infos sur les vidéos.
#!/usr/bin/perl -w
use strict;
use warnings;
use IPC::Open3;
# example
my $filename = $ARGV[0];
my %videoInfo = videoInfo($filename);
print "duration: " . $videoInfo{'duration'} . "\n";
print "durationsecs: " . $videoInfo{'durationsecs'} . "\n";
print "bitrate: " . $videoInfo{'bitrate'} . "\n";
print "vcodec: " . $videoInfo{'vcodec'} . "\n";
print "vformat: " . $videoInfo{'vformat'} . "\n";
print "acodec: " . $videoInfo{'acodec'} . "\n";
print "asamplerate: " . $videoInfo{'asamplerate'} . "\n";
print "achannels: " . $videoInfo{'achannels'} . "\n";
#
# returns media information in a hash
sub videoInfo {
# ffmpeg command
my $ffmpeg = '/usr/bin/ffmpeg';
my %finfo = (
'duration' => "00:00:00.00",
'durationsecs' => "0",
'bitrate' => "0",
'vcodec' => "",
'vformat' => "",
'acodec' => "",
'asamplerate' => "0",
'achannels' => "0",
);
my $file = shift;
# escaping characters
$file =~ s/(\W)/\\$1/g;
open3( "</dev/null", ">/dev/null", \*ERPH, "$ffmpeg -i $file" ) or die "can't run $ffmpeg\n";
my @res = <ERPH>;
# parse ffmpeg output
foreach (@res) {
print;
# duration
if (m!Duration: ([0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9])!) {
$finfo{'duration'} = $1;
}
# bitrate
if (m!bitrate: (\d*) kb/s!) {
$finfo{'bitrate'} = $1;
}
# vcodec and vformat
if (/Video: (\w*), (\w*),/) {
$finfo{'vcodec'} = $1;
$finfo{'vformat'} = $2;
}
# Stream #0.1(und): Audio: aac, 48000 Hz, 1 channels, s16, 64 kb/s
# acodec, samplerate, stereo and audiorate
if (m!Audio: (\w*), (\d*) Hz, (\d*)!) {
$finfo{'acodec'} = $1;
$finfo{'asamplerate'} = $2;
$finfo{'achannels'} = $3;
}
}
my $tenths = substr( $finfo{'duration'}, 9, 2 );
my $seconds = substr( $finfo{'duration'}, 6, 2 );
my $minutes = substr( $finfo{'duration'}, 3, 2 );
my $hours = substr( $finfo{'duration'}, 0, 2 );
$finfo{'durationsecs'} = ( $tenths * .01 ) + $seconds + ( $minutes * 60 ) + ( $hours * 360 );
return %finfo;
}
Script perl pour afficher des infos sur les vidéos.
#!/usr/bin/perl -w
use strict;
use warnings;
use IPC::Open3;
# example
my $filename = $ARGV[0];
my %videoInfo = videoInfo($filename);
print "duration: " . $videoInfo{'duration'} . "\n";
print "durationsecs: " . $videoInfo{'durationsecs'} . "\n";
print "bitrate: " . $videoInfo{'bitrate'} . "\n";
print "vcodec: " . $videoInfo{'vcodec'} . "\n";
print "vformat: " . $videoInfo{'vformat'} . "\n";
print "acodec: " . $videoInfo{'acodec'} . "\n";
print "asamplerate: " . $videoInfo{'asamplerate'} . "\n";
print "achannels: " . $videoInfo{'achannels'} . "\n";
#
# returns media information in a hash
sub videoInfo {
# ffmpeg command
my $ffmpeg = '/usr/bin/ffmpeg';
my %finfo = (
'duration' => "00:00:00.00",
'durationsecs' => "0",
'bitrate' => "0",
'vcodec' => "",
'vformat' => "",
'acodec' => "",
'asamplerate' => "0",
'achannels' => "0",
);
my $file = shift;
# escaping characters
$file =~ s/(\W)/\\$1/g;
open3( "</dev/null", ">/dev/null", \*ERPH, "$ffmpeg -i $file" ) or die "can't run $ffmpeg\n";
my @res = <ERPH>;
# parse ffmpeg output
foreach (@res) {
print;
# duration
if (m!Duration: ([0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9])!) {
$finfo{'duration'} = $1;
}
# bitrate
if (m!bitrate: (\d*) kb/s!) {
$finfo{'bitrate'} = $1;
}
# vcodec and vformat
if (/Video: (\w*), (\w*),/) {
$finfo{'vcodec'} = $1;
$finfo{'vformat'} = $2;
}
# Stream #0.1(und): Audio: aac, 48000 Hz, 1 channels, s16, 64 kb/s
# acodec, samplerate, stereo and audiorate
if (m!Audio: (\w*), (\d*) Hz, (\d*)!) {
$finfo{'acodec'} = $1;
$finfo{'asamplerate'} = $2;
$finfo{'achannels'} = $3;
}
}
my $tenths = substr( $finfo{'duration'}, 9, 2 );
my $seconds = substr( $finfo{'duration'}, 6, 2 );
my $minutes = substr( $finfo{'duration'}, 3, 2 );
my $hours = substr( $finfo{'duration'}, 0, 2 );
$finfo{'durationsecs'} = ( $tenths * .01 ) + $seconds + ( $minutes * 60 ) + ( $hours * 360 );
return %finfo;
}
jamais réussit à m'en servir correctement.
EDIT, cétait tout con, il fallait mettre des guillemets...
exemple :
youtube-dl "http://www.youtube.com/watch?v=ihL2ApLJS7s"
>-<`
tant que j'y suis, pour la convertir en mp4 juste après avec ffmpeg:
ffmpeg -i video.flv -ab 128000 -ar 44100 -b 200000 -s 640x480 -ac 2 -acodec libmp3lame video.mpg
EDIT2: Audio only with ogg
youtube-dl --extract-audio --audio-format vorbis https://www.youtube.com/watch?v=9eNnmIam0uM
EDIT3 : mp4
youtube-dl -f mp4 [urlyoutube]
EDIT5 : /me découvre que youtube-dl supporte la reprise en cas de téléchargement interrompu. Nice!
EDIT6: Avoir la dernière version
sudo wget https://yt-dl.org/latest/youtube-dl -O /usr/local/bin/youtube-dl
EDIT, cétait tout con, il fallait mettre des guillemets...
exemple :
youtube-dl "http://www.youtube.com/watch?v=ihL2ApLJS7s"
>-<`
tant que j'y suis, pour la convertir en mp4 juste après avec ffmpeg:
ffmpeg -i video.flv -ab 128000 -ar 44100 -b 200000 -s 640x480 -ac 2 -acodec libmp3lame video.mpg
EDIT2: Audio only with ogg
youtube-dl --extract-audio --audio-format vorbis https://www.youtube.com/watch?v=9eNnmIam0uM
EDIT3 : mp4
youtube-dl -f mp4 [urlyoutube]
EDIT5 : /me découvre que youtube-dl supporte la reprise en cas de téléchargement interrompu. Nice!
EDIT6: Avoir la dernière version
sudo wget https://yt-dl.org/latest/youtube-dl -O /usr/local/bin/youtube-dl