ALVideoRecorder API

NAOqi Vision - Overview | API | Tutorial


Namespace : AL

#include <alproxies/alvideorecorderproxy.h>

Methods

bool ALVideoRecorderProxy::isRecording()
Returns:
  • True if the robot is currently recording a video.
  • False otherwise.
int ALVideoRecorderProxy::getColorSpace()

Returns the current color space.

int ALVideoRecorderProxy::getFrameRate()

Returns the current video framerate.

int ALVideoRecorderProxy::getResolution()

Returns the current frame resolution.

std::string ALVideoRecorderProxy::getVideoFormat()

Returns the current video format used to encode video. See ALVideoRecorderProxy::setVideoFormat() for the list of possible return values.

void ALVideoRecorderProxy::setColorSpace(const int& colorSpace)

Sets the color space used.

Parameters:
void ALVideoRecorderProxy::setFrameRate(const int& frameRate)

Sets the number of frames per second (FPS).

Parameters:
  • frameRate – New frame rate.

Note

MJPG format requires a frame rate greater than 2 FPS.

void ALVideoRecorderProxy::setResolution(const int& resolution)

Sets the frame resolution. It can be either VGA, QVGA or QQVGA.

Parameters:
  • resolution – New resolution { 0 = kQQVGA, 1 = kQVGA, 2 = kVGA }.
void ALVideoRecorderProxy::setVideoFormat(const std::string& videoFormat)

Sets the codec name used to encode the video.

Parameters:
  • videoFormat
    • “ARV” (raw YUV422 format)
    • “IYUV” (raw avi)
    • “MJPG” (compressed avi)
void ALVideoRecorderProxy::startRecording(const std::string& folderPath, const std::string& fileName)

There are two overloads of this function:

Starts recording a video with the current parameters until ALVideoRecorderProxy::stopRecording() is called. If the destination file already exists, it will be overwritten.

Parameters:
  • folderPath – Path were the video file will be save.
  • fileName – Name used to save the video. The file extension will be automatically added: ”.arv” if videoFormat is “ARV”, ”.avi” otherwise.

Note

Only one record at a time can be made.

void ALVideoRecorderProxy::startRecording(const std::string& folderPath, const std::string& fileName, const bool& overwrite)

Starts recording a video with the current parameters until ALVideoRecorderProxy::stopRecording() is called.

Parameters:
  • folderPath – Path were the video file will be save.
  • fileName – Name used to save the video. The file extension will be automatically added: ”.arv” if videoFormat is “ARV”, ”.avi” otherwise.
  • overwrite – If you set this value to False and the destination file already exists, the method will return and throw an exception. No data will be saved on disk and the existing file will be preserved.

Note

Only one record at a time can be made.

AL::ALValue ALVideoRecorderProxy::stopRecording()

Stops a video record that was launched with ALVideoRecorderProxy::startRecording(). The function returns the number of frames that were recorded, as well as the video absolute path.

Returns:Array of two elements [numRecordedFrames, recordAbsolutePath].

Note

This is a blocking method that can take several seconds to complete depending on the image resolution, the framerate, the video length and the chosen video format. MJPG format gives better performance than other formats.