0

As from FFmpeg version 2.1, -ss used as an input option should be frame accurate (when transcoding, not stream-copying).

I tried it with different versions of FFmpeg, up to recent ones, and with MPEG-TS files doesn't look accurate to me. I still get the cut (or the frame extraction) at the first I-frame after the specified timestamp.

Is it an exception for MPEG-TS files, or am I missing something?

2 Answers 2

1

MPEG-TS don't have a global keyframe index ,so even input -ss will seek to the next KF after the ss timestamp.

Add -copyts -start_at_zero and seek to a few seconds earlier. Then add a trim filter with the exact timestamp.

0

tnx gyan, more or less understood. I'll have to try.

problem started with recent versions of ffmpeg (5.1 & above); up to version 4.3 to extract a frame at exact timestamp, without waiting log time for output -ss seeking, I finally found that combining input -ss (up to at least before the previous keyframe) and adding output -ss up to the desired timestamp was correct IF TS file had only video track, otherwise was shifted by the difference between video_track start_time and earliest starting audio-track; calculating that difference with ffprobe and adding to output -ss gave the correct frame. with recent versions behaviour is different: if video-only TS file, than it's easy (no shift, and sum of the two -ss), but with audio-video files looks like it's initially reaching the first KF after input -ss, than if output -ss is less than input -ss returns that KF, otherwise if larger it returns the frame at output -ss timestamp (from beginning of file). so old procedure cannot be applied anymore. I will deep study what you suggested.

thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.