Re: [FFmpeg-user] Decode ac3 from multichannel USB input

2023-11-03 Thread Fred Rotbart
Finally, I managed to extract ac3 from the Digiface USB spdif input but 
not in a way that helped me.
It took a while but eventually I learned that the spdif signal is not 
pure ac3 but ac3 wrapped as SMPTE ST 337. VLC does not recognise this 
but ffmpeg and MediaInfo do.


So if I first capture the first two Digiface channels into a file using:
`ffmpeg -f avfoundation -i :2 -filter_complex "[0:a]pan=2C|c0=c0|c1=c1" 
-y capture.wav`


and pipe this file into the VLC audio capture device via Blackhole2ch or 
any other audio device:
`ffmpeg -y -i capture_2c.wav -f spdif -f audiotoolbox 
-audio_device_index 2 -`


it works since ffmpeg will extract the ac3 and if necessary, decode 
appropriately.


However, if I try to use VLC as the capture device directly:
`ffmpeg -f avfoundation -i :2 -filter_complex "[0:a]pan=2C|c0=c0|c1=c1" 
-f spdif -f audiotoolbox -audio_device_index 2 -`


ffmpeg does not extract the ac3 but passes on the raw signal as PCM!

I tried bypassing the problem by using a pipe, such as:
`ffmpeg -f avfoundation -i :2 -filter_complex "[0:a]pan=2C|c0=c0|c1=c1" 
-f s16le - | ffmpeg -i - -f audiotoolbox -audio_device_index 2 -`


Here after the pipe, ffmpeg recognised the format but this only worked 
for about 15 seconds and then no more data was passed.


Nothing I tried solved this problem, so unless I get another bright idea 
or some help, I guess I am giving up on this for now.


On 31/10/2023 17:39, Fred Rotbart wrote:
Okay! After many hours I am making some progress (if anyone is 
interested).


This extracts the channels, recognises the ac3 and decodes it but 
there are errors thrown from time to time and the rate is not constant.


ffmpeg -f avfoundation -capture_raw_data true -i :2 -filter_complex "\
[0:a]pan=1C|c0=c0[a0];\
[0:a]pan=1C|c0=c1[a1];\
[a0][a1]amerge=inputs=2[a3]" -map '[a3]' \
-f s16le - \
| ffmpeg -loglevel debug \
-acodec ac3 -i - \
-af 'pan=5.1|c0=FL|c1=FR|c4=FC|c5=LFE|c2=SL|c3=SR' \
-ar 48000 -y output.wav

How can I clean this up and make it more stable?

Thanks
-Fred

On 28/10/2023 15:36, Fred Rotbart wrote:
Here is one of my many other attempts. It should be clear that I am a 
beginner with ffmpeg.


No matter what I try, ffmpeg seems to merge all the 32 USB channels 
into 6.


For example:

ffmpeg -ac 2 -c ac3 -loglevel debug -f avfoundation -i :2 -af 
'pan=5.1' output.wav


Part of the output:

Splitting the commandline.
Reading option '-ac' ... matched as option 'ac' (set number of audio 
channels) with argument '2'.
Reading option '-c' ... matched as option 'c' (codec name) with 
argument 'ac3'.
Reading option '-loglevel' ... matched as option 'loglevel' (set 
logging level) with argument 'debug'.
Reading option '-f' ... matched as option 'f' (force format) with 
argument 'avfoundation'.

Reading option '-i' ... matched as input url with argument ':2'.
Reading option '-af' ... matched as option 'af' (set audio filters) 
with argument 'pan=5.1'.

Reading option 'output.wav' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url :2.
Applying option ac (set number of audio channels) with argument 2.
Applying option c (codec name) with argument ac3.
Applying option f (force format) with argument avfoundation.
Successfully parsed a group of options.
Opening an input file: :2.
[avfoundation @ 0x7f96400041c0] audio device 'Digiface USB 
(24162724)' opened
For transform of length 128, inverse, mdct_float, flags: [aligned, 
out_of_place], found 3 matches:
    1: mdct_inv_float_avx2 - type: mdct_float, len: [16, ∞], 
factors[2]: [2, any], flags: [aligned, out_of_place, inv_only], prio: 
544
    2: mdct_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: 
[2, any], flags: [unaligned, out_of_place, inv_only], prio: 96
    3: mdct_naive_inv_float_c - type: mdct_float, len: [2, ∞], 
factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], 
prio: -130976
For transform of length 64, inverse, fft_float, flags: [aligned, 
inplace, preshuf, asm_call], found 3 matches:
    1: fft_sr_asm_float_avx2 - type: fft_float, len: [64, 131072], 
factor: 2, flags: [aligned, inplace, out_of_place, preshuf, 
asm_call], prio: 480
    2: fft_sr_asm_float_fma3 - type: fft_float, len: [64, 131072], 
factor: 2, flags: [aligned, inplace, out_of_place, preshuf, 
asm_call], prio: 448
    3: fft_sr_asm_float_avx - type: fft_float, len: [64, 131072], 
factor: 2, flags: [aligned, inplace, out_of_place, preshuf, 
asm_call], prio: 416

Transform tree:
    mdct_inv_float_avx2 - type: mdct_float, len: 128, factors[2]: [2, 
any], flags: [aligned, out_of_place, inv_only]
    fft_sr_asm_float_avx2 - type: fft_float, len: 64, factor: 2, 
flags: [aligned, inplace, out_of_place, preshuf, asm_call]
For transform of length 256, inverse, mdct_float, flags: [aligned, 
out_of_place], found 3 matches:
    1: 

Re: [FFmpeg-user] Decode ac3 from multichannel USB input

2023-10-31 Thread Fred Rotbart

Okay! After many hours I am making some progress (if anyone is interested).

This extracts the channels, recognises the ac3 and decodes it but there 
are errors thrown from time to time and the rate is not constant.


ffmpeg -f avfoundation -capture_raw_data true -i :2 -filter_complex "\
[0:a]pan=1C|c0=c0[a0];\
[0:a]pan=1C|c0=c1[a1];\
[a0][a1]amerge=inputs=2[a3]" -map '[a3]' \
-f s16le - \
| ffmpeg -loglevel debug \
-acodec ac3 -i - \
-af 'pan=5.1|c0=FL|c1=FR|c4=FC|c5=LFE|c2=SL|c3=SR' \
-ar 48000 -y output.wav

How can I clean this up and make it more stable?

Thanks
-Fred

On 28/10/2023 15:36, Fred Rotbart wrote:
Here is one of my many other attempts. It should be clear that I am a 
beginner with ffmpeg.


No matter what I try, ffmpeg seems to merge all the 32 USB channels 
into 6.


For example:

ffmpeg -ac 2 -c ac3 -loglevel debug -f avfoundation -i :2 -af 
'pan=5.1' output.wav


Part of the output:

Splitting the commandline.
Reading option '-ac' ... matched as option 'ac' (set number of audio 
channels) with argument '2'.
Reading option '-c' ... matched as option 'c' (codec name) with 
argument 'ac3'.
Reading option '-loglevel' ... matched as option 'loglevel' (set 
logging level) with argument 'debug'.
Reading option '-f' ... matched as option 'f' (force format) with 
argument 'avfoundation'.

Reading option '-i' ... matched as input url with argument ':2'.
Reading option '-af' ... matched as option 'af' (set audio filters) 
with argument 'pan=5.1'.

Reading option 'output.wav' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url :2.
Applying option ac (set number of audio channels) with argument 2.
Applying option c (codec name) with argument ac3.
Applying option f (force format) with argument avfoundation.
Successfully parsed a group of options.
Opening an input file: :2.
[avfoundation @ 0x7f96400041c0] audio device 'Digiface USB (24162724)' 
opened
For transform of length 128, inverse, mdct_float, flags: [aligned, 
out_of_place], found 3 matches:
    1: mdct_inv_float_avx2 - type: mdct_float, len: [16, ∞], 
factors[2]: [2, any], flags: [aligned, out_of_place, inv_only], prio: 544
    2: mdct_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: 
[2, any], flags: [unaligned, out_of_place, inv_only], prio: 96
    3: mdct_naive_inv_float_c - type: mdct_float, len: [2, ∞], 
factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], 
prio: -130976
For transform of length 64, inverse, fft_float, flags: [aligned, 
inplace, preshuf, asm_call], found 3 matches:
    1: fft_sr_asm_float_avx2 - type: fft_float, len: [64, 131072], 
factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], 
prio: 480
    2: fft_sr_asm_float_fma3 - type: fft_float, len: [64, 131072], 
factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], 
prio: 448
    3: fft_sr_asm_float_avx - type: fft_float, len: [64, 131072], 
factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], 
prio: 416

Transform tree:
    mdct_inv_float_avx2 - type: mdct_float, len: 128, factors[2]: [2, 
any], flags: [aligned, out_of_place, inv_only]
    fft_sr_asm_float_avx2 - type: fft_float, len: 64, factor: 2, 
flags: [aligned, inplace, out_of_place, preshuf, asm_call]
For transform of length 256, inverse, mdct_float, flags: [aligned, 
out_of_place], found 3 matches:
    1: mdct_inv_float_avx2 - type: mdct_float, len: [16, ∞], 
factors[2]: [2, any], flags: [aligned, out_of_place, inv_only], prio: 544
    2: mdct_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: 
[2, any], flags: [unaligned, out_of_place, inv_only], prio: 96
    3: mdct_naive_inv_float_c - type: mdct_float, len: [2, ∞], 
factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], 
prio: -130976
For transform of length 128, inverse, fft_float, flags: [aligned, 
inplace, preshuf, asm_call], found 3 matches:
    1: fft_sr_asm_float_avx2 - type: fft_float, len: [64, 131072], 
factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], 
prio: 480
    2: fft_sr_asm_float_fma3 - type: fft_float, len: [64, 131072], 
factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], 
prio: 448
    3: fft_sr_asm_float_avx - type: fft_float, len: [64, 131072], 
factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], 
prio: 416

Transform tree:
    mdct_inv_float_avx2 - type: mdct_float, len: 256, factors[2]: [2, 
any], flags: [aligned, out_of_place, inv_only]
    fft_sr_asm_float_avx2 - type: fft_float, len: 128, factor: 2, 
flags: [aligned, inplace, out_of_place, preshuf, asm_call]

[avfoundation @ 0x7f96400041c0] All info found
Input #0, avfoundation, from ':2':
  Duration: N/A, start: 1307454.032041, bitrate: N/A
  Stream #0:0, 1, 1/100: Audio: ac3, 44100 Hz, 32 channels, fltp
Successfully opened the file.

Re: [FFmpeg-user] Decode ac3 from multichannel USB input

2023-10-28 Thread Fred Rotbart
Here is one of my many other attempts. It should be clear that I am a 
beginner with ffmpeg.


No matter what I try, ffmpeg seems to merge all the 32 USB channels into 6.

For example:

ffmpeg -ac 2 -c ac3 -loglevel debug -f avfoundation -i :2 -af 'pan=5.1' 
output.wav


Part of the output:

Splitting the commandline.
Reading option '-ac' ... matched as option 'ac' (set number of audio 
channels) with argument '2'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 
'ac3'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging 
level) with argument 'debug'.
Reading option '-f' ... matched as option 'f' (force format) with 
argument 'avfoundation'.

Reading option '-i' ... matched as input url with argument ':2'.
Reading option '-af' ... matched as option 'af' (set audio filters) with 
argument 'pan=5.1'.

Reading option 'output.wav' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url :2.
Applying option ac (set number of audio channels) with argument 2.
Applying option c (codec name) with argument ac3.
Applying option f (force format) with argument avfoundation.
Successfully parsed a group of options.
Opening an input file: :2.
[avfoundation @ 0x7f96400041c0] audio device 'Digiface USB (24162724)' 
opened
For transform of length 128, inverse, mdct_float, flags: [aligned, 
out_of_place], found 3 matches:
    1: mdct_inv_float_avx2 - type: mdct_float, len: [16, ∞], 
factors[2]: [2, any], flags: [aligned, out_of_place, inv_only], prio: 544
    2: mdct_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: 
[2, any], flags: [unaligned, out_of_place, inv_only], prio: 96
    3: mdct_naive_inv_float_c - type: mdct_float, len: [2, ∞], 
factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: 
-130976
For transform of length 64, inverse, fft_float, flags: [aligned, 
inplace, preshuf, asm_call], found 3 matches:
    1: fft_sr_asm_float_avx2 - type: fft_float, len: [64, 131072], 
factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], 
prio: 480
    2: fft_sr_asm_float_fma3 - type: fft_float, len: [64, 131072], 
factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], 
prio: 448
    3: fft_sr_asm_float_avx - type: fft_float, len: [64, 131072], 
factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], 
prio: 416

Transform tree:
    mdct_inv_float_avx2 - type: mdct_float, len: 128, factors[2]: [2, 
any], flags: [aligned, out_of_place, inv_only]
    fft_sr_asm_float_avx2 - type: fft_float, len: 64, factor: 2, 
flags: [aligned, inplace, out_of_place, preshuf, asm_call]
For transform of length 256, inverse, mdct_float, flags: [aligned, 
out_of_place], found 3 matches:
    1: mdct_inv_float_avx2 - type: mdct_float, len: [16, ∞], 
factors[2]: [2, any], flags: [aligned, out_of_place, inv_only], prio: 544
    2: mdct_inv_float_c - type: mdct_float, len: [2, ∞], factors[2]: 
[2, any], flags: [unaligned, out_of_place, inv_only], prio: 96
    3: mdct_naive_inv_float_c - type: mdct_float, len: [2, ∞], 
factors[2]: [2, any], flags: [unaligned, out_of_place, inv_only], prio: 
-130976
For transform of length 128, inverse, fft_float, flags: [aligned, 
inplace, preshuf, asm_call], found 3 matches:
    1: fft_sr_asm_float_avx2 - type: fft_float, len: [64, 131072], 
factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], 
prio: 480
    2: fft_sr_asm_float_fma3 - type: fft_float, len: [64, 131072], 
factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], 
prio: 448
    3: fft_sr_asm_float_avx - type: fft_float, len: [64, 131072], 
factor: 2, flags: [aligned, inplace, out_of_place, preshuf, asm_call], 
prio: 416

Transform tree:
    mdct_inv_float_avx2 - type: mdct_float, len: 256, factors[2]: [2, 
any], flags: [aligned, out_of_place, inv_only]
    fft_sr_asm_float_avx2 - type: fft_float, len: 128, factor: 2, 
flags: [aligned, inplace, out_of_place, preshuf, asm_call]

[avfoundation @ 0x7f96400041c0] All info found
Input #0, avfoundation, from ':2':
  Duration: N/A, start: 1307454.032041, bitrate: N/A
  Stream #0:0, 1, 1/100: Audio: ac3, 44100 Hz, 32 channels, fltp
Successfully opened the file.
Parsing a group of options: output url output.wav.
Applying option af (set audio filters) with argument pan=5.1.
Successfully parsed a group of options.
Opening an output file: output.wav.
File 'output.wav' already exists. Overwrite? [y/N] y
[file @ 0x7f9640108000] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
For transform of length 128, inverse, mdct_float, flags: [aligned, 
out_of_place], found 3 matches:
    1: mdct_inv_float_avx2 - type: mdct_float, len: [16, ∞], 
factors[2]: [2, any], flags: [aligned, out_of_place, inv_only], prio: 544
    2: mdct_inv_float_c - type: mdct_float, len: 

[FFmpeg-user] Decode ac3 from multichannel USB input

2023-10-25 Thread Fred Rotbart

Hi,

I have a RME Digiface USB as input to my Mac. This has 32 SPDIF input 
channels, of which the first two have an ac3 signal and the others are 
not used.
I have been trying to isolate and decode one of the ac3 channels to its 
six separate PCM channels but without success.


For example, as one of the many attempts, I tried:

ffmpeg -acodec ac3 -f avfoundation -capture_raw_data true -i :1 \
-map_channel 0.0.0, \
-af 'pan=5.1|c0=c0|c1=-|c2=FC|c3=LFE|c4=BL|c5=BR' \
output.wav

Can someone help me with this?

- Fred

___
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".