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.

random
  • 14,638
  • 9
  • 54
  • 58
Jan Suvak
  • 41
  • 1
  • 2
  • Which operating system? What is the exact FFmpeg command you're using? Please copy the complete console output. – slhck Jan 12 '12 at 12:18
  • 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 Jan 12 '12 at 12:45
  • 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 Jan 12 '12 at 12:54
  • 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 Jan 12 '12 at 13:05
  • 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 Jan 12 '12 at 13:08
  • 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 Jan 12 '12 at 13:29
  • Sounds like a good plan — not sure if I can help you here really. You could also check out [mediainfo](http://mediainfo.sourceforge.net/en). It has a command-line interface. – slhck Jan 12 '12 at 13:47
  • mp3 tag might be useful in another way - you can dump it to folders by tag, and use that to do retagging – Journeyman Geek Jan 12 '12 at 22:17

1 Answers1

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

Giacomo1968
  • 53,069
  • 19
  • 162
  • 212
iphonedroid
  • 131
  • 3