How do I extract Xing/LAME frames using ffmpeg?
Using a program which already makes use of ffmpeg for audio processing, I would like to extract and parse Xing/LAME style mp3 frames.
(unlike other mp3 metadata, xing/lame metadata is stored in dummy mp3 files in the stream)
Unfortunately for me, av_seek_frame()
only seems to support seeking to the first frame containing actual audio in the file. Even if I seek using byte-seeking mode to 0, I end up in a position in the file after the LAME/Xing frames. This is also the case if I simply open the file and begin reading frames without see开发者_StackOverflow中文版king.
Can ffmpeg be persuaded to read the frames that I want? And, will the LAME/Xing data potentially span multiple frames?
No matter, found a workable solution... Using TagLib, one can get the file pointer directly out of a file reference, and search for:
{ 0xFF, 0xFB, 0x90, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
to find the tag. Much easier.
精彩评论