Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#3694 closed defect (fixed)

When transcoding from FLAC to MP3 the Year tag gets lost in the resulting mp3 file

Reported by: dslkjlskdjfllk Owned by: Benoit Fouet
Priority: normal Component: avformat
Version: git-master Keywords: id3v2 metadata
Cc: batguano999@zoho.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Carl Eugen Hoyos)

Pretty simple: Convert any properly tagged flag file to an mp3 file, and see that the resulting mp3 file does not have its YEAR tag set properly.

I tried:
D:\temp\playlists>ffmpeg -i "04 - Punk Rock Song (German Language Version)).flac" -qscale:a 2 output\PunkRockSong.mp3

As per the documentation, here is the result of the following command on my input file:

D:\temp\playlists>ffmpeg -v 9 -loglevel 99 -i "04 - Punk Rock Song (German Language Version)).flac"
ffmpeg version N-63593-g98a6806 Copyright (c) 2000-2014 the FFmpeg developers
  built on May 29 2014 22:09:02 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 87.100 / 52. 87.100
  libavcodec     55. 65.100 / 55. 65.100
  libavformat    55. 42.100 / 55. 42.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-i' ... matched as input file with argument '04 - Punk Rock Song (German Language Version)).flac'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input file 04 - Punk Rock Song (German Language Version)).flac.
Successfully parsed a group of options.
Opening an input file: 04 - Punk Rock Song (German Language Version)).flac.
[flac @ 0000000000310960] Format flac probed with size=2048 and score=50
[flac @ 0000000000310960] Before avformat_find_stream_info() pos: 8713 bytes read:32768 seeks:0
[flac @ 0000000000321960] sample/frame number mismatch in adjacent frames
    Last message repeated 14 times
[flac @ 0000000000310960] All info found
[flac @ 0000000000310960] After avformat_find_stream_info() pos: 69632 bytes read:98304 seeks:0 frames:1
Input #0, flac, from '04 - Punk Rock Song (German Language Version)).flac':
  Metadata:
    ARTIST          : Bad Religion
    TITLE           : Punk Rock Song (German Language Version))
    ALBUM           : Punk Rock Song (Single)
    DATE            : 1996
    track           : 04
    GENRE           : Punk Rock
  Duration: 00:02:27.03, start: 0.000000, bitrate: 1056 kb/s
    Stream #0:0, 1, 1/44100: Audio: flac, 44100 Hz, stereo, s16
Successfully opened the file.
At least one output file must be specified
[AVIOContext @ 0000000000319000] Statistics: 98304 bytes read, 0 seeks

I am using the latest version of ffmpeg under windows: FFmpeg Build Version: git-2e532aa (2014-05-31).

This can easily be reproduced.

Change History (19)

comment:1 by dslkjlskdjfllk, 11 years ago

I meant "flac" file, not "flag".

in reply to:  description comment:2 by Carl Eugen Hoyos, 11 years ago

Component: ffmpegundetermined
Description: modified (diff)
Keywords: tag year removed
Version: unspecifiedgit-master

Replying to dslkjlskdjfllk:

D:\temp\playlists>ffmpeg -i "04 - Punk Rock Song (German Language Version)).flac" -qscale:a 2 output\PunkRockSong.mp3

As per the documentation, here is the result of the following command on my input file:

The idea is of course that you provide the output of the failing command line above...

More important:
Please provide the output of ffmpeg -i output\PunkRockSong.mp3

I am using the latest version of ffmpeg under windows: FFmpeg Build Version: git-2e532aa (2014-05-31).

Your console output seems to disagree:

ffmpeg version N-63593-g98a6806

This can easily be reproduced.

I cannot reproduce it but I wonder what you mean with easy...

comment:3 by dslkjlskdjfllk, 10 years ago

Ok, let's try this again. It happens 100% of the time, with any file. I take a flac file and convert it to a mp3 file and, magically, the "year" tag disappear in the resulting mp3 file.

Here it is:

d:\ffmpeg\bin>ffmpeg -i "Bad Medicine.flac" -qscale:a 2 test.mp3
ffmpeg version N-63716-g763e714 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jun  2 2014 22:09:26 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth
--enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --ena
ble-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgme --e
nable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopenc
ore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-lib
rtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --e
nable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --en
able-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --
enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 89.100 / 52. 89.100
  libavcodec     55. 66.100 / 55. 66.100
  libavformat    55. 42.100 / 55. 42.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, flac, from 'Bad Medicine.flac':
  Metadata:
    TITLE           : Bad Medicine
    ARTIST          : Bon Jovi
    ALBUM           : New Jersey (Special Edition)
    GENRE           : Rock
    TRACKTOTAL      : 14
    TOTALTRACKS     : 14
    ISRC            : USPR39402228
    DATE            : 2010
    track           : 2
  Duration: 00:05:16.79, start: 0.000000, bitrate: 1082 kb/s
    Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
    Stream #0:1: Video: mjpeg, yuvj444p(pc), 350x348, 90k tbr, 90k tbn, 90k tbc
    Metadata:
      comment         : Cover (front)
[swscaler @ 0000000002bb07e0] deprecated pixel format used, make sure you did set range
 correctly
[mp3 @ 0000000002b5af20] Frame rate very high for a muxer not efficiently supporting it
.
Please consider specifying a lower framerate, a different muxer or -vsync 2
Output #0, mp3, to 'test.mp3':
  Metadata:
    TIT2            : Bad Medicine
    TPE1            : Bon Jovi
    TALB            : New Jersey (Special Edition)
    TCON            : Rock
    TRACKTOTAL      : 14
    TOTALTRACKS     : 14
    ISRC            : USPR39402228
    TDRL            : 2010
    TRCK            : 2
    TSSE            : Lavf55.42.100
    Stream #0:0: Video: png, rgb24, 350x348, q=2-31, 200 kb/s, 90k fps, 90k tbn, 90k tb
c
    Metadata:
      comment         : Cover (front)
      encoder         : Lavc55.66.100 png
    Stream #0:1: Audio: mp3 (libmp3lame), 44100 Hz, stereo, s16p
    Metadata:
      encoder         : Lavc55.66.100 libmp3lame
Stream mapping:
  Stream #0:1 -> #0:0 (mjpeg -> png)
  Stream #0:0 -> #0:1 (flac -> libmp3lame)
Press [q] to stop, [?] for help
frame=    1 fps=0.2 q=0.0 Lsize=    7829kB time=00:05:16.78 bitrate= 202.4kbits/s
video:237kB audio:7591kB subtitle:0kB other streams:0kB global headers:0kB muxing overh
ead: 0.005726%

Here is the info on the resulting file:

d:\ffmpeg\bin>ffmpeg -i test.mp3
ffmpeg version N-63716-g763e714 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jun  2 2014 22:09:26 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth
--enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --ena
ble-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgme --e
nable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopenc
ore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-lib
rtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --e
nable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --en
able-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --
enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      52. 89.100 / 52. 89.100
  libavcodec     55. 66.100 / 55. 66.100
  libavformat    55. 42.100 / 55. 42.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  5.100 /  4.  5.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mp3, from 'test.mp3':
  Metadata:
    title           : Bad Medicine
    artist          : Bon Jovi
    album           : New Jersey (Special Edition)
    genre           : Rock
    TRACKTOTAL      : 14
    TOTALTRACKS     : 14
    ISRC            : USPR39402228
    date            : 2010
    track           : 2
    encoder         : Lavf55.42.100
  Duration: 00:05:16.81, start: 0.025056, bitrate: 202 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 196 kb/s
    Stream #0:1: Video: png, rgb24, 350x348, 90k tbr, 90k tbn, 90k tbc
    Metadata:
      title           :
      comment         : Cover (front)
At least one output file must be specified

I see in the above "dump" that "datet=2010" but that isn't reflected in the ID Tag. When I play that file in winamp, the "Year" tag is empty in the mp3 but correctly filed in the original FLAC file. When I inspect both files in mp3tag, I get the same result: The year field is set for the flac, but empty for the mp3. Is it the case that the id tag is not properly built?

Thanks

Last edited 10 years ago by dslkjlskdjfllk (previous) (diff)

comment:4 by bat999, 10 years ago

"Is it the case that the id tag is not properly built?"
Hi
There are several id3 tag versions.
By default FFmpeg uses id3v2.4
Maybe Winamp and mp3tag can't recognize this version.

Try adding "-write_id3v1 1" to your command to write the id3v1 tag as well as the id3v2.4 tag.
Then test it with Winamp and mp3tag.

ffmpeg -i "Bad Medicine.flac" -qscale:a 2 -write_id3v1 1 test.mp3

If that fails, try using id3v2.3 instead of id3v2.4

ffmpeg -i "Bad Medicine.flac" -qscale:a 2 -id3v2_version 3 test.mp3

Last edited 10 years ago by bat999 (previous) (diff)

comment:5 by dslkjlskdjfllk, 10 years ago

Hi,

I do know there are different id tag versions, and I know for a fact that both winamp and mp3tag WILL read id tags v1 and id tag v2. In fact, in my example above, the title, artist, album and genre fields are properly filled for ID v2 (and readable both in winamp and mp3tag). It is the YEAR tag that is not filled.

I tried ffmpeg -i "Bad Medicine.flac" -qscale:a 2 -write_id3v1 1 test.mp3 and id tag v1 was correctly created, with the year field filled. But in the ID Tag v2.4, the year is missing.

I tried ffmpeg -i "Bad Medicine.flac" -qscale:a 2 -id3v2_version 3 test.mp3 and in that case, indeed the year tagt is correctly filled with "2010" - both in winamp and in mp3 tag.

But, again, when I try ffmpeg -i "Bad Medicine.flac" -qscale:a 2 test.mp3, mp3tag (the latest version) tells me that this mp3 file has an ID3v2.4 tag, it correctly gives me the title, artist, genre, track, album, but year is empty.

When I mouse-over in windows, it tells me all those fields, as well as the "Release Date" to be 2010, but the YEAR tag doesn't show up. When I mouse-over the 2.3 version, the YEAR field is set to 2010, not the field RELEASE DATE.

Could it be that there is a mix-up between RELEASE DATE and YEAR when building the id3v2.4 tag? It appears to be the case.

See attached screenshots for both the v2.3 and v2.4 files:

http://imgur.com/RZL674J

Last edited 10 years ago by dslkjlskdjfllk (previous) (diff)

in reply to:  5 comment:6 by Carl Eugen Hoyos, 10 years ago

Replying to dslkjlskdjfllk:

Could it be that there is a mix-up between RELEASE DATE and YEAR when building the id3v2.4 tag? It appears to be the case.

I don't think there is a YEAR tag.

comment:7 by dslkjlskdjfllk, 10 years ago

I just updated the link to the screenshots with more details in my previous post. Please check again the following image: [​http://imgur.com/RZL674J]

I don't think there is a YEAR tag.

Sure there is. I just opened the file with the ID3v2.4 and manually filled the year tag in mp3tag with "2010" and now there is a year tag in my id3v2.4 file.

Last edited 10 years ago by dslkjlskdjfllk (previous) (diff)

comment:8 by bat999, 10 years ago

Cc: batguano999@zoho.com added

comment:9 by bat999, 10 years ago

Hi
With luckynight.flac from here ---> http://samples.mplayerhq.hu/A-codecs/lossless/

Convert to mp3 with id3v2.3 tag
ffmpeg -i luckynight.flac -id3v2_version 3 test1.mp3

Convert to mp3 with id3v2.4 tag
ffmpeg -i luckynight.flac test2.mp3

Inspect the results with a suitable program.
I used mp3diags from here ---> http://mp3diags.sourceforge.net/

test1.mp3
The YEAR (or whatever you prefer to call it) is correct with id3v2.3 (Frame used is TYER).

padding=10, unsynch=no; frames: TXXX="REPLAYGAIN_TRACK_PEAK 0.97720337", TXXX="REPLAYGAIN_TRACK_GAIN -4.19 dB", TXXX="REPLAYGAIN_ALBUM_PEAK 0.97720337", TXXX="REPLAYGAIN_ALBUM_GAIN -4.19 dB", TALB="Treasure Quest Soundtrack", TPE1="Jody Marie Gnant", TYER="1995", TCON="Soundtrack", TXXX="COMMENT 1-minute song sample demonstrating FLAC compression", TIT2="Lucky Night", TRCK="9", TSSE="Lavf55.42.101"

test2.mp3
The YEAR (or whatever you prefer to call it) is not correct with id3v2.4 (Frame used is TDRL).

padding=10, unsynch=no; frames: TXXX="REPLAYGAIN_TRACK_PEAK 0.97720337", TXXX="REPLAYGAIN_TRACK_GAIN -4.19 dB", TXXX="REPLAYGAIN_ALBUM_PEAK 0.97720337", TXXX="REPLAYGAIN_ALBUM_GAIN -4.19 dB", TALB="Treasure Quest Soundtrack", TPE1="Jody Marie Gnant", TDRL="1995", TCON="Soundtrack", TXXX="COMMENT 1-minute song sample demonstrating FLAC compression", TIT2="Lucky Night", TRCK="9", TSSE="Lavf55.42.101"

Maybe for id3v2.4 tag the YEAR (or whatever you prefer to call it) needs to be written to frame TDRC instead of (or as well as) frame TDRL.

According to Wikipedia TDRC is Recording time and TDRL is Release time.

comment:10 by dslkjlskdjfllk, 10 years ago

Interesting. Also according to Wikipedia, TYER (which was the Year field) has been "replaced by TDRC in v2.4".

TRDL is a NEW frame that relates to Release Time.

So, indeed, I think that the year tag in the FLAC should go to TDRC in a transcoded mp3.

Source: http://en.wikipedia.org/wiki/ID3

Last edited 10 years ago by dslkjlskdjfllk (previous) (diff)

comment:11 by dslkjlskdjfllk, 10 years ago

Hi,

Can I assume that this issue will possibly be considered for a fix in the future releases of ffmpeg, even if the description of the bug still says that it hasn't been analyzed nor reproduced?

Thanks

comment:12 by dslkjlskdjfllk, 10 years ago

Sorry to insist... but is there any plan to fix this issue?

Thanks

comment:13 by Carl Eugen Hoyos, 10 years ago

Keywords: metadata added

comment:14 by Benoit Fouet, 10 years ago

Owner: set to Benoit Fouet
Status: newopen

comment:15 by Benoit Fouet, 10 years ago

Resolution: fixed
Status: openclosed

comment:16 by dslkjlskdjfllk, 10 years ago

Hi Benoît,

Thanks for fixing this. It took 5 months but I am glad to see this small bug was not overlooked.

As I'm reading the 15 comments on this bug, it appears clear that from my initial bug report, and every step of the way, I had to fight , present solid arguments and even almost find/suggest the solution to the problem. It is as if the people reviewing my comment never really bothered to try and validate/test what I was saying, instead being dismissive as if I was an idiot who didn't know what I was doing. You know, the classic "support call" where the agent tells your "Sir, are you sure that your computer is plugged in" and you reply "Dude, I'm en engineer, I've been telling you for the past hour that there is a bug in how your application writes to the registry, and I've sent you the MSDN link for how it should be done, don't ask me if I computer is turned on!".

I usually see this type of attitude in very junior software developer, or senior people with big egos who think they know everything and never make mistakes. Surprisingly, after all my detailed comments and dump and screenshots to assert my point, there was never an acknowledgement that, indeed, I had found a valid bug and it would be fixed at some point. As if to refuse to validate my initial finding.

I'm not writing this rant to dwell on the past, but would like to invite the contributors of this forum/software (who are doing it for free, I know, and thank you) to reflect on how this conversation went by re-reading the initial posts, and perhaps adopt a different attitude in the future when people, like me, are diligent in reporting issues they encounter and only want to help. More effort was put into dismissing my assertion than investigating/validating. You could assume that someone who takes the time to register to a forum where he'll never return, and to reply multiple times with many details, has done at least a minimum of validation so as to not waste anybody's time. This being said, I could have been wrong, of course.

Thanks for listening.

comment:17 by Carl Eugen Hoyos, 10 years ago

Just to make sure: I know very well that I - unfortunately - make many mistakes;-(

In case this isn't completely obvious: Time is the only limiting factor for FFmpeg development, if you want to help with code, documentation, admin work, ... please feel free to join irc (or the developer mailing list), several developers are often online.

Regarding this ticket: FFmpeg did show the year so this was difficult for me to reproduce.
And as I tried to say above: If you want support on a bug report, This can easily be reproduced. is not a particularly useful comment imo.

comment:18 by Carl Eugen Hoyos, 10 years ago

Keywords: id3v2 added; flac mp3 removed

comment:19 by Carl Eugen Hoyos, 10 years ago

Component: undeterminedavformat
Note: See TracTickets for help on using tickets.