You really wouldn't have to scan that large of a database. With videos, you could keep track of maybe the top three or so uploading sources (youtube, vimeo, metcafe...) and their embed codes.
As for images and links, those are pretty easy to detect and don't require any special embed code. By pretty easy, I mean very simple. Just use a simple regular expression to search for a link in their post.
If it's a picture, you can easily tell by looking at the file extension of the link (jpg, png, gif, etc.). If so, do whatever is proper to embed any old image. If it's just an ordinary old link (doesn't match any of your video sites, or doesn't end in a file extension for an image), just use the link itself.
The only marginally tricky part would be getting the unique embed codes for the video sites. But perhaps there is some external library/api that could do that small part for you (another answerer has provided has a proper API/pre-built library for this). However, images and links are mostly pretty simple.
EDIT It seems I misread your problem, and that you are only looking for pre-built libraries with video embed codes. In that case, the other answer is exactly what you want.