Quantcast
Viewing latest article 1
Browse Latest Browse All 2

Answer by Gyan for How to get screenshots of the middle of each scene using FFMPEG

The select filter evaluates the expression for truth or falsity as it processes each frame. You want frame n, a median frame between two scenes. When ffmpeg is processing frame n, it does not know when the scene will end.Your filter, as written, selects scene change frames as per the criteria.

Instead, you need to do one pass to generate a list of scene change timestamps and then use the select filter to extract the median frames.

For the first part, from here:

ffprobe -show_frames -of compact=p=0 -f lavfi "movie=$F,select=gt(scene\,.4)" | gsed -r 's/.*pkt_pts_time=([0-9.]{8,})\|.*/\1/'>> scenes-0.4

And then,

ffmpeg -vsync 0 -f concat -i list.text -vf select=concatdec_select img-%04d.png

where list.txt is

file 'video.mp4'inpoint 23.342outpoint 23.372file 'video.mp4'inpoint 57.031outpoint 57.064  ...

where each inpoint is the median value between two data points in the scene change list, and outpoint is greater than each inpoint by just under the duration for one frame. Some trial and error needed here.


Viewing latest article 1
Browse Latest Browse All 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>