Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffmpeg convert audio to ogg and keep album cover

Tags:

ffmpeg

ogg

If I convert an audio file with an album cover thank's to:

ffmpeg -i sample1.flac -ar 48000 -vn -c:a libvorbis -b:a 320k sample1.ogg

My sample1.ogg file doesn't have any album cover. Is there a way to ask explicitly to ffmpeg to keep the cover ?

like image 835
Izaya Avatar asked Oct 22 '25 04:10

Izaya


2 Answers

instead "-vn" write "-c:v libtheora -q:a 10".

-vn - means no video, picture is frame of video in ffmpeg

like image 118
Баяр Гончикжапов Avatar answered Oct 24 '25 15:10

Баяр Гончикжапов


Sum up of answers I found: Remove the option -vn which means: no video, because thumbnail are frame of video. Use libtheora instead of libvorbis. If you get a bitrate error, remove option -b:a 320k. At the end we get:

ffmpeg -i file.flac -c:v libtheora -q:v 10 -c:a libvorbis file.ogg

This gives you a file with an audio and a video content.

If you prefer to extract thumbnail in a separate file (to re-add it later for example), use:

ffmpeg -i file.flac -an -vcodec copy thumbnail.jpg

Thank's to Баяр Гончикжапов for his help and answers!

like image 43
Izaya Avatar answered Oct 24 '25 13:10

Izaya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!