Dump/load metadata with FFmpeg (WMA to MP3)

4

I need to convert WMA metadata into MP3 ID3 tags. FFmpeg should be able to dump them into a file and load them back to another using implemented mappers. I cannot find syntax of usage though:

http://ffmpeg.org/ffmpeg.html#Metadata

I cannot convert files using FFmpeg directly because it fails on 1% of them, which is critical for thousands of files. Some errors:

ff asf bad header 0  at:264993
[asf @ 0046DA60] ff asf skip 2252 (unknown stream)
[asf @ 0046DA60] ff asf bad header 0  at:267254
[mp3 @ 0003DA60] max_analyze_duration 5000000 reached at 5015510
Truncating packet of size 1024 to 563
[mp3 @ 0171b0c0] Header missing
get_buffer() failed
Error while decoding stream #0:0

I could convert them using Mplayer to WAV and then from WAV to MP3 using LAME, but losing metadata in the process.

I have not decided about workaround yet but I will not use mplayer and stay with ffmpeg. I analyzed/displayed wave of the files in audacity and it seems that I deal with 3 kind of errors:

  1. get_buffer() failed Error while decoding stream #0:0 [98% of bugs]:
    • seems to be caused by "truncated fade out" file ending or some missing frame
    • it's not listenable and mp3 file seems to be ok
  2. ff asf skip, bad header, truncating, .. [2% of bugs only]:
    • the file is broken in some way, not always listenable
    • just few of them contain a micro gap of cracking noise
  3. max_analyze_duration reached, Header missing [warnings only]:
    • very rare, maybe caused by wrongly ended or large header (with photo included etc.)
    • result file is fine to listen

The mplayer uses the ffmpeg and seems that it just ignores the bugs. I will probably ignore the get_buffer() error while keeping failed the other ones.

Jan Suvak

Posted 2012-01-12T12:05:54.630

Reputation: 41

Which operating system? What is the exact FFmpeg command you're using? Please copy the complete console output. – slhck – 2012-01-12T12:18:08.827

Please, don't focus on the errors listed. I need to know command line sample for: FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded INI-like text file and then load it back using the metadata muxer/demuxer.

fyi: Windows 7 x64: ffmpeg-git-1d0ae92-win32-shared ffmpeg-git-1d0ae92-win64-shared ffmpeg-git-1d0ae92-win32-static ffmpeg-git-1d0ae92-win64-static

The x64 version of ffmpeg failed on some files at all: ffmpeg.exe has stopped working windows dialog...

So, I cannot use ffmpeg for convert, I would like to use it just for transferring the tags (wma to id3 tags). – Jan Suvak – 2012-01-12T12:45:04.300

I don't know the command from the top of my head, but why don't you want to fix the initial problem? :) I assume this is a recent version (~December) of FFmpeg though? – slhck – 2012-01-12T12:54:26.567

I tried also some old version by Nov 30 2010 04:07:03... What works fine is the mplayer to wav and then lame to mp3... I don't insist on ffmpeg, I just came across: http://www.mp3tag.de/en/ which has command line interface, I will know more later...

– Jan Suvak – 2012-01-12T13:05:17.810

btw, http://www.mediacoderhq.com/ does the same: mplayer and lame. They just map metadata on their own. I can use MS .NET for the job, but I still hope that there is some freeware already tested for that...

– Jan Suvak – 2012-01-12T13:08:35.637

I think I will have to get tags by ffprobe as json (if I remeber well and json is supported) and then so pick some and set params for lame. I will get better control over tags like BPM, Track/Album Gain etc. – Jan Suvak – 2012-01-12T13:29:12.450

Sounds like a good plan — not sure if I can help you here really. You could also check out mediainfo. It has a command-line interface.

– slhck – 2012-01-12T13:47:49.253

mp3 tag might be useful in another way - you can dump it to folders by tag, and use that to do retagging – Journeyman Geek – 2012-01-12T22:17:02.113

Answers

3

You can dump metadata with:

ffmpeg -i in.mov -f ffmetadata metadata.txt  

You can import metadata with something like ( have never tried this):

ffmpeg -i in.mov -i metadata.txt -map_metadata 1 -c:a copy -id3v2_version 3 

Source: http://jonhall.info/how_to/create_id3_tags_using_ffmpeg

iphonedroid

Posted 2012-01-12T12:05:54.630

Reputation: 131

You would probably need to use -f ffmetadata -i metadata.txt – evilsoup – 2013-01-15T16:01:06.617