0
votes

I'm looking to write a C/C++ program to record a webcam video stream in a compressed video file.

I'm using Ubuntu 14.04 LTS.

Ideally, I want to use the available operating system codec to record the webcam images to my video file.

What is the standard way to use the installed codec of the OS ?

Is there a common V4L2 API to record video which is independent of the codec ? (ex: h264, mjpeg, divx, etc.)

Otherwise, how should I use the installed video codec in Ubuntu ? Is it a case by case situation ?

1

1 Answers

1
votes

Do checkout gstreamer (https://gstreamer.freedesktop.org/).

Several codecs are available (https://gstreamer.freedesktop.org/documentation/plugins.html).

You can use gst-launch to try out the library eg -
gst-launch v4l2src ! video/x-raw-yuv,width=320,height=240,framerate=20/1 ! xvimagesink

And if you want to write C/C++ code, you can use the SDK