Skip to content

fix(voice): name voice recordings .m4a to match the MPEG-4/AAC content - #7041

Open
yuri-zeta wants to merge 1 commit into
nextcloud:masterfrom
yuri-zeta:fix/voice-message-m4a-extension
Open

yuri-zeta wants to merge 1 commit into
nextcloud:masterfrom
yuri-zeta:fix/voice-message-m4a-extension

Conversation

@yuri-zeta

Copy link
Copy Markdown

Fixes #7040

Voice messages are recorded with MediaRecorder.OutputFormat.MPEG_4 and AudioEncoder.AAC, but were saved with an .mp3 suffix, so the server stored audio/mpeg for MP4 data. Some clients (iOS) trust the extension and fail to play them. This changes the suffix to .m4a (server mimetype audio/mp4); recording parameters are unchanged. Tests that used .mp3 for the recording path are updated. Old .mp3 files already uploaded are unaffected.

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed (existing test paths updated)
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed
  • 📅 Milestone is set
  • 🌸 PR title is meaningful

Not built or tested locally (change is a suffix constant plus test strings).

Signed-off-by: yuri-zeta <153580955+yuri-zeta@users.noreply.github.com>
@mahibi

mahibi commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Nice catch @yuri-zeta
Will give it a test soon to really make sure it works on all platform

@mahibi
mahibi self-requested a review November 13, 2026 10:23
@mahibi

mahibi commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the PR!

As far as i see you're right that the recordings are MPEG-4/AAC and that .mp3 is the wrong extension for them.

The Android app sets

setOutputFormat(MediaRecorder.OutputFormat.MPEG_4)   // container: MP4 (ISO base media file format)
setAudioEncoder(MediaRecorder.AudioEncoder.AAC)       // codec: AAC-LC

so the right file extension would be .m4a

But unfortunately we can't merge this as it is. After this change, voice messages show up as plain audio files instead of voice messages.

The Talk server only keeps the voice-message type if the uploaded file's type is audio/mpeg or audio/wav. Otherwise it silently drops the type:

if ($mime !== 'audio/mpeg' && $mime !== 'audio/wav') {
    unset($metaData['messageType']);
}

The server determines the file's type from its extension. A .m4a file becomes audio/mp4, so the server drops the voice-message type, and every client shows the recording as a regular audio file. The .mp3 name is wrong, but it's what currently gets the file through this check.

Also the iOS sends "mp3" as extension name.

audioFileName += ".mp3"

Switching to .m4a would need two steps:

  1. Change spreed to also accept audio/mp4 (and probably audio/x-m4a) as voice messages.
  2. Add a capability for it, so the Android app only uses .m4a on servers that support it and keeps .mp3 for older ones.

So this is more complicated than just renaming the file extension on clients.

I was not able to reproduce the issue that mp3's could not be played on Talk iOS 25.0.2. Could you also provide which Android device / Android version / Android Talk version you used for recording?

I will discuss with my team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Voice messages are named .mp3 but contain AAC in an MP4 container (iOS cannot play them)

2 participants