2

I'm successfully using the -vf select='gte(scene,0.4)',metadata=print:file=shotcuts.txt command to get FFMPEG to detect scene changes and output the results to file. Is it possible to force the pts field to be in frames rather than the default, which seems to vary depending on the video format (e.g. frames for AVI files, nanosecs for MOV/MP4)?

Processing an AVI file, for example, outputs time stamps in frames:

frame 0 pts 151
frame 1 pts 206

Whereas an MP4 file outputs as media time:

frame 0 pts 540000
frame 1 pts 738000

2
  • Not sure why someone has marked this down. Would they care to explain? May 28, 2019 at 23:13
  • Probably because SO is supposed to be for programming questions only.
    – llogan
    May 29, 2019 at 18:34

1 Answer 1

1

PTS stands for Presentation Timestamps and so cannot be in frames. However, PTS are denominated in terms of a timebase, and so if the timebase is set to 1/fps, then the PTS and frame index will coincide. This will work well only for streams which are constant frame rate and have an integer framerate.

Set the timebase by using the settb filter before select. For a 30 fps CFR stream,

-vf settb=1/30,select='gte(scene,0.4)',metadata=print:file=shotcuts.txt
1
  • Thanks, Gyan. That's exactly what I needed to know. May 29, 2019 at 7:54

Your Answer

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

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