Issue Description:
Users implementing Agora Cloud Recording may find that the recorded output file (e.g., MP4) contains video but no audio, even though audio appears to be configured and published correctly within the client application.
Platform/SDK:
Agora Cloud Recording RESTful API with Agora Web SDK (agora-rtc-sdk-ng) running in a browser environment.
Error Message (optional):
No explicit error message is returned. The recording completes successfully but the resulting file lacks an audio track.
Step by Step Solution:
1. Check the Recording File Configuration:
Ensure that the recordingFileConfig parameter only specifies the file types that combine both audio and video tracks properly.
For MP4 output with embedded audio, use:
{
"recordingFileConfig": {
"avFileType": ["mp4"]
}
}
Remove "hls" from the list because HLS outputs audio into a separate .aac file. When both "hls" and "mp4" are listed, the MP4 file may contain video only (no audio track).
2. Verify Audio Subscription Settings:
Make sure audio is explicitly subscribed in your recording configuration:
{
"subscribeAudioUids": ["#allstream#"],
"subscribeVideoUids": ["#allstream#"]
}
This ensures all participants’ audio streams are captured.
3. Confirm Audio Publishing Order:
Continue publishing the audio track before the video track. This registration order ensures the Agora media server associates the audio stream properly for mixing in the recording.
4. Use a Reliable Audio Profile:
Update the audioProfile setting to use stereo for more stable results:
{
"audioProfile": 2 // 48kHz, stereo, 48kbps
}
5. Disable Browser-Side Audio Enhancements (Web SDK):
When creating microphone tracks, ensure noise suppression and echo cancellation settings don’t interfere with the audio signal:
const audioTrack = await AgoraRTC.createMicrophoneAudioTrack({
encoderConfig: { sampleRate: 48000, stereo: true, bitrate: 128 },
AEC: false,
AGC: false,
ANS: false,
});
6. Validate Token and Channel Configuration:
Ensure that the token and channel name used to start the Cloud Recording match exactly those used by the Web SDK client joining the channel. Any mismatch may result in unlinked or unrecorded audio streams.
7. Test with a Single Participant:
For debugging, test with a single user publishing both audio and video. This helps isolate configuration issues before scaling to multiple users.
Root Cause:
The issue occurs because the avFileType configuration included both "hls" and "mp4". When both are enabled, Agora’s recording service prioritizes the HLS format, placing audio in a separate .aac track, resulting in MP4 files containing only video.
Prevention/Best Practice:
- Avoid mixing different recording output types unless requiring multiple delivery formats.
- Always verify that
avFileTypesettings match the desired combined output type (["mp4"]for unified audio-video recording). - Test recordings periodically after SDK updates or configuration changes to ensure compatibility and consistency.
Corresponding Document/Link (optional):