locked
Game based on video playback - Best codecs RRS feed

  • Question

  • Hi,

    I'm developping an arcarde game based on video playback (with sound integrated). I would like to know what is the best video/audio format for this ?

    From now the best format I've found is the MPEG4 (image quality for file size). But I have a major problem with it. To read it I'm using the free codecs "ffdshow" and renderless VMR9 mode. But the TIME_FORMAT_FRAME time format isn't supported/implemented. Thus, I cannot seek by frame, but only in REFERENCE_TIME.

    This is complicated to get the REFERENCE_TIME of each sequence in the movie...

    So I've look on google for a way to convert REFERENCE_TIME to key frame but without succes. Is there any way to get the frame rate per seconds ? Maybe from there I should calculate the frame position ?

    Tuesday, February 16, 2010 6:33 AM

Answers

  • AFAIK AVI files are the only common format that supports frame seeking.  AVI files can contain video in just about any format including Divx, Xvid, WMV.  Note that codecs don't implement seeking, it is dependent on the container file splitter filter, e.g. AVI Splitter.

    You can get the frame rate of most file containers using IMediaDet.

    www.chrisnet.net
    • Marked as answer by Erakis Thursday, February 18, 2010 8:22 PM
    Wednesday, February 17, 2010 2:58 PM

All replies

  • You've got much bigger problems in terms of licensing.  Distribution of an MPEG-4 decoder has license fees attached, although the fees are waived if you distribute less than 50,000 copies.  Regardless of how many copies you distribute you need to sign on with MPEG-LA as a licensee and report your numbers to them.  You're alternative is to use a video codec that is already installed and available on the target computer (an MPEG-4 decoder is available pre-installed only on Vista and Windows 7) such as WMV or to use a freely distributable codec such as Theora/VP6.

    As far as converting frame position to a time value, this is only possible if the frame rate is constant.  If you have a fixed frame rate then the conversion is straight forward.

    // frame position to REFERENCE_TIME
    double dFrameRate = ...;  // frames per second
    int iFramePos = ...;
    REFERENCE_TIME rtPos = (UNITS / dFrameRate) * iFramePos;


    www.chrisnet.net
    Tuesday, February 16, 2010 3:35 PM
  • Hi Chris P,

    It's a really good point, thank you. I did not know Theora/VP6 format, it seems to be an flash movie (flv) ? I did not found any video sample on internet.

    Is it two different formats? Or is the Theora format and VP6 is another one ?

    I play an MOV (H.264) file with the QuickTime player and I noticed that as display time it proposed either time (hh:mm:ss) or the frame number. How they do that ?

    Also, is there a way to get the frame per seconds from a video file ? Is there any properties/interfaces/functions that DirectShow provide ? I mean

    When I play an MPEG4 file with BSPlayer, I see it display the video time (hh: mm: ss), the frame number, samples played. I know it uses the ffdshow filter because I see the icons in the "taskbar notification area". Thus if the filter does not support the time format "TIME_FORMAT_SAMPLE" then how BSPlayer deduct the frame per second ?

    Best regards,


    Tuesday, February 16, 2010 6:48 PM
  • Theora and VP6 are the same thing.  Theora is what they named the On2 VP6 codec when it was made open source and incorporated into the Xiph Ogg project.  You can get more info about that project here: http://www.xiph.org/ and a DirectShow filter set from the download page.

    MP4 files have an average frame rate but not necessarily a constant frame rate.  You can extract the average fps information from the header.

    www.chrisnet.net
    Tuesday, February 16, 2010 7:34 PM
  • Hi Chris P,

    Is there any format that allows to seek by FRAME?
    I tried MPEG2, WMV, DIVX, XVID, etc... I used the "IsFormatSupported (&TIME_FORMAT_FRAME)" function and it says every time that it's not implemented. Thus none of these support frame seeking operations.

    I will have resigned myself to use milliseconds calculated from REFERENCE_TIME...

    Thank you for Theora codec, I have read a little bit on it but as I'm new to DirectShow, I'm not sure I understood everything. This format has several encoders for audio and video ? This is not only ; 1 filter for audio + 1 filter for video ? Do you know if the theory codecs support frame seeking operation ?

    I've read somewhere that to get the frame rate of a video, we must use a grabber. Does it make sens ? If yes, then I need to plug it (pins) between my video decoder and the video renderer ?

    Best regards,
    Martin
    Wednesday, February 17, 2010 2:11 AM
  • AFAIK AVI files are the only common format that supports frame seeking.  AVI files can contain video in just about any format including Divx, Xvid, WMV.  Note that codecs don't implement seeking, it is dependent on the container file splitter filter, e.g. AVI Splitter.

    You can get the frame rate of most file containers using IMediaDet.

    www.chrisnet.net
    • Marked as answer by Erakis Thursday, February 18, 2010 8:22 PM
    Wednesday, February 17, 2010 2:58 PM