ogg://
音频流
说明
通过包装器ogg://读取的文件,是作为OGG/Vorbis格式的压缩音频编码。同样,通过包装器ogg://写入或追加的数据格式也是压缩音频。当stream_get_meta_data()用于一个打开读取的OGG/Vorbis文件时,会返回关于数据流的详细信息,包含了$vendor标签、任何内含的$comments、$channels数字、采样率($rate),以及用$bitrate_lower、$bitrate_upper、$bitrate_nominal和$bitrate_window描述的可变比特率范围。
ogg://PHP 4.3.0 及以上(PECL)
Note:该封装器默认未激活
要使用ogg://封装器,您必须安装» OGG/Vorbis扩展。可以在» PECL上找到。
用法
- ogg://soundfile.ogg
- ogg:///path/to/soundfile.ogg
- ogg://http://www.example.com/path/to/soundstream.ogg
可选项
属性 | 支持 |
---|---|
受限于allow_url_fopen | No |
允许读取 | Yes |
允许写入 | Yes |
允许附加 | Yes |
允许同时读写 | No |
支持stat() | No |
支持unlink() | No |
支持rename() | No |
支持mkdir() | No |
支持rmdir() | No |
Name | Usage | Default | Mode |
---|---|---|---|
pcm_mode | 读取时使用如下 PCM 编码之一:OGGVORBIS_PCM_U8 、OGGVORBIS_PCM_S8 、OGGVORBIS_PCM_U16_BE 、OGGVORBIS_PCM_S16_BE 、OGGVORBIS_PCM_U16_LE 和OGGVORBIS_PCM_S16_LE 。(8 或 16 位,签名或未签名,大或小的endian) | OGGVORBIS_PCM_S16_LE | 读取 |
rate | 输入数据的采样率,单位为 Hz | 44100 | 写入/附加 |
bitrate | 若给的值为整数,则是用固定的比特率进行编码。(16000 到 131072)若给的值为浮点数,则使用可变的比特率(质。(-1.0 到 1.0) | 128000 | 写入/附加 |
channels | 要编码的声道的数量,典型为 1(单声道),或 2(立体声)。最高支持 16 声道。 | 2 | 写入/附加 |
comments | 编码到音轨头部的字符串数组。 | 写入/附加 |
范例
Note that although "ogg:" is the wrapper name, the stream is restricted to Ogg files containing a single stream encoded using the Vorbis audio codec. An Ogg container can, in fact, contain multiple streams: audio, video, anything. (Also, the audio streams in an Ogg contaner can use codecs such as FLAC and OggPCM.) The wrapper name is therefore misleading.