Skip to content

frontend: default to MP4 output with automatic format detection - #181

Open
nschimme wants to merge 1 commit into
knik0:masterfrom
nschimme:frontend-mp4-default
Open

frontend: default to MP4 output with automatic format detection#181
nschimme wants to merge 1 commit into
knik0:masterfrom
nschimme:frontend-mp4-default

Conversation

@nschimme

@nschimme nschimme commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Makes MP4 the default output format with extension-based auto-detection (.m4a/.mp4 -> MP4, .aac -> ADTS), adds explicit -a for ADTS, and adds overwrite protection.

Why

  • Ubiquitous OS & Browser Support: Most users expect .m4a files. MP4 containers provide native seeking, duration indexing, rich metadata (tags/art), and seamless HTML5/OS playback, whereas raw .aac ADTS streams often break seeking or fail to play in modern software.
  • Gapless Playback: Unlike raw ADTS (.aac), the MP4 container stores encoder delay/padding metadata required for sample-exact gapless playback.
  • Modern Expectations: Output format "just works" based on file extension (matching ffmpeg behavior) without requiring legacy flags like -w.
  • Data Safety: Prevents silent file overwrites in the engine and adds a confirmation prompt to the Win32 GUI.

Key Changes

  • Auto-Detection & Defaults: Default output to MP4. Auto-detect container from extension; fallback stdout (-) to ADTS.
  • CLI Adjustments: Replaced legacy -w with -a/--adts to force ADTS stream output when needed.
  • Safety: Added overwrite check to encode_engine.c and confirmation dialog to maingui.c.
  • Docs: Updated faac.1 man page and faac.html.
image

Comment thread docs/faac.1
Overwrite existing output file
.SH MP4 SPECIFIC OPTIONS
.TP
.BR -w

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe keep this option as a noop dummy for people having this hard code in their scripts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about adding a dummy flag, but I'm worried about silent failures for users not passing -w and suddenly being surprised by .m4a over an .aac extension. Fail-fast behavior with a breaking change feels safer here so users know they need to update their scripts. What do you think?

Comment thread docs/faac.html
Update the frontend and GUI to default to MP4 container output while
enabling automatic output format detection based on file extension.

* CLI Options: Replace '-w' (create MP4) with '-a' to explicitly request
  ADTS stream output.
* Format Detection: Implement detect_container_mp4() to infer MP4 or ADTS
  output based on filename extensions (.aac/.adts vs .m4a/.mp4/.m4b).
  Default stdout ("-") and unknown extensions appropriately.
* Overwrite Protection: Add checks in the encoding session and GUI dialog
  to prevent accidentally overwriting existing output files unless
  explicitly configured.
* Documentation: Update man page (faac.1) and HTML documentation (faac.html)
  to reflect updated CLI flags and automatic format selection.
@nschimme
nschimme force-pushed the frontend-mp4-default branch from 17c1da7 to edb0a84 Compare August 30, 2026 12:08
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.

2 participants