Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9031205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:40:22+00:00 2026-06-16T07:40:22+00:00

I am trying to read an AVI file using openCV. After getting the capture,

  • 0

I am trying to read an AVI file using openCV. After getting the capture, the problem comes when I give a condition to the while loop which governs the extent to which queryFrame will be done.
There are total 1251 frames in the video.

When I use while (counter <= number_of_frames), the video runs fine and,
when I use while (cvQueryFrame(capture)), the video runs fine till 200-250th frame, then suddenly it starts running faster and finishes by 625th frame. I printed the FPS, it remains same all the time.

Why is this happening ??
Please help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T07:40:23+00:00Added an answer on June 16, 2026 at 7:40 am

    try the following…

    C style reading..

    #include <opencv2/video/video.hpp>
    #include <opencv2/core/core.hpp>
    #include <opencv2/highgui/highgui.hpp>
    #include <opencv2/imgproc/imgproc.hpp>
    
    using namespace cv;
    
    int main()
    {
      CvCapture *video;
      video = cvCreateFileCapture("ADDRESS TO THE FILE");
      IplImage *frame;
    
      while(true)
      {
        frame = cvQueryFrame(video);
        if(frame->imageData==NULL)
          {
            std::cout<<"END OF VIDEO"<<std::endl;
            break;
          }
        cvShowImage("VIDEO",frame);
        cvWiatKey(25);//SINCE MOST OF THE VIDEOS RUN AT 25 FPS
       }
      return 0;
    }
    

    C++ STYLE….

    int main()
    {
      VideoCapture video("ADDRESS OF VIDEO");
      Mat frame;
    
      while(true)
      {
        video >> frame;
        if(frame.data==NULL)
          {
             std::cout<<"END OF VIDEO FILE"<<std::endl;
             break;
          }
        imshow("VIDEO",frame);
        waitKey(25);
       }
    return 0;
    }
    

    try this…and check if it gives an uniform rate of play…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to do VideoCapture cap (../video.avi); Getting an error: Couldn't read movie file
I am trying to read a movie file with .avi extension using mmreader(), it
While trying to read an xls file using jExcelAPI, I find that the library
I am trying to read in a file, find the string myprop and after
When trying to read a RSA private key from a file using the method
I am having a problem when creating an avi file using Matlab. My aim
am trying to read few lines from a txt file using JS,and i have
Trying to read an RSS and select information using Linq but can't seem to
Trying to read headers for a csv file with: reader = csv.DictReader(open(PATH_FILE),skipinitialspace=True) headers =
After trying to read various articles on sending emails with attachments in PHP (I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.