How to insert thumbnail in file . MP3

Asked

Viewed 144 times

0

I would like to know the right command to add thumbnail (jpg) to the file. mp3, my current command below converts normally, but only does not insert thumbnail because I do not know what is the command.

ffmpeg -i $tmp -ar 44100 -ab 128k -ac 2 $SAIDA_DO_MP3

I already tried the answer of this question but I was unsuccessful!

Can someone help me?

  • 1

    It wasn’t impressive, you really doubled the question. Re-creating really won’t help you get the answer faster. Try editing the question by providing more details of the doubt. Edit is the best way to get help.

  • @Articuno I excluded the other, because it was more than 2 days without reply.

  • 1

    @LÉO is not because there is no answer that needs to delete and redo, it is unnecessary work, you can try to throw reward or edit to make it clearer, read this: https://pt.meta.stackoverflow.com/a/3969/3635

  • All right, I’m sorry!

1 answer

1


As per this link http://ffmpeg.org/ffmpeg-formats.html#mp3, you should do so (at the terminal):

ffmpeg -i ArquivoOriginal.mp3 \
       -i CapaDoAlbum.png \
       -c copy \
       -map 0 \
       -map 1 \
       -metadata:s:v title="Titulo do album" \
       -metadata:s:v comment="Comentário" \
       ArquivoSalvo.mp3

So in PHP use with exec or system or popen, example:

//Aonde fica localizado a musica original
$original = escapeshellarg('/home/pasta/ArquivoOriginal.mp3');

//Aonde fica localizado a foto
$capa = escapeshellarg('/home/pasta/CapaDoAlbum.png');

//Local que deve salvar o arquivo com capa
$salvo = escapeshellarg('/home/pasta/ArquivoSalvo.mp3');

exec('ffmpeg -i ' . $original . ' -i ' . $capa . ' -c copy -map 0 -map 1 -metadata:s:v title="Titulo do album" -metadata:s:v comment="Comentário" ' . $salvo, $out);

print_r($out);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.