How to convert audio and keep track metadata with all formats

How to convert audio and keep track metadata with all formats



my inputs are multiple FLAC and OGG files.
I want to convert them all to mp3. (a script does batch converting, ffmpeg command only has to handle one input file).



I also want to keep the tags (song artist, track name, album name, ...).
My current command to do this is:


ffmpeg -vn -n -i $INFILE -c:a libmp3lame -q:a 1 -ar 44100 -map_metadata 0:s:0 -id3v2_version 3 $OUTFILE.mp3



Now the problem is: it works when the input file is an OGG file. But it doesn't work if input is a FLAC file.



I also found a command for FLAC input files:


ffmpeg -vn -n -i $INFILE -c:a libmp3lame -q:a 1 -ar 44100 $OUTFILE.mp3



(which is the same but without the map_metadata option. So FLAC tags are copied without that options. But without them it doesn't work for OGG input files. And with the options it doesn't work for FLAC input files.



How can I handle both input formats and keep tags of both without needing a different command?




1 Answer
1



Use


ffmpeg -n -i $INFILE -c:a libmp3lame -q:a 1 -ar 44100 -map_metadata 0 -map_metadata 0:s:0 -id3v2_version 3 -vn $OUTFILE.mp3



This maps both the global as well as stream metadata.



-vn belongs to the output.


-vn






Thanks, works :)

– Bleuzen
Sep 16 '18 at 13:57



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)