Skip to content

feat(ffmpeg): add wav-3cx telephony preset and URL-param format pre-selection - #568

Open
gingeekrishna wants to merge 5 commits into
C4illin:mainfrom
gingeekrishna:feat/wav-3cx-preset-and-url-params
Open

feat(ffmpeg): add wav-3cx telephony preset and URL-param format pre-selection#568
gingeekrishna wants to merge 5 commits into
C4illin:mainfrom
gingeekrishna:feat/wav-3cx-preset-and-url-params

Conversation

@gingeekrishna

@gingeekrishna gingeekrishna commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Closes #559.

Changes

1. WAV preset for 3CX telephony (wav-3cx)

Adds a wav-3cx output target to the FFmpeg converter that produces a WAV file with the exact parameters required by 3CX and similar telephony systems — no post-processing needed:

Parameter Value
Channels Mono (-ac 1)
Sample rate 8 kHz (-ar 8000)
Bit depth 16-bit PCM (-sample_fmt s16)

The option appears in the UI under the ffmpeg group alongside the regular wav target. normalizeOutputFiletype maps wav-3cx → wav so the downloaded file has the standard .wav extension that telephony systems expect.

Before: upload → convert to wav → open in 3CX converter → set mono/8kHz/16-bit → done
After: upload → convert to wav-3cx → done

2. URL query-param format pre-selection

Adds support for ?to=<format>&converter=<name> query parameters on the root page. When a user arrives with these set, the format selector is automatically pre-populated as soon as conversion options finish loading (after the first file is selected).

http://localhost:3000/?to=wav-3cx&converter=ffmpeg

This lets teams share a direct link for their most-used conversion, bookmarked or embedded in a workflow.

The converter param is optional — omitting it picks the first converter that offers the target format:

http://localhost:3000/?to=wav-3cx

Implementation notes

  • Follows the existing compound-format-ID pattern (av1.mkv, h264.mp4, glb2 → glb, etc.) — no new abstractions needed.
  • The auto-selection runs entirely in script.js after the dynamic /conversions fetch resolves; no backend changes required.
  • If ?to refers to a format not available for the uploaded file type, the param is silently ignored (the target button simply won't exist in the DOM).

Summary by cubic

Adds a wav-3cx preset and URL-parameter preselection for one-click 3CX/telephony conversions, reducing clicks and enforcing correct WAV settings by default. Previously users converted to wav and set mono/8 kHz/16‑bit manually; now wav-3cx enforces these, and links can prefill the target format.

  • wav-3cx output: mono, 8 kHz, 16‑bit PCM (forces -c:a pcm_s16le). Appears under ffmpeg. normalizeOutputFiletype maps wav-3cx to wav so downloads use .wav.
  • URL preselection: ?to=<format>&converter=<name> auto-fills the target after options load; unavailable pairs are ignored. Uses dataset matching to avoid selector-related errors from special characters in params.

Written for commit 56cb6e4. Summary will update on new commits.

Review in cubic

…election

WAV preset for 3CX / telephony systems
---------------------------------------
Adds `wav-3cx` as a new FFmpeg output target that produces a WAV file
with the parameters required by 3CX and similar telephony platforms:
  - Channel: mono   (-ac 1)
  - Sample rate: 8 kHz  (-ar 8000)
  - Bit depth: 16-bit PCM  (-sample_fmt s16)

The target appears in the UI alongside the regular `wav` option under the
ffmpeg converter group.  `normalizeOutputFiletype` maps `wav-3cx` → `wav`
so the downloaded file has the correct `.wav` extension.

URL query-param pre-selection
------------------------------
Adds support for `?to=<format>&converter=<name>` query parameters on the
root page.  When a user lands on the page with these params set, the
format selector is automatically pre-populated as soon as conversion
options finish loading (after the first file is selected).

Example:
  http://localhost:3000/?to=wav-3cx&converter=ffmpeg

Closes C4illin#559

Signed-off-by: Radhakrishnan Pachyappan <gingeekrishna@gmail.com>
Copilot AI review requested due to automatic review settings June 21, 2026 18:41
@github-actions github-actions Bot added Feature and removed Feature labels Jun 21, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 3 files

Re-trigger cubic

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a dedicated FFmpeg output preset for 3CX-compatible WAV exports and introduces URL query parameters that pre-select the target format (and optionally the converter) on the main page to streamline repeated conversions.

Changes:

  • Add wav-3cx as an FFmpeg output target and normalize its download extension to .wav.
  • Apply a 3CX telephony audio preset (mono, 8 kHz, 16-bit) during FFmpeg conversion when wav-3cx is selected.
  • Support ?to=<format>&converter=<name> URL params to auto-select the desired target format after conversion options load.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/helpers/normalizeFiletype.ts Maps wav-3cx to .wav so downloads use a standard WAV extension.
src/converters/ffmpeg.ts Registers wav-3cx and applies extra FFmpeg audio arguments for the telephony preset.
public/script.js Parses to / converter query params and auto-selects the matching conversion target in the UI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread public/script.js
Comment thread src/converters/ffmpeg.ts
- script.js: replace unsafe CSS selector interpolation from URL params
  with dataset comparison via Array.from().find() to avoid DOMException
  on values containing quotes, brackets or other special characters
- ffmpeg.ts: add explicit -c:a pcm_s16le to wav-3cx preset so the PCM
  codec is always set regardless of FFMPEG_OUTPUT_ARGS

Signed-off-by: Radhakrishnan Pachyappan <gingeekrishna@gmail.com>
@github-actions github-actions Bot added Feature and removed Feature labels Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 participants