[FFmpeg-trac] #6638(avfilter:new): aresample does not work for unknown channel layouts
FFmpeg
trac at avcodec.org
Fri May 4 02:55:57 EEST 2018
#6638: aresample does not work for unknown channel layouts
-------------------------------------+-------------------------------------
Reporter: CoRoNe | Owner:
Type: defect | Status: new
Priority: normal | Component: avfilter
Version: git-master | Resolution:
Keywords: aresample | Blocked By:
unknown channel layouts | Reproduced by developer: 0
Blocking: |
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Changes (by CoRoNe):
* version: unspecified => git-master
Comment:
Today I've had another look at this. (FFmpeg used:
ffmpeg-N-90853-g3914a76)
{{{
ffmpeg -v 40 -f lavfi -i sine -af "loudnorm" -f null NUL
[...]
[graph_0_in_0_0 @ 05b35e00] tb:1/44100 samplefmt:s16 samplerate:44100
chlayout:0x4
[Parsed_loudnorm_0 @ 05b35880] auto-inserting filter 'auto_resampler_0'
between the filter 'graph_0_in_0_0' and the filter 'Parsed_loudnorm_0'
[format_out_0_0 @ 05b36dc0] auto-inserting filter 'auto_resampler_1'
between the filter 'Parsed_loudnorm_0' and the filter 'format_out_0_0'
[auto_resampler_0 @ 05b37ac0] ch:1 chl:mono fmt:s16 r:44100Hz -> ch:1
chl:mono fmt:dbl r:192000Hz
[auto_resampler_1 @ 05b37600] ch:1 chl:mono fmt:dbl r:192000Hz -> ch:1
chl:mono fmt:s16 r:192000Hz
}}}
To mimic the same output (sample-format and sample-rate wise):
{{{
ffmpeg -v 40 -f lavfi -i sine -af "aformat=dbl:192000" -f null NUL
[...]
[graph_0_in_0_0 @ 05b36040] tb:1/44100 samplefmt:s16 samplerate:44100
chlayout:0x4
[Parsed_aformat_0 @ 05b358c0] auto-inserting filter 'auto_resampler_0'
between the filter 'graph_0_in_0_0' and the filter 'Parsed_aformat_0'
[format_out_0_0 @ 05b36dc0] auto-inserting filter 'auto_resampler_1'
between the filter 'Parsed_aformat_0' and the filter 'format_out_0_0'
[auto_resampler_0 @ 05b37900] ch:1 chl:mono fmt:s16 r:44100Hz -> ch:1
chl:mono fmt:dbl r:192000Hz
[auto_resampler_1 @ 05b37440] ch:1 chl:mono fmt:dbl r:192000Hz -> ch:1
chl:mono fmt:s16 r:192000Hz
}}}
Adding `aresample` to the filter chain results in the same error as with
the `loudnorm` filter:
{{{
ffmpeg -v 40 -f lavfi -i sine -af "aformat=dbl:192000,aresample=44100" -f
null NUL
[...]
[graph_0_in_0_0 @ 05b4ab40] tb:1/44100 samplefmt:s16 samplerate:44100
chlayout:0x4
[Parsed_aformat_0 @ 05b358c0] auto-inserting filter 'auto_resampler_0'
between the filter 'graph_0_in_0_0' and the filter 'Parsed_aformat_0'
[Parsed_aresample_1 @ 05b360c0] Cannot select channel layout for the link
between filters Parsed_aresample_1 and format_out_0_0.
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
}}}
This can be fixed with `ocl=mono`:
{{{
ffmpeg -v 40 -f lavfi -i sine -af
"aformat=dbl:192000,aresample=44100:ocl=mono" -f null NUL
[...]
[graph_0_in_0_0 @ 05b4ac40] tb:1/44100 samplefmt:s16 samplerate:44100
chlayout:0x4
[Parsed_aformat_0 @ 05b358c0] auto-inserting filter 'auto_resampler_0'
between the filter 'graph_0_in_0_0' and the filter 'Parsed_aformat_0'
[auto_resampler_0 @ 05b4c980] ch:1 chl:mono fmt:s16 r:44100Hz -> ch:1
chl:mono fmt:dbl r:192000Hz
[Parsed_aresample_1 @ 05b360c0] ch:1 chl:mono fmt:dbl r:192000Hz -> ch:1
chl:mono fmt:s16 r:44100Hz
}}}
...but the strange thing is that it appears the channel layout only gets
lost with this particular format (double, 192000Hz), because `ocl=mono`
isn't needed when I only change the sample-format or the sample-rate
separately:
{{{
ffmpeg -v 40 -f lavfi -i sine -af
"aformat=sample_rates=192000,aresample=44100" -f null NUL
[...]
[graph_0_in_0_0 @ 05b4aa00] tb:1/44100 samplefmt:s16 samplerate:44100
chlayout:0x4
[Parsed_aformat_0 @ 05b358c0] auto-inserting filter 'auto_resampler_0'
between the filter 'graph_0_in_0_0' and the filter 'Parsed_aformat_0'
[auto_resampler_0 @ 05b4c800] ch:1 chl:mono fmt:s16 r:44100Hz -> ch:1
chl:mono fmt:s16 r:192000Hz
[Parsed_aresample_1 @ 05b35e80] ch:1 chl:mono fmt:s16 r:192000Hz -> ch:1
chl:mono fmt:s16 r:44100Hz
}}}
{{{
ffmpeg -v 40 -f lavfi -i sine -af
"aformat=sample_fmts=dbl,aresample=44100" -f null NUL
[...]
[graph_0_in_0_0 @ 05b4a9c0] tb:1/44100 samplefmt:s16 samplerate:44100
chlayout:0x4
[Parsed_aformat_0 @ 05b358c0] auto-inserting filter 'auto_resampler_0'
between the filter 'graph_0_in_0_0' and the filter 'Parsed_aformat_0'
[auto_resampler_0 @ 05b4c780] ch:1 chl:mono fmt:s16 r:44100Hz -> ch:1
chl:mono fmt:dbl r:44100Hz
[Parsed_aresample_1 @ 05b35e80] ch:1 chl:mono fmt:dbl r:44100Hz -> ch:1
chl:mono fmt:s16 r:44100Hz
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/6638#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list