public class VideoConfig extends CameraControlOptions
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BASE_COMMAND
Path to the raspivid executable.
|
static int |
DEFAULT_BITRATE
Default bitrate value, in bits/s.
|
static int |
DEFAULT_FRAMERATE
Default frame rate value, in fps.
|
static int |
DEFAULT_HEIGHT
Default image height, in pixels.
|
static int |
DEFAULT_SEGMENT_NUMBER
Default segment number.
|
static int |
DEFAULT_TIMEOUT
Default timeout value, in milliseconds.
|
static int |
DEFAULT_WIDTH
Default image width, in pixels.
|
static int |
MAX_BITRATE
Maximum bitrate value, in bits/s.
|
static int |
MAX_FRAMERATE
At the present, the maximum frame rate allowed is 30fps.
|
static int |
MAX_HEIGHT
Maximum image height, in pixels.
|
static int |
MAX_WIDTH
Maximum image width, in pixels.
|
static int |
MIN_BITRATE
Minimum bitrate value, in bits/s.
|
static int |
MIN_FRAMERATE
At the present, the minimum frame rate allowed is 2fps.
|
static int |
MIN_HEIGHT
Minimum image height, in pixels.
|
static int |
MIN_SEGMENT
Minimum segment value, in milliseconds.
|
static int |
MIN_SEGMENT_NUMBER
Minimum segment number.
|
static int |
MIN_TIMEOUT
Minimum timeout value, in milliseconds.
|
static int |
MIN_WIDTH
Minimum image width, in pixels.
|
static int |
MIN_WRAP
Minimum wrap value.
|
DEFAULT_BRIGHTNESS, DEFAULT_CONTRAST, DEFAULT_EV_COMPENSATION, DEFAULT_SATURATION, DEFAULT_SHARPNESS, MAX_BRIGHTNESS, MAX_CONTRAST, MAX_EV_COMPENSATION, MAX_ISO, MAX_SATURATION, MAX_SHARPNESS, MIN_BRIGHTNESS, MIN_CONTRAST, MIN_EV_COMPENSATION, MIN_ISO, MIN_SATURATION, MIN_SHARPNESS
Constructor and Description |
---|
VideoConfig()
Constructor for a new VideoConfig using only default values for parameters.
|
VideoConfig(int millis)
Constructor for a new VideoConfig using specific value for
the duration of the video.
|
VideoConfig(int millis,
int width,
int height)
Constructor for a new VideConfig using specific values for
the duration of the video, the width and the height of the images.
|
Modifier and Type | Method and Description |
---|---|
void |
enableKeypressMode(boolean enable)
Toggle between record and pause on ENTER key pressed.
|
void |
enablePpsSpsHeaders()
Forces the stream to include PPS and SPS headers on every I-frame.
|
java.lang.String |
getCommand()
Get the complee command to execute to take a new video with the requested parameters.
|
int |
getFramerate()
Returns the frame rate used for the video.
|
java.lang.String |
getOutputFilenameWithExtension()
Return the output filename, with the ".h264" extension (only if the output filename isn't "-",
which corresponds to the use of the standard output (no file created on the system)).
|
java.lang.String |
getOutputFilenameWithoutExtension()
Return the output filename, with the extension.
|
void |
segment(int millis)
Segment the stream in to multiple files.
|
void |
setBitrate(int bitrate)
Set the bitrate of resulting video.
|
void |
setFramerate(int framerate)
Specify the frames per second to record.
|
void |
setH264Profile(H264Profile profile)
Specify the h264 profile to use for encoding.
|
void |
setHeight(int height)
Set the image height.
|
void |
setInitialState(InitialState initialState)
Define initial state on startup.
|
void |
setOutputFilename(java.lang.String filename)
Specify the output filename.
|
void |
setStartSequenceNumber(int startSequenceNumber)
When outputting segments, this is the initial segment number, giving the ability
to resume previous recording from a given segment.
|
void |
setTimed(int on,
int off)
This option allows the video capture to be paused and restarted
at particular time intervals.
|
void |
setTimeout(int timeout)
Sets the duration (in ms) for future videos.
|
void |
setVerbose(boolean verbose)
Enable/disable the verbose mode.
|
void |
setWidth(int width)
Set the image width.
|
void |
turnOnVideoStabilisation(boolean active)
Turn on/off video stabilisation.
|
void |
wrap(int wrap)
When outputting segments, this is the maximum the segment number can reach before
it is reset to 1, giving the ability to keep recording segments, but overwriting
the oldest one.
|
annotate, getOptions, setAWBMode, setBrightness, setCameraMode, setContrast, setEVCompensation, setExposureMode, setHorizontalFlip, setImageEffect, setISO, setRotationDegree, setSaturation, setSharpness, setVerticalFlip
public static final java.lang.String BASE_COMMAND
public static final int DEFAULT_WIDTH
public static final int MAX_WIDTH
public static final int MIN_WIDTH
public static final int DEFAULT_HEIGHT
public static final int MAX_HEIGHT
public static final int MIN_HEIGHT
public static final int DEFAULT_BITRATE
For h264 1080p30, a high quality bitrate would be 15Mbits/s.
public static final int MIN_BITRATE
public static final int MAX_BITRATE
public static final int DEFAULT_TIMEOUT
public static final int MIN_TIMEOUT
public static final int DEFAULT_FRAMERATE
public static final int MAX_FRAMERATE
public static final int MIN_FRAMERATE
public static final int MIN_SEGMENT
public static final int MIN_WRAP
public static final int DEFAULT_SEGMENT_NUMBER
public static final int MIN_SEGMENT_NUMBER
public VideoConfig()
public VideoConfig(int millis)
millis
- the duration in milliseconds to apply for future videos.public VideoConfig(int millis, int width, int height)
millis
- the duration in milliseconds to apply for future videos.width
- the width to use for the new video, in pixels.height
- the height to use for the new video, in pixels.public void setWidth(int width)
This should be between 64 and 1920.
width
- the new width to apply for future videos.public void setHeight(int height)
This should be between 64 and 1080.
height
- the new height to apply for future videos.public void setBitrate(int bitrate)
Use bits per second, so 10Mbits/s would be -b 10000000.
For H264, 1080p30 a high quality bitrate would be 15Mbits/s or more. Maximum bitrate is 25Mbits/s (-b 25000000), but much over 17Mbits/s will not show noticeable improvement at 1080p30.
bitrate
- the new bitrate to apply for future videos.public void setOutputFilename(java.lang.String filename)
If not specified (filename = null), default name is given. If the filename is '-', then all output is sent to stdout.
Do not enter the extension here !
filename
- the output file name, without the extension.public java.lang.String getOutputFilenameWithExtension()
public java.lang.String getOutputFilenameWithoutExtension()
public void setVerbose(boolean verbose)
If true, outputs debugging/information messages during the program run.
verbose
- true to output debugging/information messages during the program run.public void setTimeout(int timeout)
The program will run for this duration, taking the capture if requested (if an output is specified). If not specified, this timeout is set to 1 millisecond.
Setting to 0 means the application will run continuously until stopped with Ctrl-C.
timeout
- the new timeout to apply for future videos.public int getFramerate()
public void setFramerate(int framerate)
At present, the minimum frame rate allowed is 2fps, the maximum is 30fps. This is likely to change in the future.
framerate
- the new framerate to apply for future videos, in fps.public void setH264Profile(H264Profile profile)
profile
- the new profile to apply for future videos. null for default.public void enablePpsSpsHeaders()
Needed for certain streaming cases. e.g. Apple HLS. These headers are small, so do not greatly increase file size.
public void setTimed(int on, int off)
On time is the amount of time the video is captured, off time is the amount it is paused. The total time of the recording is defined by the timeout option. Note the recording may take slightly over the timeout setting depending on the On and Off times.
For example:
raspivid -o test.h264 -t 25000 -timed 2500,5000
will record for a period of 25 seconds. The recording will be over a timeframe consisting of 2500ms (2.5s) segments with 5000ms (5s) gaps, repeating over the 20s. So the entire recording will actually be only 10s long, since 4 segments of 2.5s = 10s separated by 5s gaps.
2.5 record – 5 pause - 2.5 record – 5 pause - 2.5 record – 5 pause – 2.5 record
gives a total recording period of 25s, but only 10s of actual recorded footage.
on
- the new on time to apply for future videos, in milliseconds.off
- the new off time to apply for future videos, in milliseconds.public void enableKeypressMode(boolean enable)
On each press of the ENTER key the recording will be paused or restarted.
Pressing X then ENTER will stop recording and close the application.
Note that the timeout value will be used to signal end of recording, but is only checked after each ENTER keypress, so if the system is waiting for a keypress, even if the timeout has expired, it will still wait for the keypress before exiting.
enable
- true to enable the keypress mode. False to disable.public void setInitialState(InitialState initialState)
Define whether the camera will start paused or will immediately start recording. Options are 'record' or 'pause'.
Note that if you are using a simple timeout, and initial is set to 'pause', no output will be recorded.
initialState
- the new initial state to apply for future videos. null to use default.public void segment(int millis)
Rather than creating a single file, the file is split up in to segments of approximately the numer of milliseconds specified. In order to provide different filenames, you should add %04d or similar at the point in the filename where you want a segment count number to appear. e.g:
--segment 3000 -o video%04d.h264
will produce video clips of approximately 3000ms (3s) long, named video0001.h264, video0002.h264 etc. The clips should be seamless (no frame drops between clips), but the accuracy of each clip length will depend on the intraframe period, as the segments will always start on an I-frame. They will therefore always be equal or longer to the specified period.
millis
- the new segments duration to apply for future videos. -1 to disable.public void wrap(int wrap)
So if set to four, in the segment example above, the files produced will be video0001.h264, video0002.h264, video0003.h264, video0004.h264. Once video0004.h264 is recorded, the count will reset to 1, and the video0001.h264 will be overwritten.
wrap
- the new maximum value to apply for future segments numbers. -1 if no maximum segment number.public void setStartSequenceNumber(int startSequenceNumber)
startSequenceNumber
- the new start sequence number to apply for future videos.public void turnOnVideoStabilisation(boolean active)
active
- true to turn on. False to turn off.public java.lang.String getCommand()