locked
a performace of IMFSinkWriter ??? (about encoding speed) RRS feed

  • Question

  • I developed an encoder using IMFSinkWriter(wmv + wma => wmv file). (http://msdn.microsoft.com/en-us/library/windows/desktop/ff819477(v=vs.85).aspx)

    but I'm facing a problem. It is a performance of the encoder. My encoder processes 20 frames per 1 second . It is too slow

    target resolution is 1280x720 and target bitrate is 3.5Mbps. And my computer's spec. are i5-2500 CPU(3.3Ghz) and 24GB memory. OS is Windows 7(64bits).

    How can I improve my encoder's performance?

    Thursday, October 24, 2013 9:08 AM

Answers

  • Ok,

    i reread your question. The first time i was flying over it without opening the link, and it seems that you just started encoding with media foundation. 

    Firstly, you havnt developed a encoder. What you learned from this tutorial is to use the sink writer object for simplified encoding of audio and video. The sink writer is a very high level object/class that has a lot of internal code doing the job for you. There are pros and cons like with encoder settings, it might simplify encoding a lot for you but it also has restrictions.

    When it comes to encoder settings the sink writer is very limited, and unless you want to use your app only on Windows 8 you have not much possibilitys to configure a encoder. If you want to use your app only on Windows 8 then you can take MF_SINK_WRITER_ENCODER_CONFIG.

    Now to the second thing. The computers these days making only small steps in performance from generation to generation. Unless you are using a special co-processor, or specificly designed pipeline in the CPU or the GPU of your graphicscard, the encoding speed is nearly the same from sandy bridge upwards on every CPU. Your i5 is a good processor, and even if you could gain 2-3 fps more on the same settings on an i7, the only way to realy change encoding speed is to alter the encoder settings.

    Hope this clarifies your question

    regards

    coOKie

    • Marked as answer by Codec Beginner Friday, November 22, 2013 6:24 AM
    Thursday, October 31, 2013 7:58 PM

All replies

  • Hi,

    for what purpose you need the higher encoding speed ? You doing live encoding, or you simply want to speed up the encoding process a bit ?

    If you are doing live encoding you should set the complexity of the encoding algorithm to 0, that alone helps a lot. In addition you could set the quantizers and the number of threads the encoder uses.

    There are pros and cons about the encoding complexity, same goes for the different quantizers. For non-live-recording you would typicaly try to archieve the best image quality and a good compression. For live recording it would be the opposite, namely sacrificing a bit of image quality and omit compression for getting more encoding speed. For non-live encoding i wouldnt go down to complexity 0 ( default is 3 ), and would also let the frame quantizer at default or slightly above.

    Another way to get speed for non-live recording is using Asynchronous write operations. Lets say you encode video and audio, then you could seperate both encodings into parallel running threads writing to two different streams, and then when you are finish you can mux both streams together. Maybe its even possible to write to the same stream from different threads using IMFByteStream->BeginWriting, thats what i am researching at the moment.

    It all depends on what type of encoding you are doing.

    regards

    coOKie


    • Edited by Francis Grave Thursday, October 31, 2013 2:46 PM edit
    Thursday, October 31, 2013 2:39 PM
  • Ok,

    i reread your question. The first time i was flying over it without opening the link, and it seems that you just started encoding with media foundation. 

    Firstly, you havnt developed a encoder. What you learned from this tutorial is to use the sink writer object for simplified encoding of audio and video. The sink writer is a very high level object/class that has a lot of internal code doing the job for you. There are pros and cons like with encoder settings, it might simplify encoding a lot for you but it also has restrictions.

    When it comes to encoder settings the sink writer is very limited, and unless you want to use your app only on Windows 8 you have not much possibilitys to configure a encoder. If you want to use your app only on Windows 8 then you can take MF_SINK_WRITER_ENCODER_CONFIG.

    Now to the second thing. The computers these days making only small steps in performance from generation to generation. Unless you are using a special co-processor, or specificly designed pipeline in the CPU or the GPU of your graphicscard, the encoding speed is nearly the same from sandy bridge upwards on every CPU. Your i5 is a good processor, and even if you could gain 2-3 fps more on the same settings on an i7, the only way to realy change encoding speed is to alter the encoder settings.

    Hope this clarifies your question

    regards

    coOKie

    • Marked as answer by Codec Beginner Friday, November 22, 2013 6:24 AM
    Thursday, October 31, 2013 7:58 PM