Last week I made a miniCocoa application that captures frames from a live video stream and posts them to the web as a practice exercise for my thesis project, because I need to deal with ways of capturing pixels from OpenGLViews and other kinds of NSViews, and figure out how to broadcast or publish them to the network.

Video2Web is a good and very simple example that deals with the NSDocument, QTCaptureView and NSURLConnection Cocoa classes. The StillMotion example from Apple’s confusing QTKit Capture Programming Guide was very useful to deal with the capture of images from the video stream, although I haven’t found a way to integrate the code I needed into a Cocoa app that was not document based. Hence Video2Web is document based, even though there is no real need for it to be, other than I couldn’t make it work otherwise.

You can download Video2Web here and play with it if you want (no warrantee). Video2Web will post screenshots from your video to PictureXS every time you press the p key, tagging them with the date and time zone data from your computer, and it will save them to your desktop every time you press the s key. It is buggy and unstable, obviously because there is a difference between making things work and making them work right, but it makes me happy that it works, and it doesn’t hurt anybody that it crashes all the time =). I might make the source code available once I figure out how to write it better.

This are some captures from the first sessions when Video2Web still tagged every capture with live-video. I later decided to add some DateTime information to separate the captures by time and time zone.

Leave a Reply