6

We need to capture live video and display easily on Linux. We need a cheap card or USB device with a simple API. Anyone want to share some experience?

splattne
  • 102,760
  • 52
  • 202
  • 249
epatel
  • 45,805
  • 17
  • 110
  • 144
  • 1
    Closed, not related to programming? I am asking for an API advice! How is that not related to programming? – epatel Jul 12 '11 at 15:07

8 Answers8

5

Use the video4linux library. I've used it with a c++ program and was able to capture webcam frames within about an hour. (Very easy to use and setup)

Brian R. Bondy
  • 339,232
  • 124
  • 596
  • 636
4

If you need to program, you're best off using GStreamer, a multimedia framework under Linux.

Cheese, mentioned by jackbravo, is based on GStreamer, as is Flumotion, a streaming server I work on.

Thomas Vander Stichele
  • 36,043
  • 14
  • 56
  • 60
3

As mentioned, Use dvgrab to capture from a Firewire interface from the camera, then use tools such as ffmpeg (command line) or kino (simple gui video editor) to process the video as needed. PCI based Firewire cards are relatively inexpensive and easy to find.

Here are some examples:

  • continuous capture from firewire, autosplit every couple of minutes

    dvgrab --size 500 --autosplit <filename>
    
  • watch the camera live

    dvgrab - | mplayer -
    

Be aware that some recent distros (e.g. Fedora8) are using new but half-baked firewire drivers. However, Ubuntu works great.

Caleb
  • 5,084
  • 1
  • 46
  • 65
Shannon Nelson
  • 2,090
  • 14
  • 14
  • Does this work with webcams? I get `no camera found` on my laptop, and `-V` option throws `Error: v4l2reader.cc:66: In function "virtual bool v4l2Reader::Open()": "m_fd = open( m_device, O_RDWR | O_NONBLOCK, 0 )" evaluated to -1` – Jonathan May 29 '18 at 19:22
  • `--input /dev/video0` turns the cam on but I get `"Waiting for dv"` error – Jonathan May 29 '18 at 19:29
2

There are "sealed" camera solutions out there with mini-webservers and an ethernet port on the back. Just plug it in to the network, set its IP, and open up a browser... in linux or wherever

If you want to capture in linux, I once had a cheap webcam capturing single frames in a perl script, which could have been modified for real time - though that was about 10 years ago. Anyway, its possible :-/

dittonamed
  • 940
  • 2
  • 9
  • 17
1

If you use java, v4l4j makes it very simple to capture frames from any V4L device. It also allows you to control the device from java. I used it with a PTZ webcam (logitech quickam orbit), and I could control usual thigs like brightness, saturation and auto-white balance, but also the tilt and pan of the camera. Very handy !

1

There's the cheese gnome application. Really simple to use. Not too much features, just video capture.

jackbravo
  • 1,329
  • 1
  • 12
  • 17
1

openCV will allow you to capture individual frames from a camera and save to disk. If you need to then manipulate these to create a video, I would suggest netpbm, a pretty powerful set of command line tools you can use with some shell scripting to make a video or do whatever it is you need.

jdt141
  • 4,993
  • 6
  • 35
  • 36
1

Another option is to use Firewire (IEEE1394) cameras, such as most common DV camcorders. They tend to work really well and give a lot better video than cheap web cams, and there is a plethora of tools in Linux for working with dv video, such as dvgrab.

jsmith
  • 41
  • 4