Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to save all frames from a video file as a jpeg image

how to save all frames from a video file as a jpeg image

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestiontutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sunita ramesh
    wrote on last edited by
    #1

    Hi all, I want to save each frame from a video file(.cam).I wrote the following coding to get the image. CFile cf; CString filename; int xu_flag; BITMAPFILEHEADER xufileheader; char * xu_sp; long outputlen; filename = "c:\\temp\\test.jpg"; xufileheader.bfOffBits = 54; xufileheader.bfSize = xu_newwidth * xu_newheight * 3 + sizeof(BITMAPINFOHEADER) +sizeof(BITMAPFILEHEADER); xufileheader.bfType = 0x4d42; xu_sp = new char [xu_newwidth * xu_newheight * 3+ sizeof(BITMAPINFOHEADER) + sizeof(BITMAPFILEHEADER)]; outputlen = xu_newwidth * xu_newheight * 3 + sizeof(BITMAPINFOHEADER) + sizeof(BITMAPFILEHEADER); memcpy(xu_sp, &xufileheader, sizeof(BITMAPFILEHEADER)); memcpy(xu_sp + sizeof(BITMAPFILEHEADER), xu_buff, (xu_newwidth * xu_newheight * 3 + sizeof(BITMAPINFOHEADER))); xu_flag = cf.Open(filename, CFile::modeCreate | CFile::modeWrite); cf.WriteHuge(xu_sp, outputlen); cf.Close(); But my problem is,I can able to catch only one frame at a time.But i need to save all the frames. How do i acheive this? help me please sunita ramesh

    K P 2 Replies Last reply
    0
    • S sunita ramesh

      Hi all, I want to save each frame from a video file(.cam).I wrote the following coding to get the image. CFile cf; CString filename; int xu_flag; BITMAPFILEHEADER xufileheader; char * xu_sp; long outputlen; filename = "c:\\temp\\test.jpg"; xufileheader.bfOffBits = 54; xufileheader.bfSize = xu_newwidth * xu_newheight * 3 + sizeof(BITMAPINFOHEADER) +sizeof(BITMAPFILEHEADER); xufileheader.bfType = 0x4d42; xu_sp = new char [xu_newwidth * xu_newheight * 3+ sizeof(BITMAPINFOHEADER) + sizeof(BITMAPFILEHEADER)]; outputlen = xu_newwidth * xu_newheight * 3 + sizeof(BITMAPINFOHEADER) + sizeof(BITMAPFILEHEADER); memcpy(xu_sp, &xufileheader, sizeof(BITMAPFILEHEADER)); memcpy(xu_sp + sizeof(BITMAPFILEHEADER), xu_buff, (xu_newwidth * xu_newheight * 3 + sizeof(BITMAPINFOHEADER))); xu_flag = cf.Open(filename, CFile::modeCreate | CFile::modeWrite); cf.WriteHuge(xu_sp, outputlen); cf.Close(); But my problem is,I can able to catch only one frame at a time.But i need to save all the frames. How do i acheive this? help me please sunita ramesh

      K Offline
      K Offline
      kk tvm
      wrote on last edited by
      #2

      Hi Sunita Examples on Video available in MSDN CD at \SDK\GRAPHICS\VIDEO Try KK

      1 Reply Last reply
      0
      • S sunita ramesh

        Hi all, I want to save each frame from a video file(.cam).I wrote the following coding to get the image. CFile cf; CString filename; int xu_flag; BITMAPFILEHEADER xufileheader; char * xu_sp; long outputlen; filename = "c:\\temp\\test.jpg"; xufileheader.bfOffBits = 54; xufileheader.bfSize = xu_newwidth * xu_newheight * 3 + sizeof(BITMAPINFOHEADER) +sizeof(BITMAPFILEHEADER); xufileheader.bfType = 0x4d42; xu_sp = new char [xu_newwidth * xu_newheight * 3+ sizeof(BITMAPINFOHEADER) + sizeof(BITMAPFILEHEADER)]; outputlen = xu_newwidth * xu_newheight * 3 + sizeof(BITMAPINFOHEADER) + sizeof(BITMAPFILEHEADER); memcpy(xu_sp, &xufileheader, sizeof(BITMAPFILEHEADER)); memcpy(xu_sp + sizeof(BITMAPFILEHEADER), xu_buff, (xu_newwidth * xu_newheight * 3 + sizeof(BITMAPINFOHEADER))); xu_flag = cf.Open(filename, CFile::modeCreate | CFile::modeWrite); cf.WriteHuge(xu_sp, outputlen); cf.Close(); But my problem is,I can able to catch only one frame at a time.But i need to save all the frames. How do i acheive this? help me please sunita ramesh

        P Offline
        P Offline
        Phil C
        wrote on last edited by
        #3

        Maybe I'm missing something here, but jpg files aren't made to store movies. The jpg file format is only able to store one frame of image data. You need to use another format, AVI, WMF, Quicktime, Realvideo, Tiff...if you want to store multiple frames. On the other hand, if you save each frame to a separate jpg file then it will work, but then you'll have to deal with all those jpg's and find or make a player that can play them back in sequence.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups