Kdenlive/Руководство/Полезная информация/Объёмный звук

From KDE Wiki Sandbox
Other languages:

Редактирование объёмного звука в Kdenlive

На момент написания данного материала, Kdenlive поддерживает только создание видеоматериалов, содержащих стереозвук. Невозможно создать более аудиоканалов или сопоставить аудиотреки создаваемому звуку. Для того чтобы редактировать и создать объемный звук, потребуются некоторые действия вручную в том числе внешние инструменты .

Это руководство использует 6-канальный объемный звук 5.1 в качестве примера.

Используемые внешние инструменты

  • Audacity - Свободный аудиоредактор
  • avconv - Видео и Аудио конвертер
Note
Kdenlive использует FFmpeg, в то время как на (к) Ubuntu, FFmpeg устарела и avconv используется вместо него. Таким образом, avconv (и, возможно, другие) должен быть уже установлен.


Создание нового Surround Sound

Это руководство описывает один из возможных обходных путей, используя Audacity , для создания и рендеринга аудио дорожки объемного звука 5.1 , которую можно добавить в видео, созданне Kdenlive.

Note
Более продвинутые функции, такие как объемное панорамирование (т.е. звуковой переход от заднего к переднему плану) находятся вне возможностей Audacity - но можно создавать подобные эффекты вручную.


Создание и редактирование Surround Sound в Audacity

Следующий пример простого 5.1 объемного звука используемого в данном руководстве:

  • Некоторая оригинальная запись фронтальная (stereo)
  • Некоторый голос (front) по центру (mono)
  • Некоторая музыка сзади (stereo)


Если, как в данном примере, некоторые оригинальные записи звуковой дорожки из видеоклипа, предполагается, использовать для создания объемного звука , они могут быть легко извлечены с помощью Kdenlive с извлекать аудио-> Wav 48000Hz </ menuchoice> в контекстном меню клипа. Это создает аудиофайл WAV в той же папке, где видеоклип находится.

Аудио клипы, которые будут использоваться в этом примере:

  • Field.wav (stereo) для Фронта L+R
  • Voice.wav (mono) для Центра
  • Music.mp3 (stereo) для Surround L+R (задний)


В новом проекте Audacity, они могут быть импортированы в указанном выше порядке с <menuchoice> Файл-> Импорт-> Audio ... </ menuchoice>, проект должен выглядеть примерно так:

[[File:AudacitySurround.jpg]]

Карта каналов для объемного звука 5.1:

  • 1 - Фронтальный левый
  • 2 - Фронтальный правый
  • 3 - Центр
  • 4 - LFE
  • 5 - Surround Левый
  • 6 - Surround Правый


{{Note|LFE (низкочастотные эффекты) часто называют "канал сабвуфера", что не совсем правильно. Настройка объемного звучания вполне допустимо без сабвуфера, в этом случае система окружающего звучания будет перенаправлять LFE канал для «больших» колонок, обычно фронтальных колонок..}}

Стерео-трек "Field" теперь может быть сопоставлен с фронтом L + R, "Голос" с Центром и «Музыка» с тыловыми L + R. Существует только одна проблема: спикеры системы динамиков объемного звучания (сзади) системы объемного звучания, как правило, "маленькие", и не в состоянии воспроизвести низкие частоты. Поэтому было бы необходимо отобразить низкие частоты в "Music" дорожке к низкочастотному каналу, иначе музыка может показаться немного "тонкой".

To do this, the "Music" track can simply be duplicated with <menuchoice>Edit->Duplicate after selecting it, and then Split Stereo to Mono from the context menu of the third track. Then one of the two mono tracks can be deleted, the other one can be renamed to "LFE".

Now the "Equalization..." effect could be used to cut off frequencies above around 100Hz from the "LFE" track, and reverse, cut off frequencies below around 100Hz from the "Music" track.

Note
Creating technically perfect surround sound is a science on its own and thus out of scope of this guide - please refer to respective resources on the web for details.


What remains for now is to make sure that the surround sound track has the same length as the video track it should be added to. The video track used in this example has a length of 1:00 minute, so the length of the audio tracks in Audacity are adjusted accordingly:

The Audacity project should now look something like this:

The next thing to do is to export the project to a multichannel 5.1 surround sound audio file. The format used here is AC-3 (Dolby Digital).

Before exporting, Audacity needs to be configured to allow exporting to a multichannel audio file: In Edit->Preferences, under Import/Export, select "Use custom mix (for example to export a 5.1 multichannel file)".

The project can now be exported into a 5.1 surround sound audio file:

  • Select File->Export...
  • Provide a name for "Name" and select "AC3 Files (FFmpeg)"
  • Click "Options..." and choose "512 kbps" as "Bit Rate"


The "Advanced Mixing Options" dialog should show up. The number of "Output Channels" should be 6 and the channel mapping should already be correct:

The result of the export should be an *.ac3 file which is playable with i.e. VLC or Dragon Player.

Muxing Video and Audio Together

The final step is to add the surround sound audio track to the video track, assuming the video was rendered without audio.

Note
When muxing audio and video files into one file, the actual streams are just copied, and not transcoded. So there is no quality loss to neither the audio nor the video streams. Also, because the streams are just copied, muxing is very fast.


Assuming the video track was rendered to "Video.mkv" and the surround sound was exported to "5.1.ac3" the command to mux both to "Video-5.1.mkv" with avconv would be:

avconv -i Video.mkv -i 5.1.ac3 -c copy -map 0:0 -map 1:0 Video-5.1.mkv

The result should be an MKV video containing a Dolby Digital 5.1 surround sound audio track.

Editing Existing Surround Sound

When adding a clip with more than two channels to a project, kdenlive creates an audio thumbnail that correctly shows all audio channels:

The clip can be edited and (audio) effects applied to it, and all appears to work just fine - but once rendering the project, it turns out that the audio track in the resulting video file is 2 channels (stereo) only.

The following steps provide a manual workaround for this issue.

Extract and Split the Audio Track

The first step is to extract the audio track from the video clip. This can be done in Kdenlive with Extract Audio->Wav 48000Hz from the context menu of the clip. This creates a WAV audio file in the same folder as where the video clip is located.

The extracted WAV audio file can then be opened in Audacity, it should show all 6 channels, these are:

  • 1 - Front Left
  • 2 - Front Right
  • 3 - Center
  • 4 - LFE
  • 5 - Surround Left
  • 6 - Surround Right


Note
LFE (Low Frequency Effects) is often referred to as "subwoofer channel", which is not quite correct. A surround sound speaker setup is perfectly valid without subwoofer, in this case the surround sound system will redirect the LFE channel to "large" speakers, usually the front speakers.


The idea now is to split the surround sound into four separate (stereo/mono) audio files that Kdenlive can handle:

  • Front (stereo)
  • Center (mono)
  • LFE (mono)
  • Surround (stereo)


First, Audacity needs to be configured to not always export to stereo audio files: In Edit->Preferences, under Import/Export, select "Use custom mix (for example to export a 5.1 multichannel file)".

Now, tracks 1+2 and 5+6 should be turned into stereo tracks by choosing Make Stereo Track from the context menu of the 1st and the 5th track, respectively. This should result in 4 tracks, two stereo and two mono.

Next, the 4 tracks should be renamed to "Front", "Center", "LFE" and "Surround" starting from the top, using Name... from the context menu of each track.

The tracks now look like this:

After all this hard work, exporting the four tracks to four separate audio files is easy with File->Export Multiple.... Use "WAV" as "Export format", the rest of the settings should be already okay: "Split files based on: Tracks" and "Name files: Using Label/Track name".

The "Edit metadata" dialog might pop up for each track, it is fine to just say "OK". At the end there should be a confirmation dialog, and four audio files should have been exported: "Front.wav", "Center.wav", "LFE.wav" and "Surround.wav".

Import Audio Tracks into Kdenlive

The previously created audio files can now be added to the Kdenlive project using Project->Add Clip.

SInce there are only two audio tracks in a project by default, it is necessary to add two more using Project->Tracks->Insert Track before adding the four audio tracks to the timeline.

The next thing to do is to group the four audio tracks with the video clip by selecting all of them and then choosing Timeline->Group Clips.


Note
Don't forget to mute the original audio track in the video clip if necessary!


The Kdenlive project should now be ready for the usual editing, like cutting clips and adding effects, and should look something like this:

Rendering the Project

Since it is not possible to render the project with a surround sound audio track, some manual steps are necessary to work around this.

First, the video track needs to be rendered without audio. This is simply done by rendering the project as it would normally be done, but without audio, by deselecting the "Export audio" checkbox.

Then, each of the four surround sound audio tracks "Front.wav", "Center.wav", "LFE.wav" and "Surround.wav" need to be rendered into a separate audio file. For each of them, do the following:

  • Mute all other audio tracks
  • Enter a respective file name for "Output file"
  • Select "Audio only" as "Destination"
  • Select profile "WAV 48000 KHz"
  • Make sure "Export audio" is checked


Note
Unfortunately, the mono tracks "Center.wav" and "LFE.wav" are rendered as stereo tracks, and there seems to be no way to avoid this. But this can be handled later in Audacity.


Compose a Surround Sound Audio File

Now the separate audio tracks rendered by Kdenlive need to be "merged" into a single multichannel 5.1 surround sound audio file. This is again done in Audacity:

  • Import "Front.wav", "Center.wav", "LFE.wav" and "Surround.wav" (in this order!) using File->Import->Audio...


"Center" and "LFE" are now stereo, which is not what is needed. This can be fixed by selecting Split Stereo to Mono from the context menu of each track, and deleting one of the two resulting mono tracks.

Eventually, there should be four tracks in the Audacity project:

  • Front (stereo)
  • Center (mono)
  • LFE (mono)
  • Surround (stereo)


The project can now be exported into a 5.1 surround sound audio file:

  • Select File->Export...
  • Provide a name for "Name" and select "AC3 Files (FFmpeg)"
  • Click Options... and choose "512 kbps" as "Bit Rate"


The Advanced Mixing Options dialog should show up. The number of Output Channels should be 6 and the channel mapping should already be correct:

The result of the export should be an *.ac3 file which is playable with i.e. VLC or Dragon Player.

Muxing Video and Audio Together

Since video and audio was rendered separately, both need to be multiplexed into a single file containing both the video and audio stream.

Note
When muxing audio and video files into one file, the actual streams are just copied, and not transcoded. So there is no quality loss to neither the audio nor the video streams. Also, because the streams are just copied, muxing is very fast.


Assuming the video track was rendered to "Video.mkv" and the surround sound was exported to "5.1.ac3" the command to mux both to "Video-5.1.mkv" with avconv would be:

avconv -i Video.mkv -i 5.1.ac3 -c copy -map 0:0 -map 1:0 Video-5.1.mkv

Результат должен быть MKV видео содержащий Dolby Digital 5.1 Surround Sound аудио дорожки