I want to remove night footage from a Timelapse video of construction over 300 days. So I want to remove 300 nights from this video. How do I do it in an easier way? Is there a option to cut video at predefined frame/points after regular intervals in one single command? I want to avoid manual labor. I am using adobe premier pro cc 2014
Using ffmpeg, a command line tool, you can use
ffmpeg -i in.mp4 -vf select='trunc(mod(t+2,3))',setpts=N/FRAME_RATE/TB -crf 23 out.mp4
select filter is used on the video stream. This filter evaluates the supplied expression on each frame and keeps the frame if the expression evaluates to a non-zero value.
The expression used is
trunc(mod(t+2,3)). The modulo function returns the remainder of the first operand when divided by the second. The first operand here is the timestamp of the evaluated frame. The truncate function truncates that result to an integer. If it is zero, the frame is discarded, else kept.
e.g. for a 25 fps video
t t+2 mod(t+2,3) trunc(mod(t+2,3)) select 0.00 2.00 2.00 2 KEEP 0.04 2.04 2.04 2 KEEP ... 0.96 2.96 2.96 2 KEEP 1.00 3.00 0.00 0 CUT 1.04 3.04 0.04 0 CUT ... 1.96 3.96 0.96 0 CUT 2.00 4.00 1.00 1 KEEP ... 3.00 5.00 2.00 2 KEEP ... 4.40 6.40 0.40 0 CUT ...
Since you want to 'collapse' the video by removing the night time portions, the
setpts filter is added to make all the kept frames continuous i.e. after the frame at 0.96, the next kept frame (2.00) will have the new timestamp of 1.00.
The video has to be recompressed since a filter has been used. For MP4s, default codec is H.264 and default encoder is libx264. The
-crf 23 sets the bitrate control method (CRF) and value (23). Lower values retain more of the source quality at the expense of larger size. 18 to 28 are typical values.
You can get a ffmpeg binary for your platform from https://ffmpeg.org/download.html. Always get the latest nightly or snapshot build.
FYI you have to add a backslash before the comma in the select function to make it work (at least on Linux), ie:
ffmpeg -i in.mp4 -vf select='trunc(mod(t+2\,3))',setpts=N/FRAME_RATE/TB -crf 23 out.mp4
Otherwise, you will get a "too many arguments" error.