TLEN bug

2 messages Options
Embed this post
Permalink
Tsukikage

TLEN bug

Reply Threaded More More options
Print post
Permalink
Hello

LAME 3.98 seems to have a bug in TLEN calculation. This bug is widely
known among Japanese LAME users in 2channel.

You see TLEN bug when you make MP3 file with id3v2 by LAME 3.98 [*] and
play with Windows Media Player. The timer on the bottom left shows
incorrect total time.

[*] Try a command like this
lame -V2 --tt title --add-id3v2 wavefile.wav

This is not WMP's bug. Victor's player XA-HD500 shows incorrect time
too. LAME's TLEN field is different from CDex's one.

One 2channeler writes
“Cast connection is incorrect and the value type is long before division.
The consequence is an overflow.
Precisely, casting is not necessary. Just rewrite to
playlength_ms = gfp->num_samples * 1000.0 / gfp->in_samplerate”

I don't know well about this bug and I just inform you by translation
from 2channnel posts. If you can read Japanese and know 2channel, the
attached file might be helpful to know how the discussion of TLEN bug went.

I think I can translate your replies and inform 2channelers.

Regards,

Tsukikage (月影)

81 名前:名無しさん@お腹いっぱい。[sage] 投稿日:2007/03/03(土) 22:22:37 ID:Yup/pBtk0
WMPでVBR MP3の時刻表示がおかしくなる仕様ってのは
lame3.98a11だけじゃね?
lame3.98a11の方にバグがあるんじゃないかと。

例えば、ビクターのプレーヤーのXA-HD500も同様に時刻表示がおかしくなる
ただ、a11で作成した物だけで、a5やa6ならWMPもビクターのプレーヤーは問題なし

スレ的にはどうなんだろう?


84 名前:81[sage] 投稿日:2007/03/03(土) 23:27:14 ID:Yup/pBtk0
ID3タグを付けると確実に>>81の問題が出る
無しだと問題発生しないみたい

あ


119 名前:名無しさん@お腹いっぱい。[sage] 投稿日:2007/03/05(月) 20:35:35 ID:BiTwqiLt0
3.98でのTLENとか言ってるけど、lame.exeのタグ付加オプションでTLENが付加
されるの?

TLENっていうのはID3V2タグのフレームのうちの一つで、曲の長さをミリ秒で
表したものが入っててる。

ID3v2タグを付加するソフト(フロントエンドやタグエディタ)が設定するもんだと
思ったが?

たとえばCDexなんかではCDexが付加しているよ。 ちなみにCDex使ってエンコ
したものでは、正常に時間表示されてるよ。

WMPは ID3v2.4はサポートしていないから、v2.4のTLENでおかしくなっている
可能性はあるけどさ。


120 名前:119[sage] 投稿日:2007/03/05(月) 20:57:35 ID:BiTwqiLt0
書いた後しらべてみた。

lame.exe 3.98a11の --add-id3v2でのタグ付加がバグってる模様。
TLENに明らかに異常な値が書込まれてる。

5分20秒の曲をエンコして CDexのタグ付加機能を使った場合 TLENは320092
lame.exeの --add-id3v2でタグを付けた場合TLENに13959が書込まれてる。


121 名前:名無しさん@お腹いっぱい。[sage] 投稿日:2007/03/05(月) 21:07:14 ID:671qG/kO0
LAMEのID3タグv2の付加機能はTLENはおかしい上に
ジャンルはちゃんと書き込まれない(ID3v1の番号形式で書かれてしまう)から、
この2つを早く直して欲しいなぁ。


132 名前:名無しさん@お腹いっぱい。[sage] 投稿日:2007/03/06(火) 11:41:03 ID:ehQQ1Lwh0
手元の60秒ほどのWAVを食わせたとき、id3tag.c内の gfp->num_samples の値が2651880。
これに1000を掛け、更に gfp->num_channels と gfp->in_samplerate で割ったら30066.66....で、
これが playlength_ms に放り込まれ、TLENに反映される。
こりゃどうにも、そもそもサンプル数の弾き出し方か、ここで gfp->num_samples を素で使うのがおかしいかの何れかの様子。

ここで、サンプル数の弾き出し方なんて根幹に問題があったのなら、もう日曜プログラマの出る幕じゃねーや。


177 名前:119[sage] 投稿日:2007/03/07(水) 22:23:51 ID:v47X5AOX0
>>132

原因は、その部分の計算式でチャンネル数で割ってる間違いが1点
そして doubleの結果を強引に unsigned longにキャストしてるのが1点

ということで

playlength_ms = ((double) gfp->num_samples * 1000.0) / gfp->in_samplerate;

とすればOKになった。


181 名前:名無しさん@お腹いっぱい。[sage] 投稿日:2007/03/08(木) 06:33:22 ID:XJhwChQv0
>>177
小数点を無理やり整数に見立ててキャストしてるってこと?
単なる簡単なミスなのか、何か理由があるのか…
よくわからなくてスマソ。

182 名前:名無しさん@お腹いっぱい。[sage] 投稿日:2007/03/08(木) 09:30:16 ID:MMIkomYF0
最初に TLEN をサポートしたとき (Sat Nov 5 15:54:47 2005 UTC) からずっとバグってる
キャストは結合順を間違えていて、割る前に long になってオーバーフローしている
そもそもこの式にはキャストは不要、単にこれでいい

playlength_ms = gfp->num_samples * 1000.0 / gfp->in_samplerate

ってここにバグレポ書いちゃらめぇぇぇぇぇぇぇぇぇぇ


LAMEコマンドラインオプションを語れ!その23
http://pc11.2ch.net/test/read.cgi/software/1172582958/
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Lame-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/lame-dev
Robert Hegemann-2

Re: TLEN bug

Reply Threaded More More options
Print post
Permalink
Hello Tsukikage,

thank you very much for reporting this TLEN bug. I'll have a look at it later.


Ciao Robert

_______________________________________________________________
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Lame-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/lame-dev