I'm using this command to create screenshots from a video, each time there is a frame change.

ffmpeg -i "$video_file" -filter_complex "select=bitor(gt(scene\,0.5)\,eq(n\,0))" -vsync drop "$frames_dir/%04d.jpg"

It seems to work pretty well, but there are a few black images in the screenshots that I'd like to remove.

I'm not well versed in advanced ffmpeg commands and I think the command above can be adapted to throw away the black frames. Does anybody know how?

1 Answer 1


Use the blackframe and metadata filters after select.

ffmpeg -i "$video_file" -filter:v "select=bitor(gt(scene\,0.5)\,eq(n\,0)),blackframe=amount=1,metadata=mode=select:key=lavfi.blackframe.pblack:value=95:function=less" -vsync drop "$frames_dir/%04d.jpg"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.