Performs H.264 encoding and writing to an MP4 container from PvBuffers. More...
Public Member Functions | |
PvMp4Writer () | |
Constructor. | |
~PvMp4Writer () | |
Destructor. | |
bool | IsAvailable () const |
Returns true if H.264 encoding and MP4 output is supported on the system. More... | |
bool | IsOpened () |
Returns true if the writer is already opened. More... | |
PvResult | Open (const PvString &aFilename, PvImage *aImage) |
Opens the writer. More... | |
PvResult | WriteFrame (PvImage *aImage, uint32_t *aFileSizeDelta) |
Writes a frame to the MP4 file. More... | |
PvResult | Close () |
Closes the writer. More... | |
uint32_t | GetAvgBitrate () const |
Returns the average bitrate the writer is configured with. More... | |
PvResult | SetAvgBitrate (uint32_t aValue) |
Sets the average bitrate of H.264 encoding for the writer. More... | |
void | GetLastError (PvString &aString) const |
Returns the last error that occured with the MP4 writer. More... | |
void | ResetLastError () |
Resets the last error reported by the object. | |
Performs H.264 encoding and writing to an MP4 container from PvBuffers.
Call Open with the first image and filename, call write for every buffer (including the first one) and finilize using the Close method. The MP4 file will not be valid until/unless the Close method (or descructor) is executed.
On Windows the Media Foundation H.264 encoder is used. Please refer to Microsoft documentation for image size, frame rate and other limitations when using this class or when using it from eBUS Player.
PvResult PvMp4Writer::Close | ( | ) |
Closes the writer.
uint32_t PvMp4Writer::GetAvgBitrate | ( | ) | const |
Returns the average bitrate the writer is configured with.
void PvMp4Writer::GetLastError | ( | PvString & | aString | ) | const |
Returns the last error that occured with the MP4 writer.
[out] | aString | String where the last error description is copied. |
bool PvMp4Writer::IsAvailable | ( | ) | const |
Returns true if H.264 encoding and MP4 output is supported on the system.
bool PvMp4Writer::IsOpened | ( | ) |
Returns true if the writer is already opened.
Opens the writer.
[in] | aFilename | The filename of the MP4: full path including the mp4 extension. |
[in] | aImage | Image similar in width, height and pixel format to the stream to encode. |
PvResult PvMp4Writer::SetAvgBitrate | ( | uint32_t | aValue | ) |
Sets the average bitrate of H.264 encoding for the writer.
The average bitrate must be set before opening the writer.
[in] | aValue | The new average bitrate value. |
Writes a frame to the MP4 file.
Note: the image used to open the writer is not encoded or written to the file. If you are using the first image to open the file, you need to call WriteFrame with the same image as well.
[in] | aImage | Image to encode to H.264 and write to the MP4 file. |
[out] | aFileSizeDelta | Pointer to an integer where the file size delta for encoding/writing this frame is written (optional, NULL if not needed) |
Copyright (c) 2002-2018 Pleora Technologies Inc.
www.pleora.com