ffmpeg's select-filter generates unwanted black frames

Try placing the setpts filter after the select filter.

setpts='PTS-STARTPTS' resets the presentation time stamp of each frame (so the first frame is 0.0 seconds, and they increment correctly) - the select filter will send the selected frames to the rest of ffmpeg, but it will not, by itself, alter the presentation time stamp, which can cause all sorts of problems - as you found out.