[FFmpeg-user] Channel manipulation and audio filter equivalencies

2020-11-05 Thread Chris Angelico
Hi! (First time post on this list.)

I'm not a hugely skilled audiophile, and I'm trying to do some audio
manipulation with ffmpeg. At times, the result isn't what I'd like it
to be, and I'm not always sure why, so the first step right now is to
try to understand what on earth it is that I'm actually asking ffmpeg
to do :)

Primary references:
https://trac.ffmpeg.org/wiki/AudioChannelManipulation
https://ffmpeg.org/ffmpeg-filters.html

My input file has eight audio channels and is described by ffprobe as
"7.1". If I use the channelsplit filter, I can listen to any channel
individually:

ffmpeg -loglevel error -stats -y -i Original.mkv -filter_complex
'channelsplit=channel_layout=7.1' -map 0:v -map 0:s channel_split.mkv

(Without loglevel error, this produces massive spam of "Queue input is
backward in time", but the audio is fine. As a side point, I'm curious
as to whether there's a better solution than simply silencing those
warnings.)

The result is a file with video and subtitle streams unchanged, and
eight individual audio streams. With judicious use of
"-metadata:s:a:%d" these can even be labelled, making them easy to
flip through. Well and good.

The real challenge is selecting two channels and trying to make them
into the left and right channels of a new stereo audio channel. One
option is channelmap:

ffmpeg -loglevel error -stats -y -i Original.mkv -af
'channelmap=map=BL|BR' channel_split.mkv

Another option is pan:

ffmpeg -loglevel error -stats -y -i Original.mkv -af
'pan=stereo|c0=BL|c1=BR' channel_split.mkv

According to the docs, pan should detect a pure channel mapping and do
an optimized lossless remap, which in theory should mean that these
two are the same. But my understanding must be wrong, because they
sound completely different :)

A third option is join:

ffmpeg -loglevel error -stats -y -i Original.mkv -af
'join=inputs=1:map=0.BL-FL|0.BR-FR' channel_split.mkv

This sounds very similar to the pan result, but quieter.

What am I doing wrong with the channelmap, and what is the preferred
way to create a stereo output by selecting channels?

Chris Angelico
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Channel manipulation and audio filter equivalencies

2020-11-11 Thread Chris Angelico
On Fri, Nov 6, 2020 at 2:43 AM Chris Angelico  wrote:
> The real challenge is selecting two channels and trying to make them
> into the left and right channels of a new stereo audio channel. One
> option is channelmap:
>
> ffmpeg -loglevel error -stats -y -i Original.mkv -af
> 'channelmap=map=BL|BR' channel_split.mkv
>
> Another option is pan:
>
> ffmpeg -loglevel error -stats -y -i Original.mkv -af
> 'pan=stereo|c0=BL|c1=BR' channel_split.mkv
>

Anyone have recommendations on these options, or any other preferred
way to remap channels at maximum quality?

ChrisA
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Channel manipulation and audio filter equivalencies

2020-11-18 Thread adam smith via ffmpeg-user

> On 12 Nov 2020, at 06:10, Chris Angelico  wrote:
> 
> Anyone have recommendations on these options, or any other preferred
> way to remap channels at maximum quality?

You could try using the channelsplit and selecting the specific channels you 
want and then merging them into a single stream. 
channelsplit=channel_layout=7.1:channels=LF|RF[lf][rf];[lf][rf]amerge=inputs=2[aout]

Thanks
Adam
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Channel manipulation and audio filter equivalencies

2020-11-18 Thread Chris Angelico
On Thu, Nov 19, 2020 at 8:48 AM adam smith via ffmpeg-user
 wrote:
>
>
> > On 12 Nov 2020, at 06:10, Chris Angelico  wrote:
> >
> > Anyone have recommendations on these options, or any other preferred
> > way to remap channels at maximum quality?
>
> You could try using the channelsplit and selecting the specific channels you 
> want and then merging them into a single stream. 
> channelsplit=channel_layout=7.1:channels=LF|RF[lf][rf];[lf][rf]amerge=inputs=2[aout]
>

Hmm, I must be missing something here, because I get this error:

$ ffmpeg -stats -y -i Original.mkv -filter_complex
'channelsplit=channel_layout=7.1:channels=LF|RF[lf][rf];[lf][rf]amerge=inputs=2[aout]'
-map 0:v -map 0:s channel_split.mkv
[AVFilterGraph @ 0x559f11cf7f80] Error initializing filter
'channelsplit' with args 'channel_layout=7.1:channels=LF|RF'
Error initializing complex filters.
Invalid argument

But when I tried things along these lines, I got complaints that some
of the outputs weren't connected to anything.

ChrisA
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Channel manipulation and audio filter equivalencies

2020-11-18 Thread adam smith via ffmpeg-user

> On 18 Nov 2020, at 21:55, Chris Angelico  wrote:
> 
> But when I tried things along these lines, I got complaints that some
> of the outputs weren't connected to anything.

I didn’t add the input stream as I am not sure what stream it is on your source.
If could be something like…

ffmpeg -stats -y -i Original.mkv -filter_complex
"[0:1]channelsplit=channel_layout=7.1:channels=LF|RF[lf][rf];[lf][rf]amerge=inputs=2[aout]"
-map 0:v -map "aout" -map 0:s channel_split.mkv


___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Channel manipulation and audio filter equivalencies

2020-11-18 Thread Chris Angelico
On Thu, Nov 19, 2020 at 9:21 AM adam smith via ffmpeg-user
 wrote:
>
>
> > On 18 Nov 2020, at 21:55, Chris Angelico  wrote:
> >
> > But when I tried things along these lines, I got complaints that some
> > of the outputs weren't connected to anything.
>
> I didn’t add the input stream as I am not sure what stream it is on your 
> source.
> If could be something like…
>
> ffmpeg -stats -y -i Original.mkv -filter_complex
> "[0:1]channelsplit=channel_layout=7.1:channels=LF|RF[lf][rf];[lf][rf]amerge=inputs=2[aout]"
> -map 0:v -map "aout" -map 0:s channel_split.mkv
>

Regardless of the input mapping, it's still complaining about that
channelsplit configuration.

Is there any way to figure out what the actual error is? Even with
loglevel debug, all I get is this:

Successfully opened the file.
[Parsed_channelsplit_0 @ 0x55f0a8d38780] Setting 'channel_layout' to value '7.1'
[Parsed_channelsplit_0 @ 0x55f0a8d38780] Setting 'channels' to value 'LF|RF'
[AVFilterGraph @ 0x55f0a8cea280] Error initializing filter
'channelsplit' with args 'channel_layout=7.1:channels=LF|RF'
Error initializing complex filters.
Invalid argument

ChrisA
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Channel manipulation and audio filter equivalencies

2020-11-18 Thread adam smith via ffmpeg-user
Apologies, I said LF|RF but it should be 
'channelsplit' with args 'channel_layout=7.1:channels=FL|FR’ 

 "7.1"   =>["FL","FR","FC","LFE","BL","BR","SL","SR"],
 "7.1(wide)" =>["FL","FR","FC","LFE","BL","BR","FLC","FRC"],
 "7.1(wide-side)"=>["FL","FR","FC","LFE","FLC","FRC","SL","SR"],

> On 18 Nov 2020, at 22:47, Chris Angelico  wrote:
> 
> 'channelsplit' with args 'channel_layout=7.1:channels=LF|RF'

___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Channel manipulation and audio filter equivalencies

2020-11-18 Thread Chris Angelico
On Thu, Nov 19, 2020 at 10:08 AM adam smith via ffmpeg-user
 wrote:
>
> Apologies, I said LF|RF but it should be
> 'channelsplit' with args 'channel_layout=7.1:channels=FL|FR’
>
>  "7.1"   =>["FL","FR","FC","LFE","BL","BR","SL","SR"],
>  "7.1(wide)" =>["FL","FR","FC","LFE","BL","BR","FLC","FRC"],
>  "7.1(wide-side)"=>["FL","FR","FC","LFE","FLC","FRC","SL","SR"],
>

Ahh, thank you!

That does at least work, so now I'm going to let that do some work for
a while and then listen to the results :)

Appreciate the help. Still not sure how all the different filters behave.

ChrisA
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-user] Channel manipulation and audio filter equivalencies

2020-11-18 Thread adam smith via ffmpeg-user


> On 18 Nov 2020, at 23:29, Chris Angelico  wrote:
> 
> Appreciate the help. Still not sure how all the different filters behave.

No worries, 
I have not read any of the code so I do not really know what manipulations are 
occurring under the hood.

As far as I can tell, the channel split is pulling the individual channels from 
the source audio stream and the amerge is combining them into a new stereo 
stream basically unchanged other than any codec transformations.

Using the pan filter would allow you to manipulate the actual audio content as 
it allows for each channel pan level and attenuation; this could affect audio 
quality perhaps.

As I say, this is not based on reading one reading any code so I may be wrong.
I will be interested to know your results.

Thanks
Adam 

___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".