mplayerで再生できないOgg Vorbisファイルについて調べた

環境

Ubuntu Linux 10.10
MPlayer 1.0rc4-4.4.5 (apt install)

現象

http://www.kahvi.org/releases.php?release_number=317
Ogg Vorbis 版のファイルを mplayer で再生できない。
次のように出力される。

$ mplayer -nolirc kahvi317e_weldroid-light_showers.ogg 
MPlayer 1.0rc4-4.4.5 (C) 2000-2010 MPlayer Team

Playing kahvi317e_weldroid-light_showers.ogg.
libavformat file format detected.
[ogg @ 0x925d880]2048 bytes of comment header remain
[lavf] stream 0: audio (vorbis), -aid 0, Light Showers
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
[vorbis @ 0x925f290]Extradata corrupt.
Could not open codec.                                                                                                               
ADecoder init failed :(
ADecoder init failed :(
Requested audio codec family [vorbis] (afm=libvorbis) not available.
Enable it at compilation.
Opening audio decoder: [tremor] Ogg/Vorbis audio decoder
OggVorbis: header n. 0 broken! len=30
ADecoder init failed :(
ADecoder init failed :(
Cannot find codec for audio format 0x566F.
Audio: no sound
Video: no video


Exiting... (End of file)

調べた

vlc、ogg123 では再生できる
vlc, ogg123 can play.

ogginfo ouput:

$ ogginfo kahvi317e_weldroid-light_showers.ogg
Processing file "kahvi317e_weldroid-light_showers.ogg"...

New logical stream (#1, serial: 00003921): type vorbis
Vorbis headers parsed for stream 1, information follows...
Version: 0
Vendor: Xiph.Org libVorbis I 20101101 (Schaufenugget)
Channels: 2
Rate: 48000

Nominal bitrate: 256.000000 kb/s
Upper bitrate not set
Lower bitrate not set
User comments section follows...
	BPM=140
	ENCODEDBY=LAME in FL Studio 9
	Album=Drain
	Artist=Weldroid & IOflow
	Comment=http://www.kahvi.org
	Genre=IDM
	Title=Light Showers
	COMPOSER=http://www.weldroid.net
	DATE=2011
	TRACKNUMBER=5
	METADATA_BLOCK_PICTURE=AAAAAwAAAAlpbWFnZS9wbmcAAAAA(...)
Vorbis stream 1:
	Total data length: 9504816 bytes
	Playback length: 4m:06.434s
	Average bitrate: 308.554511 kb/s
Logical stream 1 ended

vorbiscomment でタグを書き換えると再生できるようになる。
Replace tags using vorbiscomment, then mplayer can play.

vorbiscomment -w -t "title=foo" kahvi317e_weldroid-light_showers.ogg

また、Kid3-qt で Picture タグを除去した場合も再生できるようになる。
Remove "Picture" tag using Kid3-qt, then mplayer can play.


vorbiscomment を使ってタグを書き出し、METADATA_BLOCK_PICTURE だけを別のファイルに移し変えてみる。

vorbiscomment -c comment.txt kahvi317e_weldroid-light_showers.ogg
grep METADATA_BLOCK_PICTURE comment.txt > comment_picture_only.txt
cp kahvi317e_weldroid-light_showers.ogg other.ogg
vorbiscomment -w -c comment_picture_only.txt other.ogg
mplayer -nolirc other.ogg #=> fail

再生できない。

逆に、METADATA_BLOCK_PICTURE 以外を別のファイルに移し変えると、これは再生できた。

vorbiscomment -c comment.txt kahvi317e_weldroid-light_showers.ogg
grep -v METADATA_BLOCK_PICTURE comment.txt > except_picture.txt
cp kahvi317e_weldroid-light_showers.ogg other.ogg
vorbiscomment -w -c except_picture.txt other.ogg
mplayer -nolirc other.ogg #=> not fail

なので、原因はやっぱり METADATA_BLOCK_PICTURE なのではないかと。


で、mplayer が METADATA_BLOCK_PICTURE 自体に対応していないのか、対応しているけどデータが不正なのか。

これについては、

  • 元ファイルの METADATA_BLOCK_PICTURE を base64デコードしたものは PNG画像のようだが、データが壊れている?ようで、表示ソフトで開くことができない。
  • 他のPNG画像を base64 エンコードして埋め込んだものは再生できる

ので、ここまでの結果を見ると
mplayer は METADATA_BLOCK_PICTURE 自体には対応しているが、データが壊れているとダメ」
ということなのではないかと。

※ただ、Kid3-qt で元のファイルを開くと画像表示されるんですよねぇ…