Skip to content

Preview: sound for video - #122

Closed
crustovsky wants to merge 2 commits into
audio-previewfrom
video-sound
Closed

crustovsky wants to merge 2 commits into
audio-previewfrom
video-sound

Conversation

@crustovsky

Copy link
Copy Markdown
Owner

Fixes #121. Stacked on #119.

  • While a previewed video plays, its sound plays through core::AudioPlayer (ffplay in a second child), started at the picture's position and stopped with it; a seek restarts it there.
  • Sync is as good as two process starts allow: the sound starts 0.15 s ahead to cover the player's start-up.
  • PreviewMute, default Ctrl+M, plus a button on the transport strip for videos that have sound. Remembered in the state file, on by default. Audio files are not affected.
  • A video with no audio stream plays as before.
  • Smoke and screenshot scripts play to SDL's dummy driver.

Tests: test_window videoHasSound with stand-in ffprobe, ffmpeg and ffplay; smoke session video with a tone. ctest passes, also under ASan/UBSan.

🤖 Generated with Claude Code

crustovsky and others added 2 commits November 30, 2026 21:29
A previewed video played without sound. That was a non-goal while
nothing in the app made a sound; since audio files play on Ctrl+P
(#115) a silent video was the odd one out. The reasons behind the
non-goal are kept: nothing is decoded in the process (rule 8) and
nothing starts unasked.

While a video plays, its sound plays through core::AudioPlayer, ffplay
in a second child beside the ffmpeg that decodes the frames, started at
the picture's position. Pause, the end, a hidden slot, a cursor move or
closing the preview stop it with the picture; a seek while playing
starts it again from there. The two children are only as much in step
as their starts, so the sound is started 0.15 s ahead to make up for
the player opening the file and the device: a preview's sync, not a
player's lip sync. A file with no audio stream (the same ffprobe call
an audio file gets) plays as before and nothing is said; a player that
fails is one line under the details and the picture goes on.

PreviewMute (Ctrl+M, the View menu, a button at the end of the
transport strip shown when the video has sound) switches the sound of
videos off or on. It is kept in the state file ([preview] videoSound)
and is on by default, since playing is always asked for by a key. Audio
files are not muted by it. Like Ctrl+P and Ctrl+0 it is a chord with no
function key beside it: the Ctrl layer is full.

The non-goals line is now "autoplay of video or sound". The smoke and
screenshot scripts set SDL_AUDIODRIVER=dummy so a scripted session
plays to nobody, and their clips carry a tone so the path is exercised.

Fixes #121

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@crustovsky

Copy link
Copy Markdown
Owner Author

Merged into main through #123.

@crustovsky crustovsky closed this Nov 30, 2026
@crustovsky
crustovsky deleted the video-sound branch November 30, 2026 21:00
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.

1 participant