Navigation
API > API/Plugins > API/Plugins/MP4Muxer > API/Plugins/MP4Muxer/IMP4RawMuxer
Description
This method starts the muxing process.
While there are samples to be muxed: The muxer invokes the FRequestTrackDataDelegate_, providing an array of track indices (the value returned by AddTrack_) and the sample number needed. The delegate is invoked from a muxer internal worker thread and is called at any time the muxer needs (or still needs) another sample for the particular track.
NOTE: Due to the asynchronous nature it will happen that the FRequestTrackDataDelegate_ asks for the same sample of a track more than once. For example, if you want to mux three tracks with the track indices 0, 1 and 2 the first invocation of the delegate will ask for sample number 0 of tracks 0, 1 and 2. As soon as you provide sample 0 of track 0 by calling AddTrackSample() the delegate will be invoked again, this time asking for track 0 sample 1 and _still for track 1 sample 0 and track 2 sample 0 because these samples have not been received yet.
As a result this means that even if you are currently in the process of gathering sample 0 of track 1 in another parallel worker thread of your own you must not take this new sample request as a new workload. You have to keep track which track samples are currently being worked on and ignore any sample request that pops up twice (or more).
You provide the requested sample by calling [AddTrackSample()](API\Plugins\MP4Muxer\IMP4RawMuxer\AddTrackSample)_. If this is the last sample for this track you need to set the bIsFinalSample_ flag. If you do not know that this will be the last sample at that point you can provide an empty sample on the next call with that flag set.
If during muxing an error occurs the FStatusDelegate_ will be invoked with an EStatus::Failed. Muxing will stop and you can get a human readable error message by calling GetLastError()_. When muxing is complete and the file has been successully written the FStatusDelegate will be invoked with an `EStatus::Finished_.
If you abort muxing by calling StopAndClose()_ the FStatusDelegate_ will not be invoked.
If an error occurs the partially written file will be left in place and not be deleted. This is true for the temporary file in `WebOptimized_ mode as well, which is only deleted if the optimization step has finished successfully.
| Name | Start |
| Type | function |
| Header File | /Engine/Plugins/Media/MP4Utilities/Source/MP4Muxer/Public/MP4Muxer.h |
| Include Path | #include "MP4Muxer.h" |
bool Start
(
FRequestTrackDataDelegate InSampleRequestDelegate,
FStatusDelegate InStatusDelegate
)