Open loganYdid opened 8 months ago
I just got this doorbell last week and noticed the same issue. Based on my research, it looks like a new firmware changed the audio settings. I don't think the curl commands to adjust the audio settings actually do anything. So here's what works instead:
First convert the audio to PCM, 16000Hz, s16le:
ffmpeg -i <input_file> -ac 1 -ar 16000 <output.wav>
You want the output to be in WAV. I've also only tested this with an input file of WAV, but I assume it works for mp3 and other files, too.
Run ffprobe <output.wav>
to verify that the audio stream is correct. I've run into some headaches with ffmpeg keeping the audio at the old sample rate instead of the new, correct rate. The last line of the output should look something like this:
Stream #0:0: Audio: pcm_s16le ([1][0][0][0]/ 0x0001), 16000 Hz, 1 channels, s16, 256 kb/s
The important parts are that the audio is pcm_s16le and the frequency is 16000 Hz. From what I understand, these are always the settings the new firmware uses.
Next, use this as your bash script to upload the audio. For some reason, standard basic authentication would never work. Seems you already figured that part out, though, This also will set the time limit for the curl command so you don't need to monitor the process itself.
#!/bin/bash
fname="upload/<output.wav>"
echo "Uploading ${fname}"
curl -vvv \
-g \
-F "file=@"${fname}";type=Audio/PCM" \
-H "content-type: Audio/PCM" \
--max-time 6 \
-u admin:password \
--digest \
"http://DOORBELL_IP/cgi-bin/audio.cgi?action=postAudio&httptype=singlepart&channel=1"
Run the script and check your camera.
If it's still too fast, you can try sending this curl command:
http://DOORBELL_IP/cgi-bin/configManager.cgi?action=setConfig&Encode[0].MainFormat[0].Audio.Frequency=16000
I have been following along with your tutorial and I am having trouble getting the audio to play properly through the doorbell.
My Bash File
FFMPEG Command:
ffmpeg -y -i "config/CantinaBand3.wav" -c:a pcm_alaw -ar 8000 -sample_fmt s16 config/new_audio_test.al
The audio ends up sounding sped up. Like a chipmunk. However, if I use the following command it sounds better but it still distorted.
ffmpeg -y -i "config/CantinaBand3.wav" -c:a pcm_alaw -ar 35000 -sample_fmt s16 config/new_audio_test.al
Do you have any ideas of what the issue could be here?