通过B站杜比全景声上传5.1声道环绕声(将5.1声道环绕声转换为杜比全景声)
声明:如此得到的并非真正的杜比全景声,只是应对B站二压的一种妥协策略,本人认为经过此种简单处理所得音频并不能称为杜比全景声,也不建议读者发布视频时强行将双声道音频升混至更多声道来点亮所谓“杜比全景声”的标识。另据UP主 @伞都被卖了 的有关研究,22.2ch视频在转换为杜比全景声后播放效果优于直接降混为双声道。故而环绕声转全景声或许具备一定实用价值,能让观众得到更好体验。

# 项目初衷
环绕声很早就应用于市场,像`Dobly`和`DTS`这样的5.1声道环绕声在20余年前的DVD中都相当常见。然而由于互联网视频传输长期以来的双声道限制以及环绕声终端设备的普及率低下,环绕声一直没能在国内视频网站受到很好的支持。现如今B站引入杜比全景声,给了我们一种通过杜比全景声塞下环绕声的手段,也能让我们借由此项技术让环绕声在不同配置的音响系统下以最合适的方式播放,营造出环绕的氛围。
当然,环绕声推出比全景声晚很多,这种转换显然是浪费了全景声其他更多的性质(比如其单独的声音对象),所以说这样的转换也只能说是UP主们为了观众能更好的享受视频做出的一种妥协,类似于强行扩大视频分辨率避免B站二压。
# 环绕声的规格
为了让各位能有一个对环绕声的初步印象,我们以最常见的5.1环绕声举例,看看它包含了哪些成分。
## 组成
> The first digit in "5.1" is the number of full range channels. The ".1" reflects the limited frequency range of the LFE channel.
5.1环绕声音频由5+1个独立的通道组成。其中五个分别是左前、右前、中间、左环绕和右环绕,另外多出来的一个是低音通道。
> All 5.1 systems use the same speaker channels and configuration, having a Front Left (**FL**) and Front Right (**FR**), a [Center Channel](https://en.wikipedia.org/wiki/Center_channel "Center channel") (**CNT**), two [surround channels](https://en.wikipedia.org/wiki/Surround_channels "Surround channels") (Surround Left - **SL** and Surround Right - **SR**) and the [low-frequency effects](https://en.wikipedia.org/wiki/Low-frequency_effects "Low-frequency effects") (**SW**) channel designed for a [subwoofer](https://en.wikipedia.org/wiki/Subwoofer "Subwoofer").[[4]](https://en.wikipedia.org/wiki/5.1_surround_sound#cite_note-4)[[5]](https://en.wikipedia.org/wiki/5.1_surround_sound#cite_note-:0-5)
## 空间位置
> ![[Pasted image 20230819164644.png]]
> Most common [loudspeaker](https://en.wikipedia.org/wiki/Loudspeaker "Loudspeaker") configuration for 5.1; used by [Dolby Digital](https://en.wikipedia.org/wiki/Dolby_Digital "Dolby Digital"), [SDDS](https://en.wikipedia.org/wiki/Sony_dynamic_digital_sound "Sony dynamic digital sound"), [DTS](https://en.wikipedia.org/wiki/DTS_(sound_system) "DTS (sound system)"), [THX](https://en.wikipedia.org/wiki/THX "THX"), and [Dolby Pro Logic II](https://en.wikipedia.org/wiki/Dolby_Pro_Logic#Dolby_Pro_Logic_II "Dolby Pro Logic"). The white square in the center of the diagram depicts the low-frequency speaker. Each black square depicts a loudspeaker. The center speaker in the top line of the diagram is used for dialogue. The left and right speakers on either side of the center speaker are used to create stereo sound for music and other sound effects in the film. The left and right surround speakers in the bottom line create the surround sound effect.
上图是5.1声道环绕声音频各个声道对应扬声器位置的示意图。五个黑色填充的方框很好理解,就是前面所说的五个声道对应的扬声器的位置,播放时每个声道的音频在对应的扬声器播放;中间的无填充黑框表示低音音响。
在设计之初,低音通道用来单独存放电影中的低音特效,方便影院根据实际情况调节低音的音量大小,而并没有规定这些音效应该在空间中处于什么位置。事实上,由于现在大部分音响都能够播放这种程度的低音,一个专门的低音炮是否有必要也存在争议,因为我们完全可以在其他5个音响中播放这个低音音频。总之,可以粗浅的认为,在5.1全景声中,只要求低音通道的声音存在并且播放出来,而并不要求这个通道的声音从某个特定的方向传来。
> ![[Pasted image 20230819170240.png]]
> 一种针对5.1环绕声的音响摆放方式
## 文件格式
我们以一段包含杜比5.1环绕声的DVD中的视频为例,用`MediaInfo`查看一下其中的音频信息
```
音频 #1
ID : 189 (0xBD)-128 (0x80)
格式 : AC-3
格式/信息 : Audio Coding 3
传播名 : Dolby Digital
混流模式 : DVD-Video
时长 : 52 秒 800 毫秒
码率模式 : 恒定码率 (CBR)
码率 : 448 kb/s
声道数 : 6 声道
声道布局 : L R C LFE Ls Rs
采样率 : 48.0 kHz
帧率 : 31.250 FPS (1536 SPF)
压缩模式 : 有损
流大小 : 2.82 MiB (0%)
服务类别 : Complete Main
```
可以看到,音频文件格式为AC3,包含六个声道
1. L 左
2. R 右
3. C 中间
4. LFE 低音
5. Ls 左环绕
6. Rs 右环绕
它们的英文标识名称与前文提到的有所不同,但意思一致。
## 环绕声音频的播放
如果我们采用`PotPlayer`来播放这段含有环绕声音频的视频,打开选项观察音频输出,我们发现源文件的5.1声道在输出时已经变为了2声道。
这个过程被称为**降混**(downmix),也就是把声道数多的音频向声道数少的音频转换。当多声道音频在数量不足的音响上播放时,特别的,当环绕声音频在立体声音响上播放时,这种转换不可避免。
>>The mixdown process converts a program with a multiple-channel configuration into a program with fewer channels. Common examples include downmixing from [5.1 surround sound](https://en.wikipedia.org/wiki/5.1_surround_sound "5.1 surround sound") to stereo, and stereo to mono. Because these are common scenarios, it is common practice to verify the sound of such downmixes during the production process to ensure stereo and mono compatibility.
>
>摘自[Audio mixing (recorded music) - Wikipedia](https://en.wikipedia.org/wiki/Audio_mixing_(recorded_music)#Downmixing)
然而,如果这种转换得当,我们仍然能够在立体声音响或者耳机下感受到环绕声带来的宽广的声音效果。特别的,通过`Dolby Access`等软件提供的虚拟环绕声(virtual surround sound)技术,听众得以在有限的扬声器数量下体验到环绕声效果。
> **Lo/Ro - default**: Downmixes from 5.1 to Stereo using the coefficients:
>>Lo = L + (–3 dB × C) + (–3 dB × Ls)
>>Ro = R + (–3 dB × C) + (–3 dB × Rs)
>
>杜比5.1的降混参数
>摘自[How do the 5.1 and Stereo downmix settings work? (dolby.com)](https://professionalsupport.dolby.com/s/article/How-do-the-5-1-and-Stereo-downmix-settings-work?language=en_US)
## 环绕声音频的拆分
如果你想把5.1声道音频的六个音轨全部拆分出来以得到6个单声道的音频文件,这里有[一篇俄语文章](https://rutracker.net/forum/viewtopic.php?p=31326521#31326521)详细讲述了你可能需要用到的工具。
> 对于杜比AC3格式,文章推荐使用BeHappy
# 杜比全景声规格
## 组成
> Dolby Atmos is an immersive, object-based sound format that allows you to place your music in three-dimensional space. With a much wider palette than stereo, you can now place and move sounds in three dimensions to fully capture the artist’s vision. Dolby Atmos can be easily added to your existing workflow and is supported by major music streaming services including Apple Music, Amazon Music and Tidal.
杜比全景声包含的内容比环绕声多的多,这里我们不妨粗浅的把它理解成**环绕声**+**对象**,并从制作流程的原料和成品探讨。
### 原料
想要制作杜比全景声音频,首先要准备两方面的材料:
+ 音床(bed):杜比全景声中的环绕声部分,逻辑上表示为在空间中固定位置的扬声器。
+ 对象(objects):杜比全景声中的独立发声体,逻辑上表示为在空间中自由放置的声源。
通过在DAW中分配不同音频,使它们成为音床的一部分或者对象的一部分。
### 成品
通过原料,我们渲染得到包含所有音频及其位置信息的`ADM BWF`文件,然后通过特定格式(`Dolby Digital Plus JOC`)编码得到可供B站上传的音频文件。
> Dolby Digital Plus JOC (Joint Object Coding) refers to the underlying technology used to deliver Dolby Atmos via the Dolby Digital Plus format. In product UI and documentation it is commonly referred to as Dolby Digital Plus with Dolby Atmos.
>
>> Joint Object Coding is a coding technique that allows up to 15 full range channels or objects, plus LFE channel, to be carried within a Dolby Digital Plus bitstream in a backward-compatible manner.
>
>> A Dolby Digital Plus JOC decoder uses the Joint Object Coding data to decode the channels or objects to up to 15.1 channels of PCM. The decoder also output object audio metadata (OAMD) which instructs the Dolby Atmos renderer how to position each of these objects and/or channels based on the configured playback environment.
>
>> Existing Dolby Digital Plus decoders ignore the JOC data and decode the Dolby Digital Plus bitstream which consists of a multichannel render of the Dolby Atmos audio.
>
>摘自[What is Dolby Digital Plus JOC? (Joint Object Coding)](https://professionalsupport.dolby.com/s/article/What-is-Dolby-Digital-Plus-JOC-Joint-Object-Coding?language=en_US)
杜比全景声最多能够包含118个对象,这显然远远超出用于监听的扬声器数量,更不用说这些对象还能够在空间中自由移动。显然,这些对象发出的声音必须通过支持杜比全景声的渲染器降混到现有的环绕声音响或者耳机上。
由于渲染后的音频包括了所有音频轨道和它们的空间位置,支持杜比全景声的设备在播放时能够自动根据设备自身情况决定如何降混原音频,这样便可得到跨设备的全景声体验。
# 转换流程
## 思路
我们的目的是将环绕声转换为全景声,因而只需要用到杜比全景声的音床部分,具体步骤如下:
0. 提取杜比环绕声音频
1. 通过DAW将环绕声轨道映射到杜比全景声音床
2. 渲染得到ADM BWF文件
3. 编码得到DD+ JOC文件
4. 将音频与视频封装为MP4
5. 上传B站
## 处理工具
0. PgcDemux:用于DVD音视频的提取
1. Davinci Resolve Studio 17+(以18.5为例):用于轨道映射以及ADM文件渲染
2. Dolby Media Encoder:用于编码DD+ JOC文件
3. mp4demuxer:用于视频拆解
4. mp4muxer:用于音视频封装
5. ffmpeg:用于对DVD视频转码
# 具体步骤
略