Ffmpeg: mudanças entre as edições

De Pontão Nós Digitais
Ir para navegaçãoIr para pesquisar
Sem resumo de edição
Sem resumo de edição
Linha 1: Linha 1:
[[Imagem:Man_ffmpeg_result.png|right|Imagem do comando '''man ffmpeg''' no terminal.]]
[[Imagem:Man_ffmpeg_result.png|thumb|right|400px|Imagem do comando '''man ffmpeg''' no terminal.]]
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm">Usuários
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
de sistemas <B>GNU/Linux</B>, especialmente os que trabalham com edição e reprodução de vídeo, certamente conhecem ou já ouviram falar do programa de linha de comandos <B>ffmpeg</B>.
<FONT FACE="Georgia, serif"><FONT SIZE=4>
Usuários de sistemas <B>GNU/Linux</B>, especialmente os que trabalham com edição e
reprodução de vídeo, certamente conhecem ou já ouviram falar do programa de linha de comandos <B>ffmpeg</B>. </FONT></FONT>
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
 
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm">O que nem todos conhecem é a maneira de melhor usá-lo. Essa página pretende dar um panorama geral da sintaxe e do uso do <B>ffmpeg</B>,bem como, indicar boas referências para quem quer se aprofundar no seu uso. Mas sem maiores papos, vamos lá!</P>
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">


<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
<FONT FACE="Georgia, serif"><FONT SIZE=4>O que nem todos conhecem é a maneira de melhor usá-lo. Essa página pretende dar um panorama geral da sintaxe e do uso do <B>ffmpeg</B>, bem como, indicar boas referências para quem quer se aprofundar no seu uso. Mas sem maiores papos, vamos lá!</FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt"><B>Usando
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4>
o ffmpeg </B></FONT></FONT>
</FONT></FONT>
==Usando o ffmpeg==
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt">Com
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
este programa você pode cortar, converter, equalizar, juntar e até
<FONT FACE="Georgia, serif"><FONT SIZE=4>Com este programa você pode cortar, converter, equalizar, juntar e até mudar o brilho e o contraste de um vídeo, entre outras coisas. É sem dúvida, a melhor e mais rápida opção para, por exemplo, quem quer converter um vídeo bruto pesado, capturado de uma câmera filmadora, para um formato mais leve como .mp4 e/ou .ogg.</FONT></FONT></P>
mudar o brilho e o contraste de um vídeo, entre outras coisas. É
sem dúvida, a melhor e mais rápida opção para, por exemplo, quem
quer converter um vídeo bruto pesado, capturado de uma câmera
filmadora, para um formato mais leve como .mp4 e/ou .ogg.</FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt">Entretanto
existem algumas características que no <B>ffmpeg</B> que as vezes
afastam o usuário sem prática. Uma desvantagem, especialmente para
<B>usuários iniciantes em sistemas Gnu/Linux</B>, é que as opções
são inúmeras e requerem um grande conhecimento da terminologia
associada à <FONT COLOR="#000000"><SPAN STYLE="text-decoration: none">tecnologia
de áudio </SPAN></FONT>e vídeo. Em casos assim, uma interface
gráfica ajuda muito. Mas tem também as receitas prontas, que
funcionam muito bem e que podem ser usadas no terminal de comandos,
permitindo o processamento de múltiplos arquivos simultaneamente. </FONT></FONT>


<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
<FONT FACE="Georgia, serif"><FONT SIZE=4>Entretanto existem algumas características que no <B>ffmpeg</B> que as vezes afastam o usuário sem prática. Uma desvantagem, especialmente para <B>usuários iniciantes em sistemas Gnu/Linux</B>, é que as opções são inúmeras e requerem um grande conhecimento da terminologia associada à <FONT COLOR="#000000"><SPAN STYLE="text-decoration: none">tecnologia de áudio </SPAN></FONT>e vídeo. Em casos assim, uma interface gráfica ajuda muito. Mas tem também as receitas prontas, que funcionam muito bem e que podem ser usadas no terminal de comandos, permitindo o processamento de múltiplos arquivos simultaneamente. </FONT></FONT>
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt">Há
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
um excelente artigo chamado <I><B>19 Ffmpeg Commands For All Needs</B></I><I>
<FONT FACE="Georgia, serif"><FONT SIZE=4>Há um excelente artigo
</I><I><B>(19 comandos de ffmpeg para todas as necessidades)</B></I>
chamado [http://www.catswhocode.com/blog/19-ffmpeg-commands-for-all-needs 19 Ffmpeg Commands For All Needs] (19
que oferece algumas receitas simples e muito uteis para quem quer
comandos de ffmpeg para todas as necessidades) que oferece algumas receitas simples e muito uteis para quem quer
usar o <B>ffmpeg</B>. Apresento a seguir, em uma tradução mais ou
usar o <B>ffmpeg</B>. Apresento a seguir, em uma tradução mais ou menos livre deste citado artigo, o passo-a-passo de muitos comandos.</FONT></FONT></P>
menos livre deste citado artigo, o passo-a-passo de muitos comandos.</FONT></FONT></P>
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
<BR>
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt">Maiores
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
detalhes sobre o ffmpeg podem ser consultados também diretamente na
<FONT FACE="Georgia, serif"><FONT SIZE=4>Maiores detalhes sobre o
documentação que vem junto com o programa (man ffmpeg) ou no
ffmpeg podem ser consultados também diretamente na documentação
conjunto de referências no final desta página.</FONT></FONT></P>
que vem junto com o programa (<B>man ffmpeg, </B><SPAN STYLE="font-weight: normal">conforme
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
mostrado na figura acima</SPAN>) ou no conjunto de referências no
 
final desta página.</FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt"><B>1.
 
Obter informação de um vídeo</B></FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4></FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm"> <FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt">ffmpeg
=== 1.Obter informação de um vídeo ===
-i video.avi</FONT></FONT></P>
 
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<TR>
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Georgia, serif"><FONT SIZE=4>$
ffmpeg -i video.avi</FONT></FONT></P>
</TD>
</TR>
 
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt">Este
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
comando mostra as informações implícitas de um determinado arquivo
<FONT FACE="Georgia, serif"><FONT SIZE=4>Este comando mostra as
de vídeo, tais como codecs de audio e vídeo utilizados em sua
informações implícitas de um determinado arquivo de vídeo, tais
composição.</FONT></FONT></P>
como codecs de audio e vídeo utilizados em sua composição.</FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt"><B>2.
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4></FONT></FONT></P>
Transformar uma sequencia de imagens em um vídeo</B></FONT></FONT></P>
 
<P CLASS="western" STYLE="margin-bottom: 0cm">  <FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt">ffmpeg
=== 2.Transformar uma sequência de imagens em um vídeo ===
-f image2 -i <FONT COLOR="#ff0000"><B>fotos</B></FONT>%02d.jpg
video.mpg</FONT></FONT></P>


<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<TR>
<TD WIDTH=100% VALIGN=TOP>
 
<P CLASS="western"><FONT FACE="Georgia, serif"><FONT SIZE=4>$
ffmpeg -f image2 -i <FONT COLOR="#ff0000"><B>fotos</B></FONT>%02d.jpg
video.mpg</FONT></FONT></P>
</TD>
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
</P>
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt">Este
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
comando irá transformar todas as imagens do diretório corrente ou
<FONT FACE="Georgia, serif"><FONT SIZE=4>Este comando irá
indicado (no caso fotos01.jpg, fotos02.jpg, fotos03.jpg, etc que
transformar todas as imagens do diretório corrente ou indicado (no
estão na próprio diretório onde o usuário executa o comando) em
caso fotos01.jpg, fotos02.jpg, fotos03.jpg, etc que estão na próprio
um arquivo de vídeo chamado </FONT></FONT><CODE CLASS="western"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt">video.mpg.</FONT></FONT></CODE><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt">
diretório onde o usuário executa o comando) em um arquivo de vídeo
É importante dizer que no lugar de </FONT></FONT><FONT COLOR="#ff0000"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt"><B>fotos
chamado </FONT></FONT><CODE CLASS="western"><FONT FACE="Georgia, serif"><FONT SIZE=4>video.mpg.</FONT></FONT></CODE><FONT FACE="Georgia, serif"><FONT SIZE=4>
</B></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt"><SPAN STYLE="font-weight: normal">você
É importante dizer que no lugar de </FONT></FONT><FONT COLOR="#ff0000"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>fotos
 
</B></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="Georgia, serif"><FONT SIZE=4><SPAN STYLE="font-weight: normal">você
deve escrever o nome comum dos arquivos de imagem que estão no
deve escrever o nome comum dos arquivos de imagem que estão no
diretório em questão, ou seja, se suas imagens tem como nome
diretório em questão, ou seja, se suas imagens tem como nome
pinguim001.jpg, pinguim002.jpg, etc, então vc deverá escrever o
pinguim001.jpg, pinguim002.jpg, etc, então vc deverá escrever o
comando assim: ffmpeg -f image2 -i </SPAN></FONT></FONT></FONT><FONT COLOR="#ff0000"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt"><B>pinguim</B></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt"><SPAN STYLE="font-weight: normal">%</SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt"><B>03</B></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt"><SPAN STYLE="font-weight: normal">d.jpg
comando assim: ffmpeg -f image2 -i </SPAN></FONT></FONT></FONT><FONT COLOR="#ff0000"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>pinguim</B></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="Georgia, serif"><FONT SIZE=4><SPAN STYLE="font-weight: normal">%</SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>03</B></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="Georgia, serif"><FONT SIZE=4><SPAN STYLE="font-weight: normal">d.jpg
video.mpg, onde pinguim é o nome comum da sequencia de fotos e 03 é
video.mpg, onde pinguim é o nome comum da sequencia de fotos e 03 é
o tamanho da casa numérica. </SPAN></FONT></FONT></FONT>
o tamanho da casa numérica. </SPAN></FONT></FONT></FONT>
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt">Exemplo
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Times New Roman, serif"><FONT FACE="Georgia, serif"><FONT SIZE=4>Exemplo
de uso do comando de conversão de fotos em vídeo no ffmpeg:
de uso do comando de conversão de fotos em vídeo no ffmpeg:
<A HREF="http://www.youtube.com/watch#!v=rKhdGZm_zZw">http://www.youtube.com/watch#!v=rKhdGZm_zZw</A></FONT></FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
<FONT FACE="Georgia, serif"><FONT SIZE=4>Você também pode fazer de
maneira mais simples, utilizando outros formatos de conversão
suportados pelo ffmpeg. Ex: fmpeg -i fotos%03d.jpg video.avi
Neste
caso não há especificação do codec de conversão a ser utilizado
no processo e o vídeo final é convertido para .avi.</FONT></FONT></P>


<A HREF="http://www.youtube.com/watch#!v=rKhdGZm_zZw">http://www.youtube.com/watch#!v=rKhdGZm_zZw</A></FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt">Você
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>3.
também pode fazer de maneira mais simples, utilizando outros
Transformar um vídeo em uma sequência de imagens</B> </FONT></FONT></P>
formatos de conversão suportados pelo ffmpeg. Ex: fmpeg -i
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
fotos%03d.jpg video.avi
<COL WIDTH=256*>
Neste caso não há especificação do codec
<TR>
de conversão a ser utilizado no processo e o vídeo final é
<TD WIDTH=100% VALIGN=TOP>
convertido para .avi.</FONT></FONT></P>
<P CLASS="western"><FONT FACE="Georgia, serif"><FONT SIZE=4>$
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
ffmpeg -i video.mpg <FONT COLOR="#ff0000"><B>fotos</B></FONT>%<FONT COLOR="#ff0000"><B>02</B></FONT>d.jpg</FONT></FONT></P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt"><B>3.
Transformar um vídeo em uma sequência de imagens</B></FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm"> <FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt">ffmpeg
-i video.mpg <FONT COLOR="#ff0000"><B>fotos</B></FONT>%<FONT COLOR="#ff0000"><B>02</B></FONT>d.jpg</FONT></FONT></P>


<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
</TD>
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt">Este
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4>Este
comando, ao contrário do anterior, gera imagens a partir de um
comando, ao contrário do anterior, gera imagens a partir de um
vídeo, ou seja, transforma um vídeo em imagens. O processo se dá
vídeo, ou seja, transforma um vídeo em imagens. O processo se dá
Linha 118: Linha 136:
PGMYUV, JPEG, GIF, PNG, TIFF, SGI. </FONT></FONT>
PGMYUV, JPEG, GIF, PNG, TIFF, SGI. </FONT></FONT>
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>4.
Codificar um vídeo para mp4 player, iPod/iPhone</B> </FONT></FONT></P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
 
<TR>
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Georgia, serif"><FONT SIZE=4>ffmpeg
-i video.avi -acodec aac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2
-cmp 2 -subcmp 2 -s 320x180 video_para_player.mp4</FONT></FONT></P>
</TD>
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
<FONT FACE="Georgia, serif"><FONT SIZE=4>A maior parte dos tocadores
de vídeo portátil, os mp4 players, não rodam formatos livres de
encapsulamento de vídeo como .ogg e .ogv e nem mesmo codificações
bem difundidas como .avi. Estes aparelhos, em sua maioria, rodam
apenas arquivos .mp4 com audio codado em acc. Esse comando faz a
conversão de qualquer formato (.avi, .mod, .rmvb) para .mp4 com
audio em acc, possibilitando a leitura do arquivo de vídeo em mp4
players e ipods/iphones.</FONT></FONT></P>
 
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>5.
Codificar um vídeo para PlayStation</B> </FONT></FONT></P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
<TR>
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Georgia, serif"><FONT SIZE=4>$
ffmpeg -i video.avi -b 300 -s 320x240 -ab 32 -ar 24000 -acodec aac
final_video.mp4</FONT></FONT></P>
</TD>
 
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
<FONT FACE="Georgia, serif"><FONT SIZE=4>Do mesmo modo que o comando
acima, este aqui faz a conversão de formatos de vídeo, só que
nesse caso objetivando tocar o arquivo em video games playstation
e/ou ps2 portátil.</FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>6.
Converter um arquivo wav para Mp3 ou retirar o som de um vídeo</B> </FONT></FONT></P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
<TR>
 
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Courier New, monospace"><FONT SIZE=4>$
ffmpeg -i video_som.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 som.mp3</FONT></FONT></P>
</TD>
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4>ou
</FONT></FONT>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4> </FONT></FONT></P>
 
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
<TR>
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Courier New, monospace"><FONT SIZE=4>$
ffmpeg -i som_wav.wav -vn -ar 44100 -ac 2 -ab 192 -f mp3
som_mp3.mp3</FONT></FONT></P>
</TD>
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
 
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
<FONT FACE="Georgia, serif"><FONT SIZE=4>Este comando é ideal tanto
para quem quer converter um formato de audio pesado (wav) para um
mais leve (mp3), possibilitando assim ler o arquivo em diversos
dispositivos (mp3s players), como também é ideal para aqueles que
desejam extrair apenas o som de um determinado arquivo de vídeo. </FONT></FONT>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>7.
Converter .avi video para .mpg</B></FONT></FONT></P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
<TR>
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Courier New, monospace"><FONT SIZE=4>$
ffmpeg -i video.avi video.mpg</FONT></FONT></P>
 
</TD>
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>8.
Converter .mpg para .avi</B></FONT></FONT></P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
<TR>
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Courier New, monospace"><FONT SIZE=4>$
ffmpeg -i video.mpg video.avi</FONT></FONT></P>
 
</TD>
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>9.
Converter .avi para gif animado (não compactado)</B></FONT></FONT></P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
<TR>
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Courier New, monospace"><FONT SIZE=4>$
ffmpeg -i video.avi gif_animado.gif</FONT></FONT></P>
 
</TD>
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
<FONT FACE="Georgia, serif"><FONT SIZE=4>Este comando é ótimo para
transformar um pequeno vídeo em um gif animado, que depois pode ser
colocado em uma página web. No começo da Internet, quando não
existiam ferramentas como flash, muitos sites utilizam gif animados
para criar algum tipo de atrativo estético em suas páginas.
Entretanto essa tecnologia não é muito popular nos dias de hoje,
ainda que seja usada por vários sites.</FONT></FONT></P>
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
<BR>
</P>
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
<FONT FACE="Georgia, serif"><FONT SIZE=4>É bom lembrar que em alguns
casos será preciso especificar o número de cores, levando em
consideração que o padrão .gif possui limitações.</FONT></FONT></P>
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
 
<BR>
</P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
<TR>
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Georgia, serif"><FONT SIZE=4><FONT FACE="Courier New, monospace">$
ffmpeg -i video.avi -pix_fmt rgb24 gif_animado.gif</FONT></FONT></FONT></P>
</TD>
</TR>
</TABLE>
 
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4>
</FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>10.
Combinar um arquivo de vídeo com um arquivo de som</B></FONT></FONT></P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
<TR>
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Courier New, monospace"><FONT SIZE=4>$
ffmpeg -i som.wav -i video.avi video_com_som.mpg</FONT></FONT></P>
</TD>
</TR>
 
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
<FONT FACE="Georgia, serif"><FONT SIZE=4>Este comando é muito útil
quando se tem um vídeo sem som ou quando se quer colocar uma faixa
de audio inteira na composição de um determinado arquivo de vídeo.
Para vídeos feitos a partir da junção de uma porção de
fotografias, conforme ensinado no item 2 deste tutorial, a aplicação
deste comando para mixagem de som é bastante usual. É importante
ressaltar, no entanto, que o arquivo de vídeo tem de ter o mesmo
tempo do arquivo de audio para que haja sincronia entre os dois. </FONT></FONT>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>11.
Converter .avi para .flv</B></FONT></FONT></P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
<TR>
<TD WIDTH=100% VALIGN=TOP>
 
<P CLASS="western"><FONT FACE="Courier New, monospace"><FONT SIZE=4>$
ffmpeg -i video.avi -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f
flv video_em_flash.flv</FONT></FONT></P>
</TD>
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; line-height: 150%">
<FONT FACE="Georgia, serif"><FONT SIZE=4>Até há pouco tempo, um dos
codecs mais utilizados na transmissão de vídeos online, seja por
streaming ou videocast, era o flash (.flv). Por propiciar um tamanho
bastante reduzido e por manter um certa resolução aceitável, o
flash sempre foi um codec preferido de cada 9 em 10 webmanagers. Isso
está mudando com o codec h264 e com a implementação do codec livre
.ogg e .ogv no html5. Mas se você é daqueles que ainda gosta do
flash e precisa de um video em flash para colocar em sua página, use
esse comando para convertê-lo. </FONT></FONT>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>12.
Converter .avi para dv</B></FONT></FONT></P>
 
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
<TR>
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Courier New, monospace"><FONT SIZE=4>$
ffmpeg -i video.avi -s pal -r pal -aspect 4:3 -ar 48000 -ac 2
video_em_formato_dv.dv</FONT></FONT></P>
</TD>
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
 
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4>Ou:
</FONT></FONT>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
<TR>
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Courier New, monospace"><FONT SIZE=4>$
ffmpeg -i video.avi -target pal-dv video_dv.dv</FONT></FONT></P>
</TD>
 
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>13.
Converter .avi para mpeg para dvd players</B></FONT></FONT></P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
<TR>
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Courier New, monospace"><FONT SIZE=4>$
ffmpeg -i source_video.avi -target pal-dvd -ps 2000000000 -aspect
16:9 finale_video.mpeg</FONT></FONT></P>
 
</TD>
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>14.
Compactar .avi para divx</B></FONT></FONT></P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
<TR>
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Courier New, monospace"><FONT SIZE=4>$
ffmpeg -i video_origine.avi -s 320x240 -vcodec msmpeg4v2
video_finale.avi</FONT></FONT></P>
 
</TD>
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>15.
Compactar Ogg Theora para Mpeg dvd</B></FONT></FONT></P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
<TR>
 
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Courier New, monospace"><FONT SIZE=4>$
ffmpeg -i film_sortie_cinelerra.ogm -s 720x576 -vcodec mpeg2video
-acodec mp3 filme.mpg</FONT></FONT></P>
</TD>
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>16.
Compactar .avi para SVCD mpeg2</B></FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><I><B>Formato
NTSC</B></I> </FONT></FONT>
 
</P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
<TR>
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Courier New, monospace"><FONT SIZE=4>$
ffmpeg -i video_origine.avi -target ntsc-svcd video_finale.mpg</FONT></FONT></P>
</TD>
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
 
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><I><B>Formato
PAL</B></I> </FONT></FONT>
</P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
<TR>
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Courier New, monospace"><FONT SIZE=4>$
ffmpeg -i video_origine.avi -target pal-svcd video_finale.mpg</FONT></FONT></P>
</TD>
 
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>17.
Compactar vídeo no formato .avi para VCD mpeg2</B></FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><I><B>Formato
NTSC</B></I> </FONT></FONT>
</P>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
<TR>
 
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Georgia, serif"><FONT SIZE=4><FONT FACE="Courier New, monospace">$
ffmpeg -i video_origine.avi -target ntsc-vcd video_finale.mpg</FONT></FONT></FONT></P>
</TD>
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><I><B>Formato
PAL</B></I> </FONT></FONT>
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=256*>
 
<TR>
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Courier New, monospace"><FONT SIZE=4>$
ffmpeg -i video.avi -target pal-vcd video_finale.mpg</FONT></FONT></P>
</TD>
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt"><B>4.
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>18.
Codificar um vídeo para mp4 player, iPod/iPhone</B></FONT></FONT></P>
Codificação em múltiplos passos (multi-pass) com ffmpeg</B></FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm"> <FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt">ffmpeg
<TABLE WIDTH=100% BORDER=1 BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0>
-i video.avi -acodec aac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2
 
-cmp 2 -subcmp 2 -s 320x180 video_para_player.mp4</FONT></FONT></P>
<COL WIDTH=256*>
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
<TR>
<TD WIDTH=100% VALIGN=TOP>
<P CLASS="western"><FONT FACE="Courier New, monospace"><FONT SIZE=4>$
ffmpeg -i fichierentree -pass 2 -passlogfile ffmpeg2pass
fichiersortie-2</FONT></FONT></P>
</TD>
</TR>
</TABLE>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
</P>
<P CLASS="western" ALIGN=JUSTIFY STYLE="margin-bottom: 0cm"><FONT FACE="Times New Roman, serif"><FONT SIZE=4 STYLE="font-size: 16pt">A
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>19.
maior parte dos tocadores de vídeo portátil, os mp4 players, não
Cortando um vídeo por tempo de duração</B></FONT></FONT></P>
rodam formatos livres de encapsulamento de vídeo como .ogg e .ogv e
 
nem mesmo codificações bem difundidas como .avi. Estes aparelhos,
 
em sua maioria, rodam apenas arquivos .mp4 com audio codado em acc.
<TABLE WIDTH=100% BORDER=0 CELLPADDING=4 CELLSPACING=0>
Esse comando faz a conversão de qualquer formato (.avi, .mod, .rmvb)
<TR VALIGN=TOP>
para .mp4 com audio em acc, possibilitando a leitura do arquivo de
<TD ROWSPAN=3 WIDTH=60%>
vídeo em mp4 players e ipods/iphones.</FONT></FONT></P>
==Referências em texto: ==
 
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Georgia, serif"><FONT SIZE=4>
* Kretcheu Video Blog
</FONT></FONT></P> <P CLASS="western" STYLE="margin-bottom: 0cm"><A HREF="http://www.kretcheu.com.br/"><FONT FACE="Georgia, serif"><FONT SIZE=4>http://www.kretcheu.com.br</FONT></FONT></A></P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Georgia, serif"><FONT SIZE=4>Dicas
L - Receitas prontas para usar o comando ffmpeg, por Rubens
Queiroz de Almeida:</FONT></FONT></P>
 
<P CLASS="western" STYLE="margin-bottom: 0cm"><A HREF="http://www.dicas-l.com.br/dicas-l/20100312.php"><FONT FACE="Georgia, serif"><FONT SIZE=4>http://www.dicas-l.com.br/dicas-l/20100312.phpa</FONT></FONT></A></P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Georgia, serif"><FONT SIZE=4>Page
Online – Como converter vídeos no Linux:</FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><A HREF="http://pajeonline.blogspot.com/2009/05/como-converter-videos-no-linux.html"><FONT FACE="Georgia, serif"><FONT SIZE=4>http://pajeonline.blogspot.com/2009/05/como-converter-videos-no-linux.html</FONT></FONT></A></P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
</P>
 
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Georgia, serif"><FONT SIZE=4>Linux
&amp; Vida Livre - Uma grande ferramenta chamada ffmpeg:</FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><A HREF="http://linuxvidalivre.blogspot.com/2009/10/uma-grande-ferramenta-chamada-ffmpeg.html"><FONT FACE="Georgia, serif"><FONT SIZE=4>http://linuxvidalivre.blogspot.com/2009/10/uma-grande-ferramenta-chamada-ffmpeg.html</FONT></FONT></A></P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><A NAME="parent-fieldname-title"></A>
<FONT FACE="Georgia, serif"><FONT SIZE=4>Laboratório de
computação científica e visualização - Como cortar arquivos
mp3 usando o ffmpeg? </FONT></FONT>
 
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><A HREF="http://www.lccv.ufal.br/Members/diogotc/blog/como-cortar-arquivos-mp3-usando-o-ffmpeg"><FONT FACE="Georgia, serif"><FONT SIZE=4>http://www.lccv.ufal.br/Members/diogotc/blog/como-cortar-arquivos-mp3-usando-o-ffmpeg</FONT></FONT></A></P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><A NAME="post-81"></A>
<FONT FACE="Georgia, serif"><FONT SIZE=4>Pa’ no olvidar - Cortar
vídeo com ffmpeg</FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><A HREF="http://panoolvidar.wordpress.com/2010/02/09/cortar-video-con-ffmpeg/"><FONT FACE="Georgia, serif"><FONT SIZE=4>http://panoolvidar.wordpress.com/2010/02/09/cortar-video-con-ffmpeg/</FONT></FONT></A></P>


<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>Manual
completo traduzido do ffmpeg:</B></FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm"><BR>
</P>
<P CLASS="western" STYLE="margin-left: 0.01cm; margin-right: 0.06cm">
<A HREF="http://wiki.nosdigitais.teia.org.br/images/e/e2/Ffmpeg_traduzido_rev_14736.pdf"><FONT FACE="Georgia, serif"><FONT SIZE=4>http://wiki.nosdigitais.teia.org.br/images/e/e2/Ffmpeg_traduzido_rev_14736.pdf</FONT></FONT></A></P>
</TD>


<TD WIDTH=40%>
== Referências em video-tutoriais ==
<P CLASS="western">&lt;video type=&quot;youtube&quot;
id=&quot;gCCWucsvr_A&quot; width=&quot;270&quot; height=&quot;203&quot;


==Referências em vídeo:==
desc=&quot;[http://www.youtube.com/watch?v=gCCWucsvr_A Convertendo
videos com ffmpeg ]&quot; frame=&quot;true&quot; position=&quot;right&quot;
size=&quot;full&quot; allowfullscreen=&quot;true&quot;/&gt;</P>


<div align=center>
</TD>
</TR>
<TR VALIGN=TOP>
<TD WIDTH=50%>
<P CLASS="western">&lt;video type=&quot;youtube&quot;
id=&quot;WFHYV7N2nxU&quot; width=&quot;270&quot; height=&quot;203&quot;


<video type="youtube" id="gCCWucsvr_A" width="270" height="203" desc="[http://www.youtube.com/watch?v=gCCWucsvr_A Convertendo videos com ffmpeg ]" frame="true" position="right" size="full" allowfullscreen="true"/>
desc=&quot;[http://www.youtube.com/watch?v=WFHYV7N2nxU Tutorial:
Usando o FFmpeg para gravar um screencast no Linux]&quot;
frame=&quot;true&quot; position=&quot;right&quot; size=&quot;full&quot;
allowfullscreen=&quot;true&quot;/&gt;</P>


<video type="youtube" id="WFHYV7N2nxU" width="270" height="203" desc="[http://www.youtube.com/watch?v=WFHYV7N2nxU Tutorial: Usando o FFmpeg para gravar um screencast no Linux]" frame="true" position="right" size="full" allowfullscreen="true"/>
</TD>
</TR>
<TR VALIGN=TOP>
<TD WIDTH=50%>
<P CLASS="western">&lt;video type=&quot;youtube&quot;
id=&quot;a8gqOiiMC5s&quot; width=&quot;270&quot; height=&quot;203&quot;


<video type="youtube" id="a8gqOiiMC5s" width="270" height="203" desc="[http://www.youtube.com/watch?v=a8gqOiiMC5s Software Livre - Palestra: Video com softwares livres]" frame="true" position="right" size="full" allowfullscreen="true"/>
desc=&quot;[http://www.youtube.com/watch?v=a8gqOiiMC5s Software
Livre - Palestra: Video com softwares livres]&quot; frame=&quot;true&quot;
position=&quot;right&quot; size=&quot;full&quot;
allowfullscreen=&quot;true&quot;/&gt;</P>


</div>
</TD>
</TR>
</TABLE>
 
== Referências em texto:==
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4>Kretcheu
Video Blog</FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><A HREF="http://www.kretcheu.com.br/"><FONT FACE="Georgia, serif"><FONT SIZE=4>http://www.kretcheu.com.br</FONT></FONT></A></P>
 
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4>Dicas
L - Receitas prontas para usar o comando ffmpeg, por Rubens Queiroz
de Almeida:</FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><A HREF="http://www.dicas-l.com.br/dicas-l/20100312.php"><FONT FACE="Georgia, serif"><FONT SIZE=4>http://www.dicas-l.com.br/dicas-l/20100312.phpa</FONT></FONT></A></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4>Page
Online – Como converter vídeos no Linux:</FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><A HREF="http://pajeonline.blogspot.com/2009/05/como-converter-videos-no-linux.html"><FONT FACE="Georgia, serif"><FONT SIZE=4>http://pajeonline.blogspot.com/2009/05/como-converter-videos-no-linux.html</FONT></FONT></A></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4>Linux
&amp; Vida Livre - Uma grande ferramenta chamada ffmpeg:</FONT></FONT></P>
 
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><A HREF="http://linuxvidalivre.blogspot.com/2009/10/uma-grande-ferramenta-chamada-ffmpeg.html"><FONT FACE="Georgia, serif"><FONT SIZE=4>http://linuxvidalivre.blogspot.com/2009/10/uma-grande-ferramenta-chamada-ffmpeg.html</FONT></FONT></A></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><A NAME="parent-fieldname-title"></A>
<FONT FACE="Georgia, serif"><FONT SIZE=4>Laboratório de computação
científica e visualização - Como cortar arquivos mp3 usando o
ffmpeg? </FONT></FONT>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><A HREF="http://www.lccv.ufal.br/Members/diogotc/blog/como-cortar-arquivos-mp3-usando-o-ffmpeg"><FONT FACE="Georgia, serif"><FONT SIZE=4>http://www.lccv.ufal.br/Members/diogotc/blog/como-cortar-arquivos-mp3-usando-o-ffmpeg</FONT></FONT></A></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><A NAME="post-81"></A>
<FONT FACE="Georgia, serif"><FONT SIZE=4>Pa’ no olvidar - Cortar
vídeo com ffmpeg</FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><A HREF="http://panoolvidar.wordpress.com/2010/02/09/cortar-video-con-ffmpeg/"><FONT FACE="Georgia, serif"><FONT SIZE=4>http://panoolvidar.wordpress.com/2010/02/09/cortar-video-con-ffmpeg/</FONT></FONT></A></P>
 
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Georgia, serif"><FONT SIZE=4><B>Manual
completo traduzido do ffmpeg:</B></FONT></FONT></P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><BR>
</P>
<P CLASS="western" STYLE="margin-bottom: 0cm; line-height: 150%"><FONT FACE="Times New Roman, serif"><A HREF="http://wiki.nosdigitais.teia.org.br/images/e/e2/Ffmpeg_traduzido_rev_14736.pdf"><FONT FACE="Georgia, serif"><FONT SIZE=4>http://wiki.nosdigitais.teia.org.br/images/e/e2/Ffmpeg_traduzido_rev_14736.pdf</FONT></FONT></A></FONT></P>

Edição das 18h54min de 21 de maio de 2010

Imagem do comando man ffmpeg no terminal.

Usuários de sistemas GNU/Linux, especialmente os que trabalham com edição e reprodução de vídeo, certamente conhecem ou já ouviram falar do programa de linha de comandos ffmpeg.

O que nem todos conhecem é a maneira de melhor usá-lo. Essa página pretende dar um panorama geral da sintaxe e do uso do ffmpeg, bem como, indicar boas referências para quem quer se aprofundar no seu uso. Mas sem maiores papos, vamos lá!


Usando o ffmpeg

Com este programa você pode cortar, converter, equalizar, juntar e até mudar o brilho e o contraste de um vídeo, entre outras coisas. É sem dúvida, a melhor e mais rápida opção para, por exemplo, quem quer converter um vídeo bruto pesado, capturado de uma câmera filmadora, para um formato mais leve como .mp4 e/ou .ogg.

Entretanto existem algumas características que no ffmpeg que as vezes afastam o usuário sem prática. Uma desvantagem, especialmente para usuários iniciantes em sistemas Gnu/Linux, é que as opções são inúmeras e requerem um grande conhecimento da terminologia associada à tecnologia de áudio e vídeo. Em casos assim, uma interface gráfica ajuda muito. Mas tem também as receitas prontas, que funcionam muito bem e que podem ser usadas no terminal de comandos, permitindo o processamento de múltiplos arquivos simultaneamente.


Há um excelente artigo chamado 19 Ffmpeg Commands For All Needs (19 comandos de ffmpeg para todas as necessidades) que oferece algumas receitas simples e muito uteis para quem quer usar o ffmpeg. Apresento a seguir, em uma tradução mais ou menos livre deste citado artigo, o passo-a-passo de muitos comandos.


Maiores detalhes sobre o ffmpeg podem ser consultados também diretamente na documentação que vem junto com o programa (man ffmpeg, conforme mostrado na figura acima) ou no conjunto de referências no final desta página.



1.Obter informação de um vídeo

$ ffmpeg -i video.avi


Este comando mostra as informações implícitas de um determinado arquivo de vídeo, tais como codecs de audio e vídeo utilizados em sua composição.


2.Transformar uma sequência de imagens em um vídeo

$ ffmpeg -f image2 -i fotos%02d.jpg video.mpg


Este comando irá transformar todas as imagens do diretório corrente ou indicado (no caso fotos01.jpg, fotos02.jpg, fotos03.jpg, etc que estão na próprio diretório onde o usuário executa o comando) em um arquivo de vídeo chamado video.mpg. É importante dizer que no lugar de fotos você deve escrever o nome comum dos arquivos de imagem que estão no diretório em questão, ou seja, se suas imagens tem como nome pinguim001.jpg, pinguim002.jpg, etc, então vc deverá escrever o comando assim: ffmpeg -f image2 -i pinguim%03d.jpg video.mpg, onde pinguim é o nome comum da sequencia de fotos e 03 é o tamanho da casa numérica.


Exemplo de uso do comando de conversão de fotos em vídeo no ffmpeg: <A HREF="http://www.youtube.com/watch#!v=rKhdGZm_zZw">http://www.youtube.com/watch#!v=rKhdGZm_zZw</A>


Você também pode fazer de maneira mais simples, utilizando outros formatos de conversão suportados pelo ffmpeg. Ex: fmpeg -i fotos%03d.jpg video.avi Neste caso não há especificação do codec de conversão a ser utilizado no processo e o vídeo final é convertido para .avi.


3. Transformar um vídeo em uma sequência de imagens

<COL WIDTH=256*>

$ ffmpeg -i video.mpg fotos%02d.jpg


Este comando, ao contrário do anterior, gera imagens a partir de um vídeo, ou seja, transforma um vídeo em imagens. O processo se dá capturando frame a frame, quadro a quadro, as imagens que compõem o vídeo. São suportados os formatos de imagem do tipo PGM, PPM, PAM, PGMYUV, JPEG, GIF, PNG, TIFF, SGI.


4. Codificar um vídeo para mp4 player, iPod/iPhone

<COL WIDTH=256*>

ffmpeg -i video.avi -acodec aac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2 -cmp 2 -subcmp 2 -s 320x180 video_para_player.mp4


A maior parte dos tocadores de vídeo portátil, os mp4 players, não rodam formatos livres de encapsulamento de vídeo como .ogg e .ogv e nem mesmo codificações bem difundidas como .avi. Estes aparelhos, em sua maioria, rodam apenas arquivos .mp4 com audio codado em acc. Esse comando faz a conversão de qualquer formato (.avi, .mod, .rmvb) para .mp4 com audio em acc, possibilitando a leitura do arquivo de vídeo em mp4 players e ipods/iphones.


5. Codificar um vídeo para PlayStation

<COL WIDTH=256*>

$ ffmpeg -i video.avi -b 300 -s 320x240 -ab 32 -ar 24000 -acodec aac final_video.mp4


Do mesmo modo que o comando acima, este aqui faz a conversão de formatos de vídeo, só que nesse caso objetivando tocar o arquivo em video games playstation e/ou ps2 portátil.


6. Converter um arquivo wav para Mp3 ou retirar o som de um vídeo

<COL WIDTH=256*>

$ ffmpeg -i video_som.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 som.mp3


ou

<COL WIDTH=256*>

$ ffmpeg -i som_wav.wav -vn -ar 44100 -ac 2 -ab 192 -f mp3 som_mp3.mp3


Este comando é ideal tanto para quem quer converter um formato de audio pesado (wav) para um mais leve (mp3), possibilitando assim ler o arquivo em diversos dispositivos (mp3s players), como também é ideal para aqueles que desejam extrair apenas o som de um determinado arquivo de vídeo.


7. Converter .avi video para .mpg

<COL WIDTH=256*>

$ ffmpeg -i video.avi video.mpg


8. Converter .mpg para .avi

<COL WIDTH=256*>

$ ffmpeg -i video.mpg video.avi


9. Converter .avi para gif animado (não compactado)

<COL WIDTH=256*>

$ ffmpeg -i video.avi gif_animado.gif


Este comando é ótimo para transformar um pequeno vídeo em um gif animado, que depois pode ser colocado em uma página web. No começo da Internet, quando não existiam ferramentas como flash, muitos sites utilizam gif animados para criar algum tipo de atrativo estético em suas páginas. Entretanto essa tecnologia não é muito popular nos dias de hoje, ainda que seja usada por vários sites.


É bom lembrar que em alguns casos será preciso especificar o número de cores, levando em consideração que o padrão .gif possui limitações.


<COL WIDTH=256*>

$ ffmpeg -i video.avi -pix_fmt rgb24 gif_animado.gif

10. Combinar um arquivo de vídeo com um arquivo de som

<COL WIDTH=256*>

$ ffmpeg -i som.wav -i video.avi video_com_som.mpg


Este comando é muito útil quando se tem um vídeo sem som ou quando se quer colocar uma faixa de audio inteira na composição de um determinado arquivo de vídeo. Para vídeos feitos a partir da junção de uma porção de fotografias, conforme ensinado no item 2 deste tutorial, a aplicação deste comando para mixagem de som é bastante usual. É importante ressaltar, no entanto, que o arquivo de vídeo tem de ter o mesmo tempo do arquivo de audio para que haja sincronia entre os dois.


11. Converter .avi para .flv

<COL WIDTH=256*>

$ ffmpeg -i video.avi -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f flv video_em_flash.flv


Até há pouco tempo, um dos codecs mais utilizados na transmissão de vídeos online, seja por streaming ou videocast, era o flash (.flv). Por propiciar um tamanho bastante reduzido e por manter um certa resolução aceitável, o flash sempre foi um codec preferido de cada 9 em 10 webmanagers. Isso está mudando com o codec h264 e com a implementação do codec livre .ogg e .ogv no html5. Mas se você é daqueles que ainda gosta do flash e precisa de um video em flash para colocar em sua página, use esse comando para convertê-lo.


12. Converter .avi para dv

<COL WIDTH=256*>

$ ffmpeg -i video.avi -s pal -r pal -aspect 4:3 -ar 48000 -ac 2 video_em_formato_dv.dv


Ou:


<COL WIDTH=256*>

$ ffmpeg -i video.avi -target pal-dv video_dv.dv


13. Converter .avi para mpeg para dvd players

<COL WIDTH=256*>

$ ffmpeg -i source_video.avi -target pal-dvd -ps 2000000000 -aspect 16:9 finale_video.mpeg


14. Compactar .avi para divx

<COL WIDTH=256*>

$ ffmpeg -i video_origine.avi -s 320x240 -vcodec msmpeg4v2 video_finale.avi




15. Compactar Ogg Theora para Mpeg dvd

<COL WIDTH=256*>

$ ffmpeg -i film_sortie_cinelerra.ogm -s 720x576 -vcodec mpeg2video -acodec mp3 filme.mpg


16. Compactar .avi para SVCD mpeg2


Formato NTSC

<COL WIDTH=256*>

$ ffmpeg -i video_origine.avi -target ntsc-svcd video_finale.mpg


Formato PAL

<COL WIDTH=256*>

$ ffmpeg -i video_origine.avi -target pal-svcd video_finale.mpg


17. Compactar vídeo no formato .avi para VCD mpeg2


Formato NTSC

<COL WIDTH=256*>

$ ffmpeg -i video_origine.avi -target ntsc-vcd video_finale.mpg

Formato PAL

<COL WIDTH=256*>

$ ffmpeg -i video.avi -target pal-vcd video_finale.mpg


18. Codificação em múltiplos passos (multi-pass) com ffmpeg

<COL WIDTH=256*>

$ ffmpeg -i fichierentree -pass 2 -passlogfile ffmpeg2pass fichiersortie-2


19. Cortando um vídeo por tempo de duração


Referências em texto:

  • Kretcheu Video Blog

<A HREF="http://www.kretcheu.com.br/">http://www.kretcheu.com.br</A>


Dicas L - Receitas prontas para usar o comando ffmpeg, por Rubens Queiroz de Almeida:

<A HREF="http://www.dicas-l.com.br/dicas-l/20100312.php">http://www.dicas-l.com.br/dicas-l/20100312.phpa</A>


Page Online – Como converter vídeos no Linux:

<A HREF="http://pajeonline.blogspot.com/2009/05/como-converter-videos-no-linux.html">http://pajeonline.blogspot.com/2009/05/como-converter-videos-no-linux.html</A>


Linux & Vida Livre - Uma grande ferramenta chamada ffmpeg:

<A HREF="http://linuxvidalivre.blogspot.com/2009/10/uma-grande-ferramenta-chamada-ffmpeg.html">http://linuxvidalivre.blogspot.com/2009/10/uma-grande-ferramenta-chamada-ffmpeg.html</A>


<A NAME="parent-fieldname-title"></A> Laboratório de computação científica e visualização - Como cortar arquivos mp3 usando o ffmpeg?

<A HREF="http://www.lccv.ufal.br/Members/diogotc/blog/como-cortar-arquivos-mp3-usando-o-ffmpeg">http://www.lccv.ufal.br/Members/diogotc/blog/como-cortar-arquivos-mp3-usando-o-ffmpeg</A>


<A NAME="post-81"></A> Pa’ no olvidar - Cortar vídeo com ffmpeg

<A HREF="http://panoolvidar.wordpress.com/2010/02/09/cortar-video-con-ffmpeg/">http://panoolvidar.wordpress.com/2010/02/09/cortar-video-con-ffmpeg/</A>


Manual completo traduzido do ffmpeg:


<A HREF="http://wiki.nosdigitais.teia.org.br/images/e/e2/Ffmpeg_traduzido_rev_14736.pdf">http://wiki.nosdigitais.teia.org.br/images/e/e2/Ffmpeg_traduzido_rev_14736.pdf</A>

Referências em video-tutoriais

<video type="youtube" id="gCCWucsvr_A" width="270" height="203" desc="[http://www.youtube.com/watch?v=gCCWucsvr_A Convertendo videos com ffmpeg ]" frame="true" position="right" size="full" allowfullscreen="true"/>

<video type="youtube" id="WFHYV7N2nxU" width="270" height="203" desc="[http://www.youtube.com/watch?v=WFHYV7N2nxU Tutorial: Usando o FFmpeg para gravar um screencast no Linux]" frame="true" position="right" size="full" allowfullscreen="true"/>

<video type="youtube" id="a8gqOiiMC5s" width="270" height="203" desc="[http://www.youtube.com/watch?v=a8gqOiiMC5s Software Livre - Palestra: Video com softwares livres]" frame="true" position="right" size="full" allowfullscreen="true"/>

Referências em texto:


Kretcheu Video Blog

<A HREF="http://www.kretcheu.com.br/">http://www.kretcheu.com.br</A>


Dicas L - Receitas prontas para usar o comando ffmpeg, por Rubens Queiroz de Almeida:

<A HREF="http://www.dicas-l.com.br/dicas-l/20100312.php">http://www.dicas-l.com.br/dicas-l/20100312.phpa</A>


Page Online – Como converter vídeos no Linux:

<A HREF="http://pajeonline.blogspot.com/2009/05/como-converter-videos-no-linux.html">http://pajeonline.blogspot.com/2009/05/como-converter-videos-no-linux.html</A>


Linux & Vida Livre - Uma grande ferramenta chamada ffmpeg:

<A HREF="http://linuxvidalivre.blogspot.com/2009/10/uma-grande-ferramenta-chamada-ffmpeg.html">http://linuxvidalivre.blogspot.com/2009/10/uma-grande-ferramenta-chamada-ffmpeg.html</A>


<A NAME="parent-fieldname-title"></A> Laboratório de computação científica e visualização - Como cortar arquivos mp3 usando o ffmpeg?

<A HREF="http://www.lccv.ufal.br/Members/diogotc/blog/como-cortar-arquivos-mp3-usando-o-ffmpeg">http://www.lccv.ufal.br/Members/diogotc/blog/como-cortar-arquivos-mp3-usando-o-ffmpeg</A>


<A NAME="post-81"></A> Pa’ no olvidar - Cortar vídeo com ffmpeg

<A HREF="http://panoolvidar.wordpress.com/2010/02/09/cortar-video-con-ffmpeg/">http://panoolvidar.wordpress.com/2010/02/09/cortar-video-con-ffmpeg/</A>


Manual completo traduzido do ffmpeg:


<A HREF="http://wiki.nosdigitais.teia.org.br/images/e/e2/Ffmpeg_traduzido_rev_14736.pdf">http://wiki.nosdigitais.teia.org.br/images/e/e2/Ffmpeg_traduzido_rev_14736.pdf</A>