Fix concat-demuxer seek failure on multi-segment sources - #424
Closed
RufanMelfor wants to merge 1 commit into
Closed
Fix concat-demuxer seek failure on multi-segment sources#424RufanMelfor wants to merge 1 commit into
RufanMelfor wants to merge 1 commit into
Conversation
|
All contributors have signed the CLA. Thank you! |
Scrubbing/seeking to any timestamp (e.g. entering a frame number) in a chained multi-segment recording (DJI's auto-split 4GB files) failed with "FFmpeg: Invalid seek" for both cameras. Root cause confirmed directly against libavformat (not just inferred): without a `duration` hint per `file` entry, FFmpeg's concat demuxer can't build a seekable index across segments and reports the whole chain as non-seekable - `avformat_seek_file` returns AVERROR(ESPIPE) for *any* target, even one within the first segment. Single-file sources were unaffected, which is why this only showed up once a user picked multiple segments per side. Fix: probe each segment's duration (format-only open, no decoder/hw setup) when building the concat manifest and emit a `duration <secs>` line next to each `file` entry. One-time cost at chain-open time, not per-seek or per-frame. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
RufanMelfor
force-pushed
the
fix/concat-multisegment-seek
branch
from
July 16, 2026 10:35
2317022 to
3382944
Compare
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
Contributor
|
Hi, I will close this PR as it is a duplicate of a fix that landed in #329. Your fix was similar to what I merged. Thanks again. I already merged some of your other PRs, and will look into and hopefully merge the others too :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scrubbing/seeking to any timestamp in a chained multi-segment recording
(e.g. a camera's auto-split 4GB files) failed with "Invalid seek" for both
cameras. Root-caused directly against libavformat: without a
durationhint per
fileentry, FFmpeg's concat demuxer can't build a seekableindex across segments and reports the whole chain as non-seekable —
avformat_seek_filereturnsAVERROR(ESPIPE)for any target, even oneinside the first segment. Single-file sources were unaffected, which is
why this only surfaces once a user selects multiple segments per side.
Fix: probe each segment's duration (format-only open, no decoder/hw setup)
when building the concat manifest, and emit a
duration <secs>line nextto each
fileentry. One-time cost at chain-open time, not per-seek orper-frame.
Verified:
fmt --check/build/cargo test -p reco-ioclean againstcurrent
origin/main.