Skip to content

Take key frames from a transport stream by reading it in order - #205

Merged
abrignoni merged 2 commits into
mainfrom
fix/ts-keyframes
Sep 26, 2026
Merged

abrignoni merged 2 commits into
mainfrom
fix/ts-keyframes

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

Fixes key frames and thumbnails for MPEG transport stream video (.ts, and every HLS segment).

  • The key-frame sampler seeks to evenly spaced frame numbers, which OpenCV cannot do in a transport stream, so every .ts file got no frames and the error "no video frames could be read".
  • When the seeks give nothing, it now reads the stream once in order and keeps the frames it asked for. A seekable file still takes one pass.
  • New fixture tests/fixtures/h264-segment.ts is ffmpeg's test pattern (command in the test), marked binary in .gitattributes. The new tests fail on main.

Joined HLS segments from #204 need this to show a thumbnail.

🤖 Generated with Claude Code

abrignoni and others added 2 commits September 26, 2026 15:42
The key-frame sampler seeks to evenly spaced frame numbers, which OpenCV
cannot do in an MPEG transport stream (.ts, and every HLS segment), so
every .ts file came back with no thumbnail and "no video frames could be
read". When the seeks give nothing, the sampler now reads the stream
once, in order, and keeps the frames it asked for; a seekable file still
takes one pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@abrignoni
abrignoni enabled auto-merge September 26, 2026 19:47
@abrignoni
abrignoni merged commit 159b84e into main Sep 26, 2026
8 checks passed
@abrignoni
abrignoni deleted the fix/ts-keyframes branch September 26, 2026 20:40
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