fix: detect WebM audio format in duration check for web display recording#71
Open
tjaffri wants to merge 1 commit intoPiSugar:masterfrom
Open
fix: detect WebM audio format in duration check for web display recording#71tjaffri wants to merge 1 commit intoPiSugar:masterfrom
tjaffri wants to merge 1 commit intoPiSugar:masterfrom
Conversation
…ding When using the web display with WEB_AUDIO_ENABLED=true, browsers record audio in WebM format. However, these files are saved with .mp3 extension, causing the duration check to fail (mp3Duration can't parse WebM). This resulted in all voice recordings being rejected as "too short". This change: - Detects WebM files by checking the magic number (0x1a45dfa3) - Uses ffprobe as fallback for WebM and unknown formats - Adds graceful fallback for files with content but unparseable duration Requires ffmpeg to be installed for WebM duration detection, which is already documented as a requirement for web audio in .env.template. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ffprobeas fallback for WebM and unknown audio formatsProblem
When using the web display with
WEB_AUDIO_ENABLED=true, browsers record audio in WebM format. However, these files are saved with.mp3extension, causing the duration check to fail sincemp3Durationcannot parse WebM files.This results in all voice recordings being rejected as "too short":
Solution
The fix detects WebM format by checking the file's magic number and uses
ffprobe(from ffmpeg) to get the actual duration. This is consistent with the existing documentation in.env.templatewhich already mentions ffmpeg as a requirement for web audio:Test plan
🤖 Generated with Claude Code