[FFmpeg-user] Find Change from Black and White to Color Frames
Bill Brazeal
bill at billbrazeal.com
Sun Feb 8 19:16:22 CET 2015
Dave, thanks for the response. So will the result of the ffprobe command give a file of the results? If so, I then need to read through the file to get the frame points at which the black and white changes to color and then the color changes back to black and white. Is that what I need to do in this case?
Thanks,
Bill
<http://billbrazeal.com/> <mailto:bill at billbrazeal.com>
<mailto:bill at billbrazeal.com> <https://twitter.com/#!/billbrazeal> <https://www.facebook.com/billbrazeal.public> <http://www.linkedin.com/pub/bill-brazeal/35/688/baa> <skype:bbrazeal?call> <http://www.youtube.com/user/bbrazeal1> <http://feeds.feedburner.com/billbrazeal/LatestBlogs> <mailto:bill at billbrazeal.com>
> On Feb 8, 2015, at 6:25 AM, Dave Rice <dave at dericed.com> wrote:
>
> Hi Bill,
>
>> On Feb 7, 2015, at 9:44 PM, Bill Brazeal <bill at billbrazeal.com> 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
> ffmpeg-user at ffmpeg.org <mailto:ffmpeg-user at ffmpeg.org>
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user <http://ffmpeg.org/mailman/listinfo/ffmpeg-user>
More information about the ffmpeg-user
mailing list