Pleora Technologies Inc. eBUS SDK v6.2.8.5877 API



PvMp4Writer Class Reference

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.
 

Detailed Description

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.

When saving H.264 video in an MP4 container on the Windows operating system, eBUS Player uses the Microsoft Media Foundation H.264 video encoder. The default video encoder settings are used, with the exception of the frame rate and average bit rate. The video is encoded at 30 frames per second. And the average bit rate is set to the value specified in the eBUS Player Image and Video Saving Options dialog box. For more information, please refer to eBUS Player User Guide.

Member Function Documentation

◆ Close()

PvResult PvMp4Writer::Close ( )

Closes the writer.

Returns
Includes:

◆ GetAvgBitrate()

uint32_t PvMp4Writer::GetAvgBitrate ( ) const

Returns the average bitrate the writer is configured with.

Returns
Average bitrate.

◆ GetLastError()

void PvMp4Writer::GetLastError ( PvString aString) const

Returns the last error that occured with the MP4 writer.

Parameters
[out]aStringString where the last error description is copied.

◆ IsAvailable()

bool PvMp4Writer::IsAvailable ( ) const

Returns true if H.264 encoding and MP4 output is supported on the system.

Returns
True if supported, false otherwise.

◆ IsOpened()

bool PvMp4Writer::IsOpened ( )

Returns true if the writer is already opened.

Returns
True if the writer is already opened, false otherwise.

◆ Open()

PvResult PvMp4Writer::Open ( const PvString aFilename,
PvImage aImage 
)

Opens the writer.

Parameters
[in]aFilenameThe filename of the MP4: full path including the mp4 extension.
[in]aImageImage similar in width, height and pixel format to the stream to encode.
Returns
Includes:

◆ SetAvgBitrate()

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.

Parameters
[in]aValueThe new average bitrate value.
Returns
Includes:

◆ WriteFrame()

PvResult PvMp4Writer::WriteFrame ( PvImage aImage,
uint32_t *  aFileSizeDelta 
)

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.

Parameters
[in]aImageImage to encode to H.264 and write to the MP4 file.
[out]aFileSizeDeltaPointer to an integer where the file size delta for encoding/writing this frame is written (optional, NULL if not needed)
Returns
Includes:

The documentation for this class was generated from the following files:

Copyright (c) 2002-2021 Pleora Technologies Inc.
www.pleora.com