Hi Bill,

> On Feb 7, 2015, at 9:44 PM, Bill Brazeal <[email protected]> wrote:
> 
> I would like to be able to automatically search through a video file and find 
> the point at which the video changes from black and white to color.  This is 
> a video file obtained by a security camera that the video is black and white 
> when its dark outside and then it changes to color when there is enough 
> light.  I would like to automatically trim out the black and white frames 
> leaving only the color.  So I need to be able to find the point at which the 
> video changes from black and white to color (morning), then again from color 
> to black and white (evening).  Is there any way to do this with ffmpeg?
> 
> It has been suggested that I might be able to use the signalstats filter to 
> do this.  I am very much a novice at using ffmpeg so if someone could provide 
> a good example of how to do this, that would be very much appreciated.

Yes the signalstats filter reports on the average saturation level of each 
frame, so if you try:

ffprobe -f lavfi -i movie=SECURITYCAM.avi,signalstats -show_entries 
frame_tags=lavfi.signalstats.SATAVG -of flat

Your black and white footage should report like:
frames.frame.261.tags.lavfi_signalstats_SATAVG="0"

while color frames will have a value above zero. You'll then need to do some 
scripting to identify the transition points to use as in and out points in your 
edits.

I don't think it's feasible at this point but I wonder how feasible it would be 
to pull the metadata values into expressions in the select filter.
A dream:
ffmpeg -i mixed.avi -vf signalstats,select='gt(lavfi.signalstats.SATAVG\,0)' 
-c:v libx264 color_frames_only.mp4

Best Regards,
Dave Rice

> Thanks,
> 
> Bill
_______________________________________________
ffmpeg-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

Reply via email to