are there any good libraries out there for creating videos programmatically?

What do you mean with creating videos? Which kind of videos?

Let's say I have some photos and I want to put them together into a video and put music over it. Just an example.

Well you can create videos with ffmpeg, however I don't know any lib in which you can do this programmatically.