mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-10-30 09:16:55 +00:00
* fix(cli): select containing source frames in snapshots * fix(cli): find the containing frame from packet timestamps, not a full decode Probing decoded frames and selecting by index decoded the source from its start, so a sample 290 s into a 1080p clip took about 35 s and hit the 30 s extraction bound. Packet timestamps need only a demux, and an accurate -ss to the midpoint before the containing frame decodes from the nearest keyframe. * fix(cli): end snapshot's ffprobe options with -- before the input * fix(cli): seek snapshot frames from their keyframe and skip unreadable videos Fragmented MP4 seeks by dts and MPEG-TS seeks imprecisely, so an input seek to the frame midpoint returned the next frame before each keyframe (fMP4) or a corrupt or missing frame (TS). Seek to the keyframe that starts the frame's decode instead and pick the frame by decoded time with a select filter. A failed or unparsable ffprobe now returns null, so one unreadable video is blanked with a warning instead of aborting the whole snapshot. * fix(cli): keep open-GOP leading frames and extract without ffprobe The keyframe walk went by decode order, so an open-GOP leading frame seeked to the keyframe that follows it, the decoder dropped it and the next frame was returned. Only keyframes at or before the frame in presentation order count. Without ffprobe, extraction falls back to a plain seek instead of failing the snapshot, as it worked before frame selection needed ffprobe. * fix(cli): measure snapshot frame times from the exact video start ffprobe prints format.start_time rounded to microseconds. When it rounds down, t=0 found no frame and every exact frame time picked the previous frame (24 fps fragmented MP4 with B-frames, many MPEG-TS files). Subtract the stream's integer start_pts in time-base ticks when the video sets the format start. * fix(cli): probe snapshot packets to an absolute end past edit-list preroll A stream-copy trim keeps preroll packets before the first visible frame. The packet probe read a window relative to the first packet, so it stopped before the requested time and picked an earlier frame. Probe the stream start first, then up to start + time + 1 s. * fix(cli): keep snapshot ffprobe argv a literal ending in -- before the input The producer ffprobe argv contract reads each argv literal and requires -- right before the input; the probe helper spliced flags in from its callers, so the contract saw argv without it. * fix(cli): select snapshot frames on the video stream clock when audio leads When the video starts after the container (TS with audio, late video), FFmpeg puts zero at the first video frame after a seek to 0, so the threshold picked the next frame, and times before the first frame gave none. Select on raw stream time (-copyts) and hold the first frame. * fix(cli): measure snapshot frame selection from the first decoded frame -copyts kept raw time in the filter but changed which frames survive the seek trim, so a file whose timestamps start below zero froze on a late frame. Seek to the keyframe display time and select relative to start_t; the no-ffprobe path keeps the plain seek. * fix(cli): anchor snapshot frame selection on the keyframe a seek lands on MPEG-TS seeks can land a whole keyframe group late, and an open-GOP keyframe is not a clean start, so a predicted start_t picked later frames. Read the landing keyframe with a stream copy, seek exactly to it so its leading frames are trimmed, and select relative to it. --------- Co-authored-by: Miguel Angel Simon Sierra <miguel.sierra@heygen.com>