aboutsummaryrefslogtreecommitdiff
path: root/modules/user-constants.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-14 14:09:16 -0500
committerCraig Jennings <c@cjennings.net>2026-05-14 14:09:16 -0500
commit4a7529393ebbbc225939f21be783ec624d0a8168 (patch)
treeece00458140ecac7a590b826e7e7a1917fa844e9 /modules/user-constants.el
parentd914f1d0fc134356065416d1f489a577b8ffa1bd (diff)
downloaddotemacs-4a7529393ebbbc225939f21be783ec624d0a8168.tar.gz
dotemacs-4a7529393ebbbc225939f21be783ec624d0a8168.zip
feat(transcription): extend dired T to transcribe videos via ffmpeg, with tests
Pressing `T' in dired/dirvish on an audio file already transcribed it; on a video file it bounced with "Not an audio file". Real recordings ship as .mp4 / .mkv at least as often as raw .m4a, so the one-key flow ended at the wrong place. Pipeline now: - audio path -> direct into `cj/--start-transcription-process' (unchanged). - video path -> async ffmpeg extracts the audio track to a temp .mp3 under `temporary-file-directory' (libmp3lame, VBR q:a 4, ~165kbps -- right size for speech, accepted by every backend), then transcribes that file with the temp marked for cleanup after the transcription sentinel fires. Surface changes: - `cj/video-file-extensions' added to user-constants.el (mp4, mkv, mov, webm, avi, m4v, wmv, flv, mpg, mpeg, 3gp, ogv). - New predicates `cj/--video-file-p' / `cj/--media-file-p'. - New `cj/--extract-audio-from-video' (async ffmpeg with success callback; surfaces `cj/--notify' on failure; user-errors if ffmpeg isn't on PATH). - `cj/--start-transcription-process' gains optional `cleanup-file'. Sentinel deletes it after the existing logic runs. Backwards compatible -- the audio flow doesn't pass it. - `cj/transcribe-audio' renamed to `cj/transcribe-media' (dispatcher on audio vs video). `cj/transcribe-audio-at-point' renamed to `cj/transcribe-media-at-point'. Both old names kept as `defalias' so M-x history and any external references still work. - `T' in dired-mode-map + dirvish-mode-map points at `cj/transcribe-media-at-point'. - Module commentary USAGE block updated. 15 new ERT tests in `tests/test-transcription-video.el' cover the predicates (happy/boundary/error), ffmpeg invocation (correct args + missing-ffmpeg path), the dispatcher (audio direct, video via extraction, non-media rejected), the aliases, and the T binding. One existing test in `test-transcription-status-and-commands.el' updated to stub the new delegate name. Verified locally that ffmpeg is on PATH with libmp3lame, and that the exact arg list my code uses produces a valid MP3 from a synthetic test video.
Diffstat (limited to 'modules/user-constants.el')
-rw-r--r--modules/user-constants.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/user-constants.el b/modules/user-constants.el
index b1f6016b..21e141a5 100644
--- a/modules/user-constants.el
+++ b/modules/user-constants.el
@@ -56,6 +56,12 @@ Used by cursor color, modeline, and other UI elements.")
"File extensions recognized as audio files.
Used by transcription module and other audio-related functionality.")
+(defvar cj/video-file-extensions
+ '("mp4" "mkv" "mov" "webm" "avi" "m4v" "wmv" "flv" "mpg" "mpeg" "3gp" "ogv")
+ "File extensions recognized as video files.
+Used by transcription to dispatch the audio-extract step in front of
+the regular transcription pipeline.")
+
;; ------------------------ Directory And File Constants -----------------------
;; DIRECTORIES