How To Compress Every Frame With Keyframe Property

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hdzhang
    Junior Member
    Junior Member
    • Jun 2005
    • 3

    How To Compress Every Frame With Keyframe Property

    Now, I have some avi files. Some file have key frame every 30 frame.

    and i want to compress them to be a new file which every frame is key frame.

    So I write a codec as following: (and use vitrualDub to compress file)

    __declspec(dllexport) LRESULT WINAPI DriverProc(DWORD dwDriverID, HDRVR hDriver, UINT uiMessage, LPARAM lParam1, LPARAM lParam2)
    {

    CCodec *pCodec = (CCodec *)(UINT) dwDriverID;
    //ASSERT(NULL);
    ICOPEN *icinfo = (ICOPEN *)lParam2;
    switch(uiMessage)
    {
    .......
    case ICM_COMPRESS:
    return pCodec->EncodeEncode(lParam1, lParam2);
    }
    }

    and

    long CCodec::EncodeEncode(LPARAM lParam1, LPARAM lParam2)
    {
    ICCOMPRESS *icc = (ICCOMPRESS *)lParam1;

    BITMAPV4HEADER *lpbihdr_i = (BITMAPV4HEADER *)icc->lpbiInput;
    BITMAPV4HEADER *lpbihdr_o = (BITMAPV4HEADER *)icc->lpbiOutput;

    icc->dwFlags=ICCOMPRESS_KEYFRAME; //add for KF!!!!!!!

    *icc->lpdwFlags=AVIIF_KEYFRAME; //add for KF!!!!!!!

    Convert(lpbihdr_i->bV4V4Compression, FOURCC_I420,
    (PUCHAR)icc->lpInput,
    m_pConvertBuffer,
    lpbihdr_i->bV4Width,
    lpbihdr_i->bV4Height,
    lpbihdr_i->bV4BitCount);
    CompressOneFrame(m_pConvertBuffer,*pdwDataSize);
    memcpy((PUCHAR)icc->lpOutput,puc264Picture,*pdwDataSize);

    lpbihdr_o->bV4SizeImage = *pdwDataSize;
    return ICERR_OK;
    }

    After compress the file which there is a key frame every 30 frame, the key frame in compressed file is still unchanged. in another word, there is still one key fame every 30 frame. In track bar

    How to compress every frame with setting it to be key frame?

    any answer will be appreciate!
  • Grain
    Last name? I'd rather not say, my brother's in politics.
    • Jun 2005
    • 32

    #2
    Yeah, right, right. Yeah, I'm afraid I won't be able to help you out here Buddy, good luck with it though.
    "Let's get down to brass tacks, how much for the ape?"

    Comment

    • setarip
      Retired
      • Dec 2001
      • 24955

      #3
      To hdzhang

      Welcome to the Digital Video Forums of Digital Digest!

      You'll probably get more meaningful answers by reposting your question in the "Developers/Webmasters" sub-forum here:




      If you have more questions, always feel free to ask them...

      Comment

      Working...