none
MFCreateSinkWriterFromURL creates mp4 file with wrong duration RRS feed

  • Question

  • Hello,

    I'm using MFCreateSinkWriterFromURL to create an mp4 file from an existing audio/video stream. By existing, I mean the capture is started before the sink writer and the stream is already sent to a remote host.

    What I try to achieve is to record the stream sent to the remote host into an mp4 file. So I use the MFCreateSinkWriterFromURL to create a SinkWriter, I wait for the first I-Frame by checking the attribute MFSampleExtension_CleanPoint, and then I start the recording with IMfSinkWriter::BeginWriting.

    The problem is that the duration of the mp4 file depends on the duration of the stream that comes from the webcam.

    So for example, if I start the webcam capture, wait for 3 minutes. Then start to record the stream into an mp4 file and wait for 30 seconds. The length of video (as displayed in VLC and ffplay) is 3 minutes and 30 seconds (and it should be 30 seconds).

    I tried to reset the SampleTime on the IMFSample and make it starts at 0. I also tried to set the MFSampleExtension_Discontinuity attribute on the first video IMFSample. I have logged into a text file the duration and timestamp of all samples that should be written into the mp4 file, and it seems right.

    Any idea on what could be wrong? Thanks for your help.


    Wednesday, October 3, 2018 3:41 PM

All replies

  • Hi,

    Did you managed to slove your issue? We ran into something similar and wondering what it might be.

    Cheers

    Balazs

    Thursday, February 20, 2020 9:25 AM