On the 25th of November, my France Inter recording script broke. Not gracefully, not with a warning: every capture simply failed with ERROR: [dailymotion] x17qw0a: Requested format is not available. I record the France Inter live stream regularly (I listen to it at 3x speed in the evening, see my walkpad for what I do while listening), and this had worked for years.
What broke?🔗
Both Dailymotion and YouTube stopped offering a single combined live stream. They now publish video-only and audio-only HLS tracks, side by side. My old bash script asked yt-dlp for -f best, and best means "best single file with both video and audio". That format does not exist anymore, so yt-dlp refused to start.
The obvious fix was -f bv*+ba/b: best video plus best audio, and let yt-dlp merge them with ffmpeg. I patched the bash script, it worked, done. But alas, I kept noticing something else on the longer recordings.
The desync🔗
When yt-dlp downloads two separate HLS tracks, it runs two independent downloaders that write their own files, then ffmpeg muxes them at the end. On a live stream that lasts hours, the two downloaders drift. I got recordings where the audio slowly slid out of sync with the video, and once a one-hour capture where the video froze completely while the audio kept going. The bash script had no watchdog, so it happily recorded forty minutes of a still image.
I have been recording live streams since the youtube-dl days, and this fragility was always there, hidden because the combined stream was a single download. The split tracks made it visible.
What I decided to do is write it in Go🔗
So I wrote liverec, a small Go recorder for exactly these split-track live streams. The core idea is one ffmpeg process per segment, with both HLS inputs given to ffmpeg at the same time, so ffmpeg's own HLS demuxer keeps the tracks aligned by PTS. No independent downloaders, thus no drift.
./liverec -mode master -failover dmfi 2h /0/FranceInter/show.mp4 fiThe details that matter, all learned the hard way during four one-hour test runs (2 modes × 2 sites) on 2026-11-26:
- master mode (the default, and the reliable one): liverec fetches the master playlist, pins the chosen video variant and the best audio rendition to local files, and ffmpeg reads those. In my tests, feeding the two media-playlist URLs directly to ffmpeg (the
tracksmode) once froze the video on Dailymotion while audio continued; master mode had no failure in any run. - A stall watchdog on video frames only. Because it watches the video, a frozen picture with running audio triggers a segment restart. That is precisely the failure yt-dlp never noticed.
- Hourly rotation into crash-safe
.tssegments, then a faststart MP4 remux at the end if you asked for.mp4, so you lose at most the current segment on a crash. - ffprobe validation of each segment's A/V start offset (my runs: ≤ 50 ms), and an optional failover URL, so France Inter on Dailymotion can fall back to the YouTube stream.
- URL resolution still goes through yt-dlp, of course, that part it does well.
Why Go?🔗
The old script was bash, and bash is fine until you need a watchdog, a state machine for segment restarts, and playlist parsing. Then it is a thousand lines of quoting. The whole of liverec is under a thousand lines of Go, single static binary, standard library only, and it cross-compiles to my NAS in one command. See my go-single-binary-fanatic post, nothing new there.
Why not patch yt-dlp🔗
Yt-dlp refuses to accept any issue or patch that has been made with the help of AI, even only brainstorming with it. It is their right, so I just made this small dedicated program instead of submitting a bug report or even a patch to them.
Installation, Usage, and more info🔗
github.com/ColasNahaboo/liverec
AI co-written: don't like, don't use.