You question missed many details. Do you write cross-platform program? Or should it work on Windows or *nix only? Also do you have unlimited budget for possible libraries? Or are you looking for open source libraries? So...
From common sense you could use FFMPEG library which is crossplatform. If you can use Windows platform than you could use Avisynth, it provides really powerful scripting mechanism that allows you to combine multiple videos into one and you could add your own filters that add watermark or other kind of effects