FFmpeg
The FFmpeg arrow provides importing and exporting of video and image data in KWIVER using the FFmpeg library. This includes extracting individual frames as images and muxing or demuxing metadata to KLV (Key-Length-Value) data streams of the video. The encoding and decoding of this data is handled by the KLV arrow. The FFmpeg arrow can be built by enabling the KWIVER_ENABLE_FFMPEG CMake flag.
How to Use
The primary way to use the FFmpeg arrow is via the ffmpeg_video_input
implementation of the vital_video_input interface.
Important methods for this interface include the open method used to open a
video for reading. The next_frame and seek_frame allow navigation of
the video and the frame_image and frame_metadata can extract data from
the current frame.
The arrow also includes the ffmpeg_video_input_clip implementation of ffmpeg_video_input, an implementation of the vital_video_output interface which can write out videos, and the vital_image_io interface which allows reading and writing of frame images without having to bring in another arrow as a dependency.
Algorithm Implementations
ffmpeg_video_input
-
class ffmpeg_video_input : public kwiver::vital::algo::video_input
Video input using FFmpeg (libav).
Public Functions
-
virtual void close() override
Close video stream.
Close the currently opened stream and release resources. Closing a stream that is already closed does not cause a problem.
-
virtual bool end_of_video() const override
Return end of video status.
This method returns the end-of-video status of the input video. true is returned if the last frame has been returned.
This method will always return false for video streams that have no ability to detect end of video, such as network streams.
- Returns:
true if at end of video, false otherwise.
-
virtual bool good() const override
Check whether state of video stream is good.
This method checks the current state of the video stream to see if it is good. A stream is good if it refers to a valid frame such that calls to
frame_image()andframe_metadata()are expected to return meaningful data. After callingopen()the initial video state is not good until the first call tonext_frame().- Returns:
true if video stream is good, false if not good.
-
virtual bool seekable() const override
Return whether video stream is seekable.
This method returns whether the video stream is seekable.
- Returns:
true if video stream is seekable, false otherwise.
-
virtual size_t num_frames() const override
Get the number of frames in the video stream.
Get the number of frames available in the video stream.
- Throws:
video_stream_exception – when there is an error in the video stream.
- Returns:
the number of frames in the video stream, or 0 if the video stream is not seekable.
-
virtual double frame_rate() override
Get frame rate from the video.
If frame rate is not supported, return -1.
- Returns:
Frame rate.
-
virtual bool next_frame(vital::timestamp &ts, vital::time_usec_t timeout = 0) override
Advance to next frame in video stream.
This method advances the video stream to the next frame, making the image and metadata available. The returned timestamp is for new current frame.
The timestamp returned may be missing either frame number or time or both, depending on the actual implementation.
Calling this method will make a new image and metadata packets available. They can be retrieved by calling frame_image() and frame_metadata().
Check the HAS_TIMEOUT capability from the concrete implementation to see if the timeout feature is supported.
If the video input is already an end, then calling this method will return false.
- Parameters:
ts – [out] Time stamp of new frame.
timeout – [in] Number of microseconds to wait. 0 = no timeout.
- Throws:
video_input_timeout_exception – when the timeout expires.
video_stream_exception – when there is an error in the video stream.
- Returns:
true if frame returned, false if end of video.
-
virtual bool seek_frame(vital::timestamp &ts, vital::timestamp::frame_t frame_number, vital::time_usec_t timeout = 0) override
Seek to the given frame number in video stream.
This method seeks the video stream to the requested frame, making the image and metadata available. The returned timestamp is for new current frame.
The timestamp returned may be missing the time.
Calling this method will make a new image and metadata packets available. They can be retrieved by calling frame_image() and frame_metadata().
Check the HAS_TIMEOUT capability from the concrete implementation to see if the timeout feature is supported.
If the frame requested does not exist, then calling this method will return false.
If the video input is not seekable then calling this method will return false.
- Parameters:
ts – [out] Time stamp of new frame.
frame_number – [in] The frame to seek to.
timeout – [in] Number of microseconds to wait. 0 = no timeout.
- Throws:
video_input_timeout_exception – when the timeout expires.
video_stream_exception – when there is an error in the video stream.
- Returns:
true if frame returned, false if end of video.
-
virtual vital::timestamp frame_timestamp() const override
Obtain the time stamp of the current frame.
This method returns the time stamp of the current frame, if any, or an invalid time stamp. The returned time stamp shall have the same value as was set by the most recent call to
next_frame().This method is idempotent. Calling it multiple times without calling next_frame() will return the same time stamp.
- Returns:
The time stamp of the current frame.
-
virtual vital::image_container_sptr frame_image() override
Get current frame from video stream.
This method returns the image from the current frame. If the video input is already an end, then calling this method will return a null pointer.
This method is idempotent. Calling it multiple times without calling next_frame() will return the same image.
- Throws:
video_stream_exception – when there is an error in the video stream.
- Returns:
Pointer to image container.
-
virtual vital::video_raw_image_sptr raw_frame_image() override
Return implementation-defined data for efficiently copying this frame’s image.
Using this method can help avoid the loss of efficiency and fidelity that comes with re-encoding an image, if no changes to the image are to be performed before writing it back out. May return
nullptr, indicating the reader does not support this operation.- Returns:
Pointer to raw image data.
-
virtual vital::metadata_vector frame_metadata() override
Get metadata collection for current frame.
This method returns the metadata collection for the current frame. It is best to call this after calling next_frame() to make sure the metadata and video are synchronized and that no metadata collections are lost.
Metadata typically occurs less frequently than video frames, so if you call next_frame() and frame_metadata() together while processing a video, there may be times where no metadata is returned. In this case an empty metadata vector will be returned.
Also note that the metadata collection contains a timestamp that can be used to determine where the metadata fits in the video stream.
In video streams without metadata (as determined by the stream capability), this method may return and empty vector, indicating no new metadata has been found.
Calling this method at end of video will return an empty metadata vector.
Metadata is returned as a vector, instead of a single object, to handle cases where there is multiple metadata packets between frames. This can happen in video streams with a fast metadata rate and slow frame rate. Multiple metadata objects can be also returned from video streams that contain metadata in multiple standards, such as MISB-601 and MISB-104.
In cases where there are multiple metadata packets between frames, it is inappropriate for the reader to try to select the best metadata packet. That is why they are all returned.
This method is idempotent. Calling it multiple times without calling next_frame() will return the same metadata.
- Throws:
video_stream_exception – when there is an error in the video stream.
- Returns:
Vector of metadata pointers.
-
virtual vital::video_raw_metadata_sptr raw_frame_metadata() override
Return implementation-defined data for efficiently copying this frame’s metadata.
Using this method can help avoid the loss of efficiency and fidelity that comes with re-encoding metadata, if no changes to the metadata are to be performed before writing it back out. May return
nullptr, indicating the reader does not support this operation.- Returns:
Pointer to raw metadata.
-
virtual vital::video_uninterpreted_data_sptr uninterpreted_frame_data() override
Return an implementation-defined representation of uninterpreted data in this frame.
This method enables passage of miscellaneous data - such as audio, unrecognized metadata, or secondary image streams - to a video output when transcoding.
- Returns:
Pointer to uninterpreted data.
-
virtual vital::metadata_map_sptr metadata_map() override
Get metadata map for video.
This method returns a metadata map for the video assuming the video is seekable. If the video is not seekable it will return an empty map. Depending on the implementation if the metamap has not been previously requested then the video will have to loop over to create and store the metadata map.
In video streams without metadata (as determined by the stream capability), this method will return an empty map, indicating no metadata has been found.
- Throws:
video_stream_exception – when there is an error in the video stream.
- Returns:
Map of vectors of metadata pointers.
-
virtual vital::video_settings_uptr implementation_settings() const override
Extract implementation-specific video encoding settings.
The returned structure is intended to be passed to a video encoder of similar implementation so that the output video can be encoded using the settings of the input video.
- Returns:
Implementation video settings, or
nullptrif none are needed.
-
virtual void close() override
ffmpeg_video_input_clip
-
class ffmpeg_video_input_clip : public kwiver::vital::algo::video_input
Video input which temporally clips an FFmpeg-sourced video.
This implementation must have access to FFmpeg-level detailed information in order to properly clip raw streams.
Public Functions
-
virtual void close() override
Close video stream.
Close the currently opened stream and release resources. Closing a stream that is already closed does not cause a problem.
-
virtual bool end_of_video() const override
Return end of video status.
This method returns the end-of-video status of the input video. true is returned if the last frame has been returned.
This method will always return false for video streams that have no ability to detect end of video, such as network streams.
- Returns:
true if at end of video, false otherwise.
-
virtual bool good() const override
Check whether state of video stream is good.
This method checks the current state of the video stream to see if it is good. A stream is good if it refers to a valid frame such that calls to
frame_image()andframe_metadata()are expected to return meaningful data. After callingopen()the initial video state is not good until the first call tonext_frame().- Returns:
true if video stream is good, false if not good.
-
virtual bool seekable() const override
Return whether video stream is seekable.
This method returns whether the video stream is seekable.
- Returns:
true if video stream is seekable, false otherwise.
-
virtual size_t num_frames() const override
Get the number of frames in the video stream.
Get the number of frames available in the video stream.
- Throws:
video_stream_exception – when there is an error in the video stream.
- Returns:
the number of frames in the video stream, or 0 if the video stream is not seekable.
-
virtual bool next_frame(vital::timestamp &ts, vital::time_usec_t timeout = 0) override
Advance to next frame in video stream.
This method advances the video stream to the next frame, making the image and metadata available. The returned timestamp is for new current frame.
The timestamp returned may be missing either frame number or time or both, depending on the actual implementation.
Calling this method will make a new image and metadata packets available. They can be retrieved by calling frame_image() and frame_metadata().
Check the HAS_TIMEOUT capability from the concrete implementation to see if the timeout feature is supported.
If the video input is already an end, then calling this method will return false.
- Parameters:
ts – [out] Time stamp of new frame.
timeout – [in] Number of microseconds to wait. 0 = no timeout.
- Throws:
video_input_timeout_exception – when the timeout expires.
video_stream_exception – when there is an error in the video stream.
- Returns:
true if frame returned, false if end of video.
-
virtual bool seek_frame(vital::timestamp &ts, vital::timestamp::frame_t frame_number, vital::time_usec_t timeout = 0) override
Seek to the given frame number in video stream.
This method seeks the video stream to the requested frame, making the image and metadata available. The returned timestamp is for new current frame.
The timestamp returned may be missing the time.
Calling this method will make a new image and metadata packets available. They can be retrieved by calling frame_image() and frame_metadata().
Check the HAS_TIMEOUT capability from the concrete implementation to see if the timeout feature is supported.
If the frame requested does not exist, then calling this method will return false.
If the video input is not seekable then calling this method will return false.
- Parameters:
ts – [out] Time stamp of new frame.
frame_number – [in] The frame to seek to.
timeout – [in] Number of microseconds to wait. 0 = no timeout.
- Throws:
video_input_timeout_exception – when the timeout expires.
video_stream_exception – when there is an error in the video stream.
- Returns:
true if frame returned, false if end of video.
-
virtual vital::timestamp frame_timestamp() const override
Obtain the time stamp of the current frame.
This method returns the time stamp of the current frame, if any, or an invalid time stamp. The returned time stamp shall have the same value as was set by the most recent call to
next_frame().This method is idempotent. Calling it multiple times without calling next_frame() will return the same time stamp.
- Returns:
The time stamp of the current frame.
-
virtual vital::image_container_sptr frame_image() override
Get current frame from video stream.
This method returns the image from the current frame. If the video input is already an end, then calling this method will return a null pointer.
This method is idempotent. Calling it multiple times without calling next_frame() will return the same image.
- Throws:
video_stream_exception – when there is an error in the video stream.
- Returns:
Pointer to image container.
-
virtual vital::video_raw_image_sptr raw_frame_image() override
Return implementation-defined data for efficiently copying this frame’s image.
Using this method can help avoid the loss of efficiency and fidelity that comes with re-encoding an image, if no changes to the image are to be performed before writing it back out. May return
nullptr, indicating the reader does not support this operation.- Returns:
Pointer to raw image data.
-
virtual vital::metadata_vector frame_metadata() override
Get metadata collection for current frame.
This method returns the metadata collection for the current frame. It is best to call this after calling next_frame() to make sure the metadata and video are synchronized and that no metadata collections are lost.
Metadata typically occurs less frequently than video frames, so if you call next_frame() and frame_metadata() together while processing a video, there may be times where no metadata is returned. In this case an empty metadata vector will be returned.
Also note that the metadata collection contains a timestamp that can be used to determine where the metadata fits in the video stream.
In video streams without metadata (as determined by the stream capability), this method may return and empty vector, indicating no new metadata has been found.
Calling this method at end of video will return an empty metadata vector.
Metadata is returned as a vector, instead of a single object, to handle cases where there is multiple metadata packets between frames. This can happen in video streams with a fast metadata rate and slow frame rate. Multiple metadata objects can be also returned from video streams that contain metadata in multiple standards, such as MISB-601 and MISB-104.
In cases where there are multiple metadata packets between frames, it is inappropriate for the reader to try to select the best metadata packet. That is why they are all returned.
This method is idempotent. Calling it multiple times without calling next_frame() will return the same metadata.
- Throws:
video_stream_exception – when there is an error in the video stream.
- Returns:
Vector of metadata pointers.
-
virtual vital::video_raw_metadata_sptr raw_frame_metadata() override
Return implementation-defined data for efficiently copying this frame’s metadata.
Using this method can help avoid the loss of efficiency and fidelity that comes with re-encoding metadata, if no changes to the metadata are to be performed before writing it back out. May return
nullptr, indicating the reader does not support this operation.- Returns:
Pointer to raw metadata.
-
virtual vital::video_uninterpreted_data_sptr uninterpreted_frame_data() override
Return an implementation-defined representation of uninterpreted data in this frame.
This method enables passage of miscellaneous data - such as audio, unrecognized metadata, or secondary image streams - to a video output when transcoding.
- Returns:
Pointer to uninterpreted data.
-
virtual vital::metadata_map_sptr metadata_map() override
Get metadata map for video.
This method returns a metadata map for the video assuming the video is seekable. If the video is not seekable it will return an empty map. Depending on the implementation if the metamap has not been previously requested then the video will have to loop over to create and store the metadata map.
In video streams without metadata (as determined by the stream capability), this method will return an empty map, indicating no metadata has been found.
- Throws:
video_stream_exception – when there is an error in the video stream.
- Returns:
Map of vectors of metadata pointers.
-
virtual vital::video_settings_uptr implementation_settings() const override
Extract implementation-specific video encoding settings.
The returned structure is intended to be passed to a video encoder of similar implementation so that the output video can be encoded using the settings of the input video.
- Returns:
Implementation video settings, or
nullptrif none are needed.
-
class impl
-
virtual void close() override
ffmpeg_video_input_rewire
-
class ffmpeg_video_input_rewire : public kwiver::vital::algo::video_input
Video input which assembles multiple streams from other video inputs into a single video input interface.
Public Functions
-
virtual vital::config_block_sptr get_configuration() const override
Get this algorithm’s configuration block
This method returns the required configuration for the algorithm. The implementation of this method should be light-weight and only create and fill in the config block.
This base virtual function implementation returns an empty configuration.
- Returns:
config_blockcontaining the configuration for this algorithm and any nested components.
-
virtual void set_configuration(vital::config_block_sptr config) override
Set this algorithm’s properties via a config block
This method is called to pass a configuration to the algorithm. The implementation of this method should be light-weight and only save the necessary config values. Defer any substantial processing in another method.
- Throws:
no_such_configuration_value_exception – Thrown if an expected configuration value is not present.
algorithm_configuration_exception – Thrown when the algorithm is given an invalid
config_blockor is otherwise unable to configure itself.
- Parameters:
config – The
config_blockinstance containing the configuration parameters for this algorithm
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s configuration config_block is valid
This checks solely within the provided
config_blockand not against the current state of the instance. This isn’t static for inheritance reasons.- Parameters:
config – The config block to check configuration of.
- Returns:
true if the configuration check passed and false if it didn’t.
-
virtual void open(std::string video_name) override
Open a video stream.
This method opens the specified video stream for reading. The format of the name depends on the concrete implementation. It could be a file name or it could be a URI.
Capabilities are set in this call, so they are available after.
Note
Once a video is opened, it starts in an invalid state (i.e. before the first frame of video). You must call
next_frame()to step to the first frame of video before callingframe_image().- Parameters:
video_name – Identifier of the video stream.
- Throws:
exception – if open failed
-
virtual void close() override
Close video stream.
Close the currently opened stream and release resources. Closing a stream that is already closed does not cause a problem.
-
virtual bool end_of_video() const override
Return end of video status.
This method returns the end-of-video status of the input video. true is returned if the last frame has been returned.
This method will always return false for video streams that have no ability to detect end of video, such as network streams.
- Returns:
true if at end of video, false otherwise.
-
virtual bool good() const override
Check whether state of video stream is good.
This method checks the current state of the video stream to see if it is good. A stream is good if it refers to a valid frame such that calls to
frame_image()andframe_metadata()are expected to return meaningful data. After callingopen()the initial video state is not good until the first call tonext_frame().- Returns:
true if video stream is good, false if not good.
-
virtual bool seekable() const override
Return whether video stream is seekable.
This method returns whether the video stream is seekable.
- Returns:
true if video stream is seekable, false otherwise.
-
virtual size_t num_frames() const override
Get the number of frames in the video stream.
Get the number of frames available in the video stream.
- Throws:
video_stream_exception – when there is an error in the video stream.
- Returns:
the number of frames in the video stream, or 0 if the video stream is not seekable.
-
virtual bool next_frame(vital::timestamp &ts, vital::time_usec_t timeout = 0) override
Advance to next frame in video stream.
This method advances the video stream to the next frame, making the image and metadata available. The returned timestamp is for new current frame.
The timestamp returned may be missing either frame number or time or both, depending on the actual implementation.
Calling this method will make a new image and metadata packets available. They can be retrieved by calling frame_image() and frame_metadata().
Check the HAS_TIMEOUT capability from the concrete implementation to see if the timeout feature is supported.
If the video input is already an end, then calling this method will return false.
- Parameters:
ts – [out] Time stamp of new frame.
timeout – [in] Number of microseconds to wait. 0 = no timeout.
- Throws:
video_input_timeout_exception – when the timeout expires.
video_stream_exception – when there is an error in the video stream.
- Returns:
true if frame returned, false if end of video.
-
virtual bool seek_frame(vital::timestamp &ts, vital::timestamp::frame_t frame_number, vital::time_usec_t timeout = 0) override
Seek to the given frame number in video stream.
This method seeks the video stream to the requested frame, making the image and metadata available. The returned timestamp is for new current frame.
The timestamp returned may be missing the time.
Calling this method will make a new image and metadata packets available. They can be retrieved by calling frame_image() and frame_metadata().
Check the HAS_TIMEOUT capability from the concrete implementation to see if the timeout feature is supported.
If the frame requested does not exist, then calling this method will return false.
If the video input is not seekable then calling this method will return false.
- Parameters:
ts – [out] Time stamp of new frame.
frame_number – [in] The frame to seek to.
timeout – [in] Number of microseconds to wait. 0 = no timeout.
- Throws:
video_input_timeout_exception – when the timeout expires.
video_stream_exception – when there is an error in the video stream.
- Returns:
true if frame returned, false if end of video.
-
virtual vital::timestamp frame_timestamp() const override
Obtain the time stamp of the current frame.
This method returns the time stamp of the current frame, if any, or an invalid time stamp. The returned time stamp shall have the same value as was set by the most recent call to
next_frame().This method is idempotent. Calling it multiple times without calling next_frame() will return the same time stamp.
- Returns:
The time stamp of the current frame.
-
virtual vital::image_container_sptr frame_image() override
Get current frame from video stream.
This method returns the image from the current frame. If the video input is already an end, then calling this method will return a null pointer.
This method is idempotent. Calling it multiple times without calling next_frame() will return the same image.
- Throws:
video_stream_exception – when there is an error in the video stream.
- Returns:
Pointer to image container.
-
virtual vital::video_raw_image_sptr raw_frame_image() override
Return implementation-defined data for efficiently copying this frame’s image.
Using this method can help avoid the loss of efficiency and fidelity that comes with re-encoding an image, if no changes to the image are to be performed before writing it back out. May return
nullptr, indicating the reader does not support this operation.- Returns:
Pointer to raw image data.
-
virtual vital::metadata_vector frame_metadata() override
Get metadata collection for current frame.
This method returns the metadata collection for the current frame. It is best to call this after calling next_frame() to make sure the metadata and video are synchronized and that no metadata collections are lost.
Metadata typically occurs less frequently than video frames, so if you call next_frame() and frame_metadata() together while processing a video, there may be times where no metadata is returned. In this case an empty metadata vector will be returned.
Also note that the metadata collection contains a timestamp that can be used to determine where the metadata fits in the video stream.
In video streams without metadata (as determined by the stream capability), this method may return and empty vector, indicating no new metadata has been found.
Calling this method at end of video will return an empty metadata vector.
Metadata is returned as a vector, instead of a single object, to handle cases where there is multiple metadata packets between frames. This can happen in video streams with a fast metadata rate and slow frame rate. Multiple metadata objects can be also returned from video streams that contain metadata in multiple standards, such as MISB-601 and MISB-104.
In cases where there are multiple metadata packets between frames, it is inappropriate for the reader to try to select the best metadata packet. That is why they are all returned.
This method is idempotent. Calling it multiple times without calling next_frame() will return the same metadata.
- Throws:
video_stream_exception – when there is an error in the video stream.
- Returns:
Vector of metadata pointers.
-
virtual vital::video_raw_metadata_sptr raw_frame_metadata() override
Return implementation-defined data for efficiently copying this frame’s metadata.
Using this method can help avoid the loss of efficiency and fidelity that comes with re-encoding metadata, if no changes to the metadata are to be performed before writing it back out. May return
nullptr, indicating the reader does not support this operation.- Returns:
Pointer to raw metadata.
-
virtual vital::video_uninterpreted_data_sptr uninterpreted_frame_data() override
Return an implementation-defined representation of uninterpreted data in this frame.
This method enables passage of miscellaneous data - such as audio, unrecognized metadata, or secondary image streams - to a video output when transcoding.
- Returns:
Pointer to uninterpreted data.
-
virtual vital::metadata_map_sptr metadata_map() override
Get metadata map for video.
This method returns a metadata map for the video assuming the video is seekable. If the video is not seekable it will return an empty map. Depending on the implementation if the metamap has not been previously requested then the video will have to loop over to create and store the metadata map.
In video streams without metadata (as determined by the stream capability), this method will return an empty map, indicating no metadata has been found.
- Throws:
video_stream_exception – when there is an error in the video stream.
- Returns:
Map of vectors of metadata pointers.
-
virtual vital::video_settings_uptr implementation_settings() const override
Extract implementation-specific video encoding settings.
The returned structure is intended to be passed to a video encoder of similar implementation so that the output video can be encoded using the settings of the input video.
- Returns:
Implementation video settings, or
nullptrif none are needed.
-
class impl
-
virtual vital::config_block_sptr get_configuration() const override
ffmpeg_image_io
ffmpeg_video_output
-
class ffmpeg_video_output : public kwiver::vital::algo::video_output
Public Functions
-
virtual bool check_configuration(vital::config_block_sptr config) const override
Check that the algorithm’s configuration config_block is valid
This checks solely within the provided
config_blockand not against the current state of the instance. This isn’t static for inheritance reasons.- Parameters:
config – The config block to check configuration of.
- Returns:
true if the configuration check passed and false if it didn’t.
-
virtual void open(std::string video_name, vital::video_settings const *settings) override
Open a video stream.
This method opens the specified video stream for writing. The format of the name depends on the concrete implementation. It could be a file name, a directory, or a URI.
- Parameters:
video_name – Identifier of the video stream.
settings – Additional information used to configure the video output.
- Throws:
exception – Thrown if opening the video stream failed.
-
virtual void close() override
Close video stream.
Close the currently opened stream and release resources. Closing a stream that is already closed does not cause a problem.
-
virtual bool good() const override
Check whether state of video stream is good.
This method checks the current state of the video stream to see if it is good. A stream is good if it is ready to receive images and/or metadata.
- Returns:
trueif video stream is good,falseif not good.
-
virtual void add_image(vital::image_container_sptr const &image, vital::timestamp const &ts) override
Add a frame image to the video stream.
This method writes the next frame image to the video stream. The timestamp should be greater than that of the previously written frame, as many implementations are unable to write frames out of order.
- Throws:
video_stream_exception – Thrown if is an error in the video stream.
-
virtual void add_image(vital::video_raw_image const &image) override
Add a raw frame image to the video stream.
This method writes the raw image to the video stream. There is no guarantee that this functions correctly when intermixed with non-raw images.
-
virtual void add_metadata(vital::metadata const &md) override
Add metadata collection to the video stream.
This method adds metadata to the video stream. Depending on the implementation, the metadata may be written immediately, or may be deferred until the next frame is written. For this reason, the metadata’s timestamp should be greater than that of the previously written frame.
For implementations that do not support metadata, this method does nothing.
- Throws:
video_stream_exception – Thrown if is an error in the video stream.
-
virtual void add_metadata(vital::video_raw_metadata const &md) override
Add a frame of raw metadata to the video stream.
This method writes the raw metadata to the video stream. There is no guarantee that this functions correctly when intermixed with non-raw metadata.
-
virtual void add_uninterpreted_data(vital::video_uninterpreted_data const &misc_data) override
Add a frame of uninterpreted data to the video stream.
This method writes the uninterpreted data to the video stream.
-
virtual vital::video_settings_uptr implementation_settings() const override
Extract implementation-specific video encoding settings.
The returned structure is intended to be passed to a video encoder of similar implementation to produce similarly formatted output. The returned value may not be identical to the one passed to this object via open().
- Returns:
Implementation video settings, or
nullptrif none are needed.
-
virtual bool check_configuration(vital::config_block_sptr config) const override