How can I convert .flac to .mp3 with ffmpeg, keeping all metadata (that is converting Vorbis comment in .flac files to ID3v2 metadata of .mp3)?
相关问题
- Improving accuracy of Google Cloud Speech API
- MP4 codec support in Chromium
- Streaming video (C# using FFmpeg AutoGen) sends mu
- How do I decode opus file to pcm file using libavc
- Convert pdf to Word document [closed]
相关文章
- Handling ffmpeg library interface change when upgr
- How to use a framework build of Python with Anacon
- c++ mp3 library [closed]
- Passing a native fd int to FFMPEG from openable UR
- FFmpeg - What does non monotonically increasing dt
- ffmpeg run from shell runs properly, but does not
- Why does System.Convert has ToDateTime that accept
- convert string to hex in python
I know that this was not asked, but considering that one of the reasons that this is done (at least that's what I wanted to do) is so that the music can be imported into Apple iTunes which doesn't support FLAC. In such case it makes more sense to convert FLAC to Apple's own lossless format, m4a. I used this command to convert all the files in the current folder, while retaining similar file sizes.
find . -name "*.flac" -exec ffmpeg -i {} -map_metadata 0 -acodec alac {}.m4a \;
I was testing the following command to convert
infile.flac
file tooutfile.mp3
:As of Ubuntu 16.04, the above command seems to copy (most of? all of?) the metadata.
-q:a 0
tellsffmpeg
to use the highest quality VBR.However,
ffmpeg
was transcoding my album art fromjpeg
topng
, which increased the size of the cover art.(I guess the above conversion sort of makes sense given how
ffmpeg
works.)After some digging, I found the
-c:v copy
option, which specifies that the video stream should be copied, rather than transcoded. The full command is:The above command results in:
One-liner to convert all
.flac
files to.mp3
in a single directory, keeping most metadata:for file in *.flac; do ffmpeg -i $file -q:a 0 ${file:r}.mp3; done
(Note:
${file:r}
removes the extension of the given filepath)Perfect answer above. I use it together with find to add all FLAC files in a subtree to iTunes with this command
To automatically add the resulting files to iTunes, get the iTunes import directory with
result e.g.
Then run e.g.
To automatically add all the converted tracks to iTunes.
The following command keep high quality on .mp3 (320 kbps), and metadata from .flac file are converted to ID3v2 format, which can be included in .mp3 files:
To recursively convert in mp3 all the flac files in nested folders, I used this command:
It will create a folder named "mp3" inside the one with flac files and, inside the mp3 folder, it will save relative mp3 files with a bitrate of 320kbps, without keeping the old file extension in the name.