This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Kdenlive and multiple (>2) audio channels

Tags: None
(comma "," separated)
mcfrisk
Registered Member
Posts
40
Karma
0
Is it possible to get more than two audio channels as output from kdenlive?

After rendering it is propably possible to combine multiple audio channels with
some ffmpeg tricks. Any hints?

My video project contains a metronome audio track and various sounds from the video clips. I'd like to direct the metronome track to the ears of a drummer and the rest of the video related sounds to a PA system in a live performance. We have mixers and hopefully a multichannel capable player PC and software, and as a fallback I can downmix these as mono tracks to two channels. Right now I've rendered the project with two different audio setups by muting the required tracks.

Any help appreciated, thanks.


ttill
Registered Member
Posts
372
Karma
0
MLT currently does not support more than 2 channels.
Not sure on how to add more audio channels using ffmpeg, though.
ddennedy
Registered Member
Posts
1315
Karma
1
MLT does support more than 2 channels, but Kdenlive will require some changes. Likely the changes will identify some shortcomings in MLT because this area has not been heavily exercised.


ttill
Registered Member
Posts
372
Karma
0
Good to hear.
What do we have to change in Kdenlive to support this?
mcfrisk
Registered Member
Posts
40
Karma
0
Ok, so I will just use the two mono channel approach then. Here are the details for my usecase if anyone cares.

I render two projects from the kdenlive project: video with metronome and effect audio tracks.

Then I will strip the audiotracks from the rendered output files:

$ ffmpeg -i ../test_metronome.mp4 -vn -acodec pcm_s16le -ar 48000 -ac 1 test_metronome.wav

$ ffmpeg -i ../test.mp4 -vn -acodec pcm_s16le -ar 48000 -ac 1 test.wav

Next I open these two .wav files in audacity, set pan to left and right on each track, and export the two channel project as test_metro_left_misc_right.wav.
Then I replace the original audio track in the video file:

$ ffmpeg -i ../test.mp4 -i test_metro_left_misc_right.wav -map 0:0 -map 1:0 -vcodec copy -acodec libmp3lame -ab 128k test_metro_left_misc_right.mp4

There might be ways to add multiple audio channels into the rendered output, but I didn't try them yet.


markoc
Registered Member
Posts
342
Karma
1
I am (probably) not going to make any multi audio channel videos in the near future, but the curiosity is still nagging me...

Most of my non-laptop computers (their sound cards) have a pile of connectors for X.1 surround sound, although only outputs :-(

So I am intersted in the following:
- how are these supported in things like Xine, Mplyer, VLC....? (and ALSA, mixers. etc...?)
- is true multichannel audio well supported in the popular containers (Mpeg, Matroska, AVI....?)

Apart from the surround thing, how about true independent channels, for example for multilingual use? Like stereo ambient sound plus n channels of multilingual commentary?

Could someone familiar with these things please provide some links where I could study this topic further?

ddennedy
Registered Member
Posts
1315
Karma
1
Marko, the answers to your bulleted list of questions is "yes." Most of them support surround channels as well as selecting an audio stream. Today, in Kdenlive, you can select an audio stream in the Advanced section of the Clip properties dialog. Please do not use the term "channels" when you really mean streams or tracks. MLT does not have support for encoding multiple audio streams. Over the past year, I did some work for supporting multiple audio streams for commercial users of MLT using SDI output for TV playout with multiple languages and stereo vs. surround. I added a way to request all input audio streams in the avformat input plugin (audio_index=all), and in the SDI output plugins, I added a way to remap the input channels of a clip to the output channels. In SDI, there is no such thing as streams or tracks - just channels.

I do not know off-hand what all changes are needed in Kdenlive for more than stereo (not talking multiple streams here), but certainly one is to add a channel count to the project settings. Maybe I should add that to the MLT profile. Also, the Render dialog would need a channel count field to override the project setting. These would set a consumer integer property "channels." Also, the Render dialog would need a way to let the user define a channel layout like mono, stereo, surround, quad, 5.1 surround. Beyond that, maybe needed is a taller track view with more than 2 channels' waveforms and extending the audio effects to address more channels. Some MLT audio effects are already ready. More work is needed on a surround matrix panner. We should take a look at what Cinelerra has done and perhaps reuse some of it.


markoc
Registered Member
Posts
342
Karma
1
Thanks for the answers, Dan.
Of course I have a zillion other stupid questions ready ;-)

One set of questions is about the channel/stream/track thingies.
I've been to google and wiki, but little success... Wiki about surround only talks about channels, etc.

For me a channel (in this context) is a single time varying signal, like from one microphone, or its sampled and quantized representation.

I have a much less clear picture of what a stream is... I thought of it like when computer people talk about a procession of bits that is coming in at some rate, and has to be chewed and spit out in real time.
But then, what does a multiplexed MPEG-TS stream contain, audio streams or channels? Maybe streams that contain channels? Or tracks?
When a stream is stored on a disk and goes nowhere, is it still a stream?
And SDI, which really looks to me very streamy, does have channels?

Speaking of tracks, in the days of reel to reel tape and film, these were real physical tracks, each containing one channel.
But in a typical video editor like Kdenlive, a track contains both a video and some audio.... whats?

Or is it just names given by the specification writers, like the MPEG guys called their stuff streams, and SDI guys theirs channels?

Sorry for machine gunning questions like this.... but I guess it would be good to set the nomenclature first...



ddennedy
Registered Member
Posts
1315
Karma
1
Audio streams contain one or more channels. Outside of a video editor or audio editor, some terminology (Quicktime file) uses the "track" term. A mulitplex contains streams, which contains channels.

Re: "When a stream is stored on a disk and goes nowhere, is it still a stream?"
Is that like http://en.wikipedia.org/wiki/If_a_tree_falls_in_a_forest ? :-)

Files may be considered streams: man fopen.

I just don't want anyone to get the idea that we should support multiple audio and/or video streams before tackling >2 channels.



markoc
Registered Member
Posts
342
Karma
1
Thanks for clarifying that...
Didn't occur to me that these had to do with Unix "streams"... heh...
Anyway, it is channels that I am interested in.

Like, thinking of buying an Zoom H2, which can record 4ch...

Also, my DV camcorder has an option to record four 12 bit channels instead of two 16 bit ones. I always wondered from where the other two signals would come, since there are only two mics on the cam, and if you plug something in the "external mic" socket, the internal mics get disabled...? Have never tried this mode, wonder what dvgrab and other things downstream (ouch!) would say...

But I am no audio guy, so these things will have to wait some (years) more :-)


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot], Yahoo [Bot]