With this feature that is also called "transwrapping", you can trim a local file, capture a network stream to a local file, or transcode a list of files in a single file of the same or different container. Note, that for a playlist all the files should be of the same codecs and format (resolution, frame rate, etc).
The feature is based on an approach where data packets from a source (a network stream or a file) are extracted and the same packets are used to create new frames in the output file. The packets are not changed in this process. And as a result, you'll get a direct copy of your source file.
It is similar to the FFmpeg "copy" feature, but it works differently within SDKs.
Transcoding works within a single process - in this mode, the packets are processed within a single thread so they are not changed. To work in a single process, for a source object and for the received one "external_process" should be disabled. Additional settings enable direct extraction of packets and their processing.
For MPlaylist, you should set the properties directly the moment you add a file to the playlist:
m_objPlaylist.PlaylistAdd(null, openMediaFile.FileNames[i], "external_process=false experimental.mfcodecs=true experimental.out_video_packets=true experimental.out_audio_packets=true", ref nIndex, out pFile);
For MFile, the properties should be set within a FileNameSet method:
myFile.FileNameSet(pathToFile, "external_process=false experimental.mfcodecs=true experimental.out_video_packets=true experimental.out_audio_packets=true");
and for MWriter you should disable external processing:
Important! This feature works for original video sources only. Don't use any conversion, i.e. FormatVideoSet(eMFT_Convert, ...) or SourceFrameConvertedGet methods.
If you set the "experimental.out_video_packets" to "true" or "1", the video is still decoded so you can use it for preview. If you don't need the preview and you'd like to increase the overall speed of the encoding, consider setting the following:
In this case, the video and audio data is not decoded.
You should use a specific video and audio codecs for transcoding - "packets" as a video codec and "audio_packets" as an audio codec. For example, for MP4 container, the encoding configuration looks like:
format='mp4' video::codec='packets' audio::codec='audio_packets'