Stream a video file to a Samsung Smart TV
brew install aayush9029/tap/castOr tap first:
brew tap aayush9029/tap
brew install castcast ~/Movies/movie.mp4 # cast a local file
cast https://example.com/video # any yt-dlp-supported URL
cast window # mirror one window + its audio to the TV
cast discover # pick a TV (only needed when you have several)
cast stop # stop playbackWhile casting, use the TUI controls: space toggles play/pause, ←/→ seek 15 seconds, ↑/↓ adjust volume, s stops playback, and q quits.
The TV is auto-discovered via SSDP on first run. Subsequent casts go to the saved TV at ~/.config/cast/config.json; if that IP stops responding, cast rescans the local network and updates the saved target. URL casting needs yt-dlp and ffmpeg (brew install yt-dlp ffmpeg).
Samsung's DLNA renderer expects H.264/AAC in an MP4 container. An .mkv (or other non-MP4) file may be refused by the TV — cast rejects it up front with the exact ffmpeg -i in.mkv -c copy out.mp4 command to remux it (near-instant when the codecs already match).
cast window lists your open windows, mirrors the one you pick — video and its audio — to the TV. It uses a small Swift/ScreenCaptureKit helper (cast-capture) that captures the window's audio directly, so no virtual audio device (BlackHole etc.) is needed. Grant Screen Recording permission the first time (System Settings ▸ Privacy & Security ▸ Screen Recording).
cast window # pick a window, then it mirrors to the TV
CAST_FPS=24 cast windowThe helper ships with the Homebrew formula. From source, build it once:
cd capture && swift build -c release
export CAST_CAPTURE="$(swift build -c release --show-bin-path)/cast-capture"
# or copy that binary next to `cast` / onto your PATHCaveats: this streams live over DLNA, which is inherently TV-dependent and runs a few seconds behind — great for slides, video, and demos, not for twitch gaming. It captures a single window, not the whole desktop.
At a friend's place. TV in the room, but no way to actually use it. 2016 Samsung, so no AirPlay (Samsung only added it from 2018 onward), no Chromecast, and the browser on the TV itself couldn't play any of the streaming sites I wanted.
First tried spinning up a little local website to host the videos on and visit from the TV browser. That didn't work. So here this is.
MIT