Reputation: 3614
Trying to add color space information (primary/transfer matrix/transform function) in MediaFoundation transcoding.
To set the color related attributes on
MFCreateSinkWriterFromURL(..,..,pAttributes,..)
IMFSample*
to IMFSinkWriter::WriteSample()
Only the Nvidia has color tag on output mp4 header, but AMD and Intel do not have.
How do I add the color tag for these two vendor?
Upvotes: 0
Views: 476
Reputation: 3614
Create a file sink wrapper, which internally create actual file sink by MFCreateMPEG4MediaSink
.
Set the attribute MF_MPEG4SINK_SPSPPS_PASSTHROUGH
with TRUE
to the actual media sink.
Implement IMFMediaSink
and IMFStreamSink
to hook all APIs.
The IMFStreamSink ::ProcessSample(__RPC__in_opt IMFSample *pSample)
will get the encoder output sample.
Create SinkWriter using MFCreateSinkWriterFromMediaSink()
with the wrapper.
When running, extract the raw buffer from IMFSample*
/IMFMediaBuffer*
/BYTE*
. Follow the h264 or h265 spec to insert a sps header with
Upvotes: 1