library to decode a video
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11

Thread: library to decode a video

  1. #1
    Join Date
    May 2010
    Posts
    24

    Question library to decode a video

    Hi everyone,

    I'm working in a project that uses a video as input. Today, since I don't know any decoders that works fine with "C++ Visual Studio", I'm opening a totally uncompressed file (1GB per 10 seconds of video). So, I'm gona convert my videos to any format that keeps the quality/resolution and decode it in my project. It is supposed to be very very simple, but I just couldn't find a way to do it yet...
    Does anyone here know any kind of video decoder library in C++ that works in Visual studio? It would be very helpful if it had an usage example (even better if it had a VS2008 project :-) ). I've already tried FFMpeg, but their samples are always too old (incompatible to the library versions available for download) or for Linux (several dependencies, missing headers), and I just could not build their samples... I've downloaded also the free mpeg-2 decoder from mssg, but the code is even older, and as I recall, that format had some quality restrictions.

    If it helps, I'm using Windows 7 and Visual Studio 2008.

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Fairfax, VA
    Posts
    10,888

    Re: library to decode a video

    Quote Originally Posted by leoalvesmachado View Post
    So, I'm gona convert my videos to any format that keeps the quality/resolution and decode it in my project.
    You'll need to decide whether you need complete quality retention, or merely sufficient-that-a-human-can't-tell quality retention. Lossless video codecs exist, but they won't result in nearly as much file size reduction as lossy codecs.

  3. #3
    Join Date
    May 2010
    Posts
    24

    Arrow Re: library to decode a video

    I would accept a "merely sufficient-that-a-human-can't-tell quality". My videos are already originally captured in wmv with a web-cam (Microsoft Lifecam HD5000), I convert them in the Movie Maker to uncompressed avi so I can use in my project...

    Also, one other thing, I believe the Visual Studio projects I have today in my project are incompatible to the use of MFC. If it is possible, it could avoid it - managing library conflicts are very painful to me...

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,914

    Re: library to decode a video

    What you need is transcoding software (VirtualDub or FFmpeg as example). I can't see any real need (unless there is a requirement to make the process 'visible in progress' to front user) in doing it yourself by means of some library as everybody nowadays just uses existent third party tools.
    Best regards,
    Igor

  5. #5
    Join Date
    May 2010
    Posts
    24

    Re: library to decode a video

    Thank you...
    As I told before, I've tried FFMpeg, but I could not integrate it with my C++ project (I couldn't even build their examples in the VS2008). I'll try the VirtualDub now.
    But you are right, I don't need anything special. If I can, from inside my C++ project, grab each frame from a compressed video format (any format), it would work form me - it should be a piece of cake, but I just couldn't find the way to do it.

    If you have any other suggestions it will be welcome

  6. #6
    Join Date
    Aug 2008
    Posts
    902

    Re: library to decode a video

    By utilising the DirectShow API, it is possible to create a application that will work with virtually any codec and container format, assuming the proper codecs are installed on the computer.

  7. #7
    Join Date
    May 2010
    Posts
    24

    Question Re: library to decode a video

    Chris F.
    I've found this sample:
    http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
    However, it needs the latest version of the Windows SDK. I've tried to get from the link in the site, but it is always unavailable. Is there any alternative place to get the latest Windows SDK so I can test this approach?

    Igor Vartanov
    I've searched for a C++ sample application that uses VirtualDub, but I couldn't find any. I've also posted on their forum, but I've got no answer until now. I found no sdk, or even how to use VirtualDub in my project. Do you have any hint?

  8. #8
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,914

    Re: library to decode a video

    Seems you still don't get it. You never need to build say FFmpeg, as FFmpeg guys regularly release pre-built versions. What you need is to run FFmpeg.exe as external process that would transcode your uncompressed avi to whatever you want.

    I'm working in a project that uses a video as input... So, I'm gona convert my videos to any format that keeps the quality/resolution and decode it in my project. It is supposed to be very very simple, but I just couldn't find a way to do it yet...
    This tells me not much. I can clearly see only transcoding task. Decoding thing is what I still don't get. And please avoid using 'project' word while explaining architecture things. 'Process' or 'module' would do much better for this, I believe.
    Last edited by Igor Vartanov; August 26th, 2011 at 10:20 PM.
    Best regards,
    Igor

  9. #9
    Join Date
    May 2010
    Posts
    24

    Arrow Re: library to decode a video

    Igor, I didn't try to build the whole FFMpeg project, I've tried to build a demo application using a "windows version" I've got at http://ffmpeg.zeranoe.com/builds/ and the sample code I tried to build is from http://web.me.com/dhoerl/Home/Tech_B..._sample.c.html (I've tried both codes available in this site, none of them compiled in VS2008, and I've downloaded the missing <stdint.h> and <inttypes.h>).

    And, I'm sorry for the wrong terminology I've used, I sometimes get confused with it. I don't quite know the difference between decoding and transcoding, for instance... but I believe you did understand what I need (basically, being able to read the file and get each frame of the video)...

  10. #10
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,914

    Re: library to decode a video

    Please go through wiki article. It says:
    ffmpeg is a command line tool to convert one video file format to another. It can also grab and encode in real time from a TV card.
    Video essence conversion is transcoding. Video container conversion is re-muxing. In your case you need transcoding (uncompressed avi to target codec compression) and possibly re-muxing (re-packing from avi to target container format, TS or MKV for example). These transcoding and re-muxing could be achieved by means of single ffmpeg command tool.

    read the file and get each frame of the video
    This needs demuxing converted file's video stream and positioning on particular frame and decoding it. FFmpeg libraries really would be in help.
    Best regards,
    Igor

  11. #11
    Join Date
    May 2010
    Posts
    24

    Resolved Re: library to decode a video

    Hi everyone,
    I figured out how to do it in a very easy way. I'm sharing if anyone else needs it.
    I'm using OpenCV.
    Here is some samples:
    http://www.cs.iit.edu/~agam/cs512/le...00000000000000
    http://nashruddin.com/How_to_Play_AVI_Files_with_OpenCV

    Thanks a lot for all your help.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center