Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ffmpeg won't retain id3 tags
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
Robert S
Guru
Guru


Joined: 15 Aug 2004
Posts: 415
Location: Canberra Australia

PostPosted: Mon Oct 01, 2012 10:54 am    Post subject: ffmpeg won't retain id3 tags Reply with quote

I am trying to batch convert iTunes m4a files to mp3 using ffmpeg. I would like to retain id3 tags. I've done a lot of googling but nothing I have seen seems to work. Can somebody help?

eg.
Code:
$ ffmpeg -y -i test.m4a -map_metadata 0 test.mp3
ffmpeg version 0.10.3 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jun 23 2012 07:17:33 with gcc 4.5.3
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-                     g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-O2 -pipe' --extra-cflags='-O2 -pipe' --extra-cxxflags='-O2 -pipe' --disable-static --enable-gpl --enable-postproc --enable-                     avfilter --disable-stripping --disable-debug --disable-doc --disable-network --disable-vaapi --disable-vdpau --disable-ffplay --enable-runtime-cpudetect --enable-libmp3                     lame --enable-libvorbis --disable-indev=v4l --disable-indev=v4l2 --disable-indev=alsa --disable-indev=oss --disable-indev=jack --disable-outdev=alsa --disable-outdev=os                     s --disable-outdev=sdl --disable-amd3dnow --disable-amd3dnowext --disable-altivec --disable-avx --disable-mmx2 --disable-ssse3 --disable-vis --disable-neon --enable-har                     dcoded-tables
  libavutil      51. 35.100 / 51. 35.100
  libavcodec     53. 61.100 / 53. 61.100
  libavformat    53. 32.100 / 53. 32.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 61.100 /  2. 61.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.m4a':
  Metadata:
    major_brand     : M4A
    minor_version   : 0
    compatible_brands: M4A mp42isom
    creation_time   : 2007-06-19 04:11:45
    title           : Piano Sonata In D Major, Op 40 No 3: Movement 1: Adagio Molto – Allegro
    artist          : Nikolai Demidenko
    album_artist    : Nikolai Demidenko
    composer        : Muzio Clementi
    album           : Clementi: Demidenko Plays Clementi
    genre           : Classical
    track           : 1/15
    disc            : 1/1
    date            : 2006-07-01T07:00:00Z
    gapless_playback: 0
    copyright       : ℗ 2006 Helios
    media_type      : 1
  Duration: 00:09:28.33, start: 0.000000, bitrate: 265 kb/s
    Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 256 kb/s
    Metadata:
      creation_time   : 2007-06-19 04:11:45
      handler_name    :
Output #0, mp3, to 'test.mp3':
  Metadata:
    major_brand     : M4A
    minor_version   : 0
    compatible_brands: M4A mp42isom
    TDEN            : 2007-06-19 04:11:45
    TIT2            : Piano Sonata In D Major, Op 40 No 3: Movement 1: Adagio Molto – Allegro
    TPE1            : Nikolai Demidenko
    TPE2            : Nikolai Demidenko
    TCOM            : Muzio Clementi
    TALB            : Clementi: Demidenko Plays Clementi
    TCON            : Classical
    TRCK            : 1/15
    TPOS            : 1/1
    TDRL            : 2006-07-01T07:00:00Z
    gapless_playback: 0
    TCOP            : ℗ 2006 Helios
    media_type      : 1
    TSSE            : Lavf53.32.100
    Stream #0:0(und): Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s
    Metadata:
      creation_time   : 2007-06-19 04:11:45
      handler_name    :
Stream mapping:
  Stream #0:0 -> #0:0 (aac -> libmp3lame)
Press [q] to stop, [?] for help
size=    8882kB time=00:09:28.37 bitrate= 128.0kbits/s
video:0kB audio:8881kB global headers:0kB muxing overhead 0.010556%

$ id3tool test.mp3
Filename: test.mp3
No ID3 Tag
Back to top
View user's profile Send private message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2070

PostPosted: Mon Oct 01, 2012 12:14 pm    Post subject: Reply with quote

Tried this
Code:
ffmpeg -i infile.m4a -map_meta_data outfile.mp3:infile.m4a outfile.mp3
?

I'm not sure, how tagging in AAC is different from MP3, so that may be the problem, but once you've figured out the needed fields, it should be trivial to wrap a script around it.
_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
Robert S
Guru
Guru


Joined: 15 Aug 2004
Posts: 415
Location: Canberra Australia

PostPosted: Mon Oct 01, 2012 1:11 pm    Post subject: Reply with quote

Tried that:

Code:
ffmpeg -i test.m4a -map_meta_data test.mp3:test.m4a test.mp3
Unrecognized option 'map_meta_data'
Failed to set value 'test.mp3:test.m4a' for option 'map_meta_data'

and
Code:
ffmpeg -i test.m4a -map_metadata test.mp3:test.m4a test.mp3
Invalid metadata type e.

The -map_meta_data option, which is all over the net, does not seem to exist for my version - its -map_metadata and I suspect that the syntax is different.
Back to top
View user's profile Send private message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2070

PostPosted: Mon Oct 01, 2012 1:23 pm    Post subject: Reply with quote

Mh, I'd just grab the metadata needed, decode via faad, pipe that to lame and re-insert the data with some tagger - should be quite easy and I couldn't find a working direct solution either.
_________________
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
Back to top
View user's profile Send private message
Robert S
Guru
Guru


Joined: 15 Aug 2004
Posts: 415
Location: Canberra Australia

PostPosted: Tue Oct 02, 2012 1:27 pm    Post subject: Reply with quote

I think I've nailed it - with ffmbc - from http://code.google.com/p/ffmbc/

Code:
ffmbc -y  -i test.m4a -map_meta_data test.mp3:test.m4a test.mp3

Seems to convert all metadata including cover art!
id3tool reports no id3 tag, but its there.

I'll put an ebuild onto bugs.gentoo.org when I get around to it.
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2171

PostPosted: Tue Oct 02, 2012 7:48 pm    Post subject: Reply with quote

Robert S ...

One problem will be with Apple's non standard use of tags, eg, "gnre" and "©gen", the former will be applied if your genre is in the list provided via iTunes, but the latter will be used if something other than this is provided (or the genre supplied via cddb is changed). As most players will expect 'gnre' there will be nothing provided for files tagged with "©gen". I'm not sure if ffmbc takes this into account but this may be the reason that id3tool doesn't see the tags.

There are similar discrepencies with other tags, artist, album artist, etc ... in my experience iTunes encoded audio are a pita.

best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum