5

I want to split one video up into multiple parts based on detecting the first frame of each shot, by select scene in ffmpeg.

The following entry records the scene frames and creates a photo mosaic out of them. This indicates to me that the select portion is functional, but I want to use this to create many separate videos, each scene it's own video file.

ffmpeg -i video.mpg -vf select='gt(scene\,0.2331)','scale=320x240,tile=1x100' -frames:v preview.png

Thank you. I think I am close, and I am open to any solution.

spitfire109
  • 9,651
  • 3
  • 20
  • 28
  • Want 50 extra points? I have a +50 bounty question about this here: http://superuser.com/questions/692489/automatically-split-large-mov-video-files-into-smaller-files-at-black-frames-s – Ryan Feb 15 '14 at 20:13

1 Answers1

2

You should definitely use -ss(stream start time) and -t(number of second of video from the the start time) options, Can you get the time for each of these scene frames? Then you are good to go.

d33pika
  • 1,997
  • 14
  • 24
  • Yeah, that's what I am trying, but I am still not familiar enough with ffmpeg to figure it all out. I feel like I just want to assign the variable of time to the moment where the scene selection happens, but I have not figured out how to do that yet. – spitfire109 Dec 20 '12 at 18:33
  • Use excel, openoffice, or something similar. Take each start time and find the difference from one scenecut to the next to get durations for each clip. =a2-a1 Then use the "start" and "duration" values like: ffmpeg -ss %start% -i video.mpg -t %duration% output.mpg – Dominic Mason Jan 02 '21 at 19:12
  • -ss might be less accurate if you put it in the front of the video "-i video.mpg," but the ffmpeg doc says it shouldn't be: "Note that in most formats it is not possible to seek exactly, so ffmpeg will seek to the closest seek point before position. When transcoding and -accurate_seek is enabled (the default), this extra segment between the seek point and position will be decoded and discarded." So putting -ss in front should give the right frames. – Dominic Mason Jan 02 '21 at 19:14