Old approach
There is a "second_encoder" attribute for the encoding configuration of MWriter and MFWriter objects.
You should specify
second_encoder='[YOUR_TARGET_PATH_OR_URL]'
second_encoder::format='[TARGET_CONTAINER]'
Here is an example of simultaneous UDP streaming and MP4 file capturing:
format='mp4' video::codec='n264' audio::codec='aac' second_encoder='udp://127.0.0.1:3041' second_encoder::format='mpegts'
In this case, video and audio settings are the same. The difference is only in the destination.
New approach
Since the 2.2.1 version, you can encode to more than 2 destinations at the same time using a single encoder instance.
For this, you can specify the encoding configuration like
format='mp4' stream.1::format='mp4' stream.2::format='mp4' video::codec='libopenh264'
audio::codec='aac' stream.1::path='C:\test1.mp4' stream.2::path='C:\test2.mp4'
You should set "stream.idx::format" to set a target format, and "stream.idx::path" to set the target destination. It works both for local files encoding and network streaming.
Note please that this feature is available only for MPlatform SDK and for the Ultimate Edition of MFormats SDK.