如何使用 ffmpeg 提取 Xing/LAME 帧?

发布于 2024-11-26 05:31:02 字数 303 浏览 9 评论 0原文

使用已经使用 ffmpeg 进行音频处理的程序,我想提取并解析 Xing/LAME 风格的 mp3 帧。

(与其他 mp3 元数据不同, xing/lame 元数据存储在流中的虚拟 mp3 文件中)

不幸的是,对我来说,av_seek_frame() 似乎仅支持查找文件中包含实际音频的第一帧。即使我使用字节查找模式将其查找为 0,我最终也会在文件中位于 LAME/Xing 帧之后的位置。如果我只是打开文件并开始读取帧而不进行查找,情况也是如此。

可以说服 ffmpeg 读取我想要的帧吗?并且,LAME/Xing 数据是否可能跨越多个帧?

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 seeking.

Can ffmpeg be persuaded to read the frames that I want? And, will the LAME/Xing data potentially span multiple frames?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

洒一地阳光 2024-12-03 05:31:02

无论如何,找到了一个可行的解决方案...使用TagLib,可以直接从文件引用中获取文件指针,并搜索:

{ 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
};

找到标签。容易多了。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文