I was wondering if there is a way to record video from a USB webcam to a .avi file (including sound). I know how to view video and capture screenshots, but I'd like to be able to record a section of video. If there really isn't then is there a way to take a series of images and audio and compile them into a video file? The reason for this project is to make AI accessible video logs. Let me know.

Recommended Answers

All 9 Replies

Just google 'web camera python' and you find for example one HOWTO:
http://technobabbler.com/?p=22

Just google 'web camera python' and you find for example one HOWTO:
http://technobabbler.com/?p=22

Right, like I said I know how to capture an individual frame from the webcam and save it, but what I'm trying to do is record video and audio from the webcam. Is there a way to do this?

I was wondering if there is a way to record video from a USB webcam to a .avi file (including sound). I know how to view video and capture screenshots, but I'd like to be able to record a section of video. If there really isn't then is there a way to take a series of images and audio and compile them into a video file? The reason for this project is to make AI accessible video logs. Let me know.

I would suggest to use Emgu CV or aForge NET to do this if you write in C# or openCV if you write in C++.
There's a lot of examples how to do this on their websites. also you can use my code from:
http://napiszpr.webd.pl/mb/content/view/74/84/

does python got a module for that?

I was wondering if there is a way to record video from a USB webcam to a .avi file (including sound). I know how to view video and capture screenshots, but I'd like to be able to record a section of video. If there really isn't then is there a way to take a series of images and audio and compile them into a video file? The reason for this project is to make AI accessible video logs. Let me know.

Yeah, you can record video from USB webcam and save the video to AVI format file with some program, which can help you capture video and audio file from webcam. The audio can be recorded from any source, including microphone, line-in, or speakers.
And the program can also help you record any actions on screen, so you can record images and audio into a video. I always make videos for youtube in this way. lol

I'm not sure about python itself doing it, but the way I would approach it would be to use an external program to do the actual video encoding. You could call it from python after you saved as many image files you wanted with your method of grabbing the images.

Using MEncoder Ubuntu:

sudo apt-get install mencoder
mencoder -ovc help

They have a windows version too I believe. You could use os.popen() or os.system() to run it via python.

Actually, there are many kinds of programs available on market can help you record webcam video. I like to use screen recorder, which can not only record video and audio streams from your webcam with high quality, but also can save the streams on your computer for latter playback. I often use it record msn webcam video when I was making video calls with my friends.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.