converting dolby digital input
Closed this issue · 20 comments
i am trying to convert dolby digital
from spdif input to a virtual 5.1 sink with:
arecord -D hw:CARD=sndrpihifiberry,DEV=0 -q -C -f s16_le -c 2 -t raw --disable-channels --disable-format --disable-resample --disable-softvol | ./pareceive - vsink2
which fails with:
Playing IEC61937: Audio: ac3, 48000 Hz, stereo, fltp, 640 kb/s
Closed output stream
when sending dolby digital plus
i get:
Data type 0x0015 in IEC 61937 is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[spdif @ 0x839a40] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)
avformat_find_stream_info: Not yet implemented in FFmpeg, patches welcome
i have created that sink with
pacmd load-module module-null-sink sink_name=vsink2 sink_properties=device.description=vsink2 channels=6 channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe
is dolby digital content not supported? am i doing anything wrong?
Hi!
The output for the first case (dolby digital) looks normal. Did it play anything or stopped unexpectedly?
As for the second case (dolby digital plus), we rely on ffmpeg on supported codecs. FFmpeg indeed does not currently support decoding IEC61937_EAC3. May I ask you to record a couple of minutes sample, I will check what I can do.
Hi! Thanks for your support!
sorry the log from dobly digital is not complete, i missed the error part:
arecord -D hw:CARD=sndrpihifiberry,DEV=0 -q -C -f s16_le -c 2 -t raw --disable-channels --disable-format --disable-resample --disable-softvol | ./pareceive -
overrun!!! (at least 90.985 ms long)
pa_stream_connect_playback() failed: Bad state
Playing IEC61937: Audio: ac3, 48000 Hz, stereo, fltp, 640 kb/s
Closed output stream
the program then stops.
for dolby digital plus i will record a sample, i could not hear anything in it (i think it is just encoded).
also dolby digital would be enough for my application!
Does it happen with the null sink or a real device? What device do you use for output?
One thing to consider is that the clocks of input and output diverge too much. As a workaround, please try to add a module-combine-sink between pareceive and the output stream, it will auto-adjust the bitrate, like:
pacmd load-module module-combine-sink sink_name=vsink3 slaves=vsink2 channels=6 channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe
arecord -D hw:CARD=sndrpihifiberry,DEV=0 -q -C -f s16_le -c 2 -t raw --disable-channels --disable-format --disable-resample --disable-softvol | ./pareceive - vsink3
As for dolby digital plus, just forward the output of arecord
to a file
it is a null sink, i try to pass the decoded output of pareceive to over that virtual sink to modify the audios on the channels before putting out to my real device.
maybe there is even a better way to do this?
the module-combine-sink command results in the same error:
pacmd load-module module-null-sink sink_name=vsink2 sink_properties=device.description=vsink2 channels=6 channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe
pacmd load-module module-combine-sink sink_name=vsink3 slaves=vsink2 channels=6 channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe
arecord -D hw:CARD=sndrpihifiberry,DEV=0 -q -C -f s16_le -c 2 -t raw --disable-channels --disable-format --disable-resample --disable-softvol | ./pareceive - vsink3
for dolby digital i did the following:
pacmd load-module module-null-sink sink_name=vsink2 sink_properties=device.description=vsink2 channels=6 channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe
arecord -D hw:CARD=sndrpihifiberry,DEV=0 -q -C -f s16_le -c 2 -t raw --disable-channels --disable-format --disable-resample --disable-softvol | ./pareceive - vsink2
and in another console
ffmpeg -f pulse -i vsink2.monitor test.wav
this results in the following file: https://www.file-upload.net/download-14519722/test.wav.html
the record spams the warning i posted: Data type 0x0015 in IEC 61937 is not implemented.
the ffmpeg spams: [wav @ 0x12acd50] Non-monotonous DTS in output stream 0:0; previous: 2627591, current: 2626676; changing to 2627591. This may result in incorrect timestamps in the output file.
how could i record directly with arecord?
Please try the following:
arecord -D hw:CARD=sndrpihifiberry,DEV=0 -q -C -f s16_le -c 2 -t raw --disable-channels --disable-format --disable-resample --disable-softvol > test.wav
alright did this: https://www.file-upload.net/download-14519732/test.wav.html
i did the same with dolby digital content: https://www.file-upload.net/download-14519744/test-doblydigital2.wav.html
this is the source file i am playing: https://www.file-upload.net/download-14519739/dolby_channel_check-DWEU_x264.mp4.html
Please test dolby digital now
thanks that looks good! i'm able to get the decoded audio on my null sink monitor now!
but i am not sure if the audio channels are correct as i get all channels mapped on the stereo parts, am i doing something wrong here while recording?
virtual sink:
pacmd load-module module-null-sink sink_name=vsink2 sink_properties=device.description=vsink2 channels=6 channel_map=front-left,front-right,rear-left,rear-right,front-center,lfe
pareceive:
arecord -D hw:CARD=sndrpihifiberry,DEV=0 -q -C -f s16_le -c 2 -t raw --disable-channels --disable-format --disable-resample --disable-softvol | ./pareceive - vsink2
record:
ffmpeg -f pulse -i vsink2.monitor -ac 6 test6.wav
ffprobe shows me 5.1 now, but isolating one channel with
ffmpeg -i test6.wav -af "pan=mono|FC=BL" bl.wav
gives me no output on that wav file while FL and FR tests contains all the recorded audio (from front and back channels).
log von pareceive for this:
Playing IEC61937: Audio: ac3, 48000 Hz, stereo, fltp, 640 kb/s
Stream successfully created.
Using sample spec 'float32le 2ch 48000Hz', channel map 'front-left,front-right'.
Connected to device vsink2 (1, not suspended).
Stream started.
while my sink monitor is listed correctly with 6 channels pactl list sources
:
Source #2
State: SUSPENDED
Name: vsink2.monitor
Description: Monitor of vsink2
Driver: module-null-sink.c
Sample Specification: s16le 6ch 44100Hz
Channel Map: front-left,front-right,rear-left,rear-right,front-center,lfe
Owner Module: 20
Mute: no
Volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB, rear-left: 65536 / 100% / 0.00 dB, rear-right: 65536 / 100% / 0.00 dB, front-center: 65536 / 100% / 0.00 dB, lfe: 65536 / 100% / 0.00 dB
balance 0.00
Base Volume: 65536 / 100% / 0.00 dB
Monitor of Sink: vsink2
Latency: 0 usec, configured 0 usec
Flags: DECIBEL_VOLUME LATENCY
Properties:
device.description = "Monitor of vsink2"
device.class = "monitor"
device.icon_name = "audio-input-microphone"
Formats:
pcm
Pareceive detected audio as ac3 stereo. Probably it gets remapped to stereo on your source.
got it. i changed my source and pareceive detects 5.1 now, see the output attached!
also the recorded audio from ffmpeg is still in stereo only, i cannot get the other channels working here:
Playing IEC61937: Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s
Stream successfully created.
Using sample spec 'float32le 6ch 48000Hz', channel map 'front-left,front-right,front-center,lfe,side-left,side-right'.
Connected to device vsink2 (1, not suspended).
do you know why the surround channels are lost on the monitor recording?
May I ask you to record your raw input again, I will check it on my side.
sure! here is a record: https://www.file-upload.net/download-14520459/record.wav.html
I have used your file as an input for pareceive and captured the output using the following command:
parecord -d vsink2.monitor --channels=6 --no-remix --no-remap --channel-map="front-left,front-right,rear-left,rear-right,front-center,lfe" > capture.wav
and I got 5 channels out of 6 (excluding LFE):
thanks! i will have a look into this again. may i ask you which gui/tool did you use to visualise the channels?
It's Audacity
I've submitted a patch to FFMpeg for the dolby digital plus support:
http://ffmpeg.org/pipermail/ffmpeg-devel/2021-March/277874.html
So if you need it right now, you could build your own ffmpeg with that patch.
I am also closing the issue here because for what I can tell, pareceive
works as expected with #2.
thanks so much again for your support!