为 Ogg 获取 Opus Headers
Get Opus Headers for Ogg
我有这个从 Vorbis for Ogg Stream 获取初始 header 信息的例子:
ogg_packet header;
ogg_packet header_comm;
ogg_packet header_code;
vorbis_analysis_headerout(&vd,&vc,&header,&header_comm,&header_code);
如何使用 libopus 从 Opus 获取此 header 信息?
有一些信息 HERE,但我不知道如何使用它。
Ogg Opus 只有两个 header 数据包:ID header 和评论 header。有关其内容的详细信息,请参阅 the specification。
如果您正在阅读 带有opusfile 库的Ogg Opus 文件,它会为您处理数据包(包括header 数据包)。您链接到的各种函数用于从已处理的 header 中获取信息。
如果您正在编写 Ogg Opus 文件,您可以使用libopusenc library and it will take care of writing the headers for you. As of version 0.2, the opusenc program in the opus-tools package uses libopusenc. If for some reason you want to format and write the packets yourself using the ogg library directly, you could take a look at the older 0.1.10 version of opusenc, when it did this itself; look for the comment /* Write header */
in opusenc.c and the call to opus_header_to_packet()
格式化ID header。
我有这个从 Vorbis for Ogg Stream 获取初始 header 信息的例子:
ogg_packet header;
ogg_packet header_comm;
ogg_packet header_code;
vorbis_analysis_headerout(&vd,&vc,&header,&header_comm,&header_code);
如何使用 libopus 从 Opus 获取此 header 信息? 有一些信息 HERE,但我不知道如何使用它。
Ogg Opus 只有两个 header 数据包:ID header 和评论 header。有关其内容的详细信息,请参阅 the specification。
如果您正在阅读 带有opusfile 库的Ogg Opus 文件,它会为您处理数据包(包括header 数据包)。您链接到的各种函数用于从已处理的 header 中获取信息。
如果您正在编写 Ogg Opus 文件,您可以使用libopusenc library and it will take care of writing the headers for you. As of version 0.2, the opusenc program in the opus-tools package uses libopusenc. If for some reason you want to format and write the packets yourself using the ogg library directly, you could take a look at the older 0.1.10 version of opusenc, when it did this itself; look for the comment /* Write header */
in opusenc.c and the call to opus_header_to_packet()
格式化ID header。