video files are not open and capture.....

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

video files are not open and capture.....

muhammadjahanzaibkhan89
Hi, i trying to open the video files but not open files.But the same code works well with webcam.
 videos have the same path as application.
 

  kindly solve my problem.Thanku.
 

 this the code.
 

 
 

 #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <iostream> using namespace cv;using namespace std;

int main(){ VideoCapture cap("fffff.avi"); if ( !cap.isOpened() ) { cout << "Cannot open the file" << endl; return -1; } while(true){ Mat cameraFrame; cap.read(cameraFrame); if (cameraFrame.empty()) continue; if (!cameraFrame.empty()) { imshow("window", cameraFrame); } waitKey(33); } cap.release(); destroyWindow("cameraFrame");

 }  
Reply | Threaded
Open this post in threaded view
|

Re: video files are not open and capture.....

Bob Davies
What is the current directory?  If it contains the avi file, it would work.
Reply | Threaded
Open this post in threaded view
|

Re: video files are not open and capture.....

Fábián Kristóf - Szabolcs
In reply to this post by muhammadjahanzaibkhan89
Are you sure you're running the executable from the same directory? If your source is in the same directory with the video file and your executable isn't then it won't work.


________________________________
Feladó: [hidden email] <[hidden email]>, meghatalmazó: [hidden email] [OpenCV] <[hidden email]>
Elküldve: 2017. november 29. 13:59
Címzett: [hidden email]
Tárgy: [OpenCV] video files are not open and capture.....



Hi, i trying to open the video files but not open files.But the same code works well with webcam.

videos have the same path as application.


 kindly solve my problem.Thanku.


this the code.






#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace cv;

using namespace std;

int main(){

          VideoCapture cap("fffff.avi");
           if ( !cap.isOpened() )
        {
            cout << "Cannot open the file" << endl;
            return -1;
        }
    while(true){

        Mat cameraFrame;

        cap.read(cameraFrame);
        if (cameraFrame.empty())
                  continue;
        if (!cameraFrame.empty()) {
          imshow("window", cameraFrame);
           }

        waitKey(33);


}
     cap.release();
     destroyWindow("cameraFrame");


 }




Reply | Threaded
Open this post in threaded view
|

Re: video files are not open and capture.....

muhammadjahanzaibkhan89
yes video file and source in the same directory.But it not works. 

    On Wednesday, November 29, 2017 9:00 AM, "Fábián Kristóf - Szabolcs [hidden email] [OpenCV]" <[hidden email]> wrote:
 

     Are you sure you're running the executable from the same directory? If your source is in the same directory with the video file and your executable isn't then it won't work. 

Feladó: [hidden email] <[hidden email]>, meghatalmazó: [hidden email] [OpenCV] <[hidden email]>
Elküldve: 2017. november 29. 13:59
Címzett: [hidden email]
Tárgy: [OpenCV] video files are not open and capture.....  Hi, i trying to open the video files but not open files.But the same code works well with webcam.videos have the same path as application.
 kindly solve my problem.Thanku.
this the code.
 

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace cv;using namespace std;

int main(){          VideoCapture cap("fffff.avi");
           if ( !cap.isOpened() )
        {
            cout << "Cannot open the file" << endl;
            return -1;
        }
    while(true){

        Mat cameraFrame;

        cap.read(cameraFrame);
        if (cameraFrame.empty())
                  continue;
        if (!cameraFrame.empty()) {
          imshow("window", cameraFrame);
           }

        waitKey(33);


}
     cap.release();
     destroyWindow("cameraFrame");

 }   #yiv2663864560 #yiv2663864560 -- #yiv2663864560ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv2663864560 #yiv2663864560ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv2663864560 #yiv2663864560ygrp-mkp #yiv2663864560hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv2663864560 #yiv2663864560ygrp-mkp #yiv2663864560ads {margin-bottom:10px;}#yiv2663864560 #yiv2663864560ygrp-mkp .yiv2663864560ad {padding:0 0;}#yiv2663864560 #yiv2663864560ygrp-mkp .yiv2663864560ad p {margin:0;}#yiv2663864560 #yiv2663864560ygrp-mkp .yiv2663864560ad a {color:#0000ff;text-decoration:none;}#yiv2663864560 #yiv2663864560ygrp-sponsor #yiv2663864560ygrp-lc {font-family:Arial;}#yiv2663864560 #yiv2663864560ygrp-sponsor #yiv2663864560ygrp-lc #yiv2663864560hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv2663864560 #yiv2663864560ygrp-sponsor #yiv2663864560ygrp-lc .yiv2663864560ad {margin-bottom:10px;padding:0 0;}#yiv2663864560 #yiv2663864560actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv2663864560 #yiv2663864560activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv2663864560 #yiv2663864560activity span {font-weight:700;}#yiv2663864560 #yiv2663864560activity span:first-child {text-transform:uppercase;}#yiv2663864560 #yiv2663864560activity span a {color:#5085b6;text-decoration:none;}#yiv2663864560 #yiv2663864560activity span span {color:#ff7900;}#yiv2663864560 #yiv2663864560activity span .yiv2663864560underline {text-decoration:underline;}#yiv2663864560 .yiv2663864560attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv2663864560 .yiv2663864560attach div a {text-decoration:none;}#yiv2663864560 .yiv2663864560attach img {border:none;padding-right:5px;}#yiv2663864560 .yiv2663864560attach label {display:block;margin-bottom:5px;}#yiv2663864560 .yiv2663864560attach label a {text-decoration:none;}#yiv2663864560 blockquote {margin:0 0 0 4px;}#yiv2663864560 .yiv2663864560bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv2663864560 .yiv2663864560bold a {text-decoration:none;}#yiv2663864560 dd.yiv2663864560last p a {font-family:Verdana;font-weight:700;}#yiv2663864560 dd.yiv2663864560last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv2663864560 dd.yiv2663864560last p span.yiv2663864560yshortcuts {margin-right:0;}#yiv2663864560 div.yiv2663864560attach-table div div a {text-decoration:none;}#yiv2663864560 div.yiv2663864560attach-table {width:400px;}#yiv2663864560 div.yiv2663864560file-title a, #yiv2663864560 div.yiv2663864560file-title a:active, #yiv2663864560 div.yiv2663864560file-title a:hover, #yiv2663864560 div.yiv2663864560file-title a:visited {text-decoration:none;}#yiv2663864560 div.yiv2663864560photo-title a, #yiv2663864560 div.yiv2663864560photo-title a:active, #yiv2663864560 div.yiv2663864560photo-title a:hover, #yiv2663864560 div.yiv2663864560photo-title a:visited {text-decoration:none;}#yiv2663864560 div#yiv2663864560ygrp-mlmsg #yiv2663864560ygrp-msg p a span.yiv2663864560yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv2663864560 .yiv2663864560green {color:#628c2a;}#yiv2663864560 .yiv2663864560MsoNormal {margin:0 0 0 0;}#yiv2663864560 o {font-size:0;}#yiv2663864560 #yiv2663864560photos div {float:left;width:72px;}#yiv2663864560 #yiv2663864560photos div div {border:1px solid #666666;min-height:62px;overflow:hidden;width:62px;}#yiv2663864560 #yiv2663864560photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv2663864560 #yiv2663864560reco-category {font-size:77%;}#yiv2663864560 #yiv2663864560reco-desc {font-size:77%;}#yiv2663864560 .yiv2663864560replbq {margin:4px;}#yiv2663864560 #yiv2663864560ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv2663864560 #yiv2663864560ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv2663864560 #yiv2663864560ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv2663864560 #yiv2663864560ygrp-mlmsg select, #yiv2663864560 input, #yiv2663864560 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv2663864560 #yiv2663864560ygrp-mlmsg pre, #yiv2663864560 code {font:115% monospace;}#yiv2663864560 #yiv2663864560ygrp-mlmsg * {line-height:1.22em;}#yiv2663864560 #yiv2663864560ygrp-mlmsg #yiv2663864560logo {padding-bottom:10px;}#yiv2663864560 #yiv2663864560ygrp-msg p a {font-family:Verdana;}#yiv2663864560 #yiv2663864560ygrp-msg p#yiv2663864560attach-count span {color:#1E66AE;font-weight:700;}#yiv2663864560 #yiv2663864560ygrp-reco #yiv2663864560reco-head {color:#ff7900;font-weight:700;}#yiv2663864560 #yiv2663864560ygrp-reco {margin-bottom:20px;padding:0px;}#yiv2663864560 #yiv2663864560ygrp-sponsor #yiv2663864560ov li a {font-size:130%;text-decoration:none;}#yiv2663864560 #yiv2663864560ygrp-sponsor #yiv2663864560ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv2663864560 #yiv2663864560ygrp-sponsor #yiv2663864560ov ul {margin:0;padding:0 0 0 8px;}#yiv2663864560 #yiv2663864560ygrp-text {font-family:Georgia;}#yiv2663864560 #yiv2663864560ygrp-text p {margin:0 0 1em 0;}#yiv2663864560 #yiv2663864560ygrp-text tt {font-size:120%;}#yiv2663864560 #yiv2663864560ygrp-vital ul li:last-child {border-right:none !important;}#yiv2663864560

   
Reply | Threaded
Open this post in threaded view
|

Re: video files are not open and capture.....

muhammadjahanzaibkhan89
In reply to this post by Bob Davies
it not wort both are in same directory source and video file.

    On Wednesday, November 29, 2017 7:55 AM, "Bob Davies [hidden email] [OpenCV]" <[hidden email]> wrote:
 

     What is the current directory?  If it contains the avi file, it would work.  #yiv3659882983 #yiv3659882983 -- #yiv3659882983ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv3659882983 #yiv3659882983ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv3659882983 #yiv3659882983ygrp-mkp #yiv3659882983hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv3659882983 #yiv3659882983ygrp-mkp #yiv3659882983ads {margin-bottom:10px;}#yiv3659882983 #yiv3659882983ygrp-mkp .yiv3659882983ad {padding:0 0;}#yiv3659882983 #yiv3659882983ygrp-mkp .yiv3659882983ad p {margin:0;}#yiv3659882983 #yiv3659882983ygrp-mkp .yiv3659882983ad a {color:#0000ff;text-decoration:none;}#yiv3659882983 #yiv3659882983ygrp-sponsor #yiv3659882983ygrp-lc {font-family:Arial;}#yiv3659882983 #yiv3659882983ygrp-sponsor #yiv3659882983ygrp-lc #yiv3659882983hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv3659882983 #yiv3659882983ygrp-sponsor #yiv3659882983ygrp-lc .yiv3659882983ad {margin-bottom:10px;padding:0 0;}#yiv3659882983 #yiv3659882983actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv3659882983 #yiv3659882983activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv3659882983 #yiv3659882983activity span {font-weight:700;}#yiv3659882983 #yiv3659882983activity span:first-child {text-transform:uppercase;}#yiv3659882983 #yiv3659882983activity span a {color:#5085b6;text-decoration:none;}#yiv3659882983 #yiv3659882983activity span span {color:#ff7900;}#yiv3659882983 #yiv3659882983activity span .yiv3659882983underline {text-decoration:underline;}#yiv3659882983 .yiv3659882983attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv3659882983 .yiv3659882983attach div a {text-decoration:none;}#yiv3659882983 .yiv3659882983attach img {border:none;padding-right:5px;}#yiv3659882983 .yiv3659882983attach label {display:block;margin-bottom:5px;}#yiv3659882983 .yiv3659882983attach label a {text-decoration:none;}#yiv3659882983 blockquote {margin:0 0 0 4px;}#yiv3659882983 .yiv3659882983bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv3659882983 .yiv3659882983bold a {text-decoration:none;}#yiv3659882983 dd.yiv3659882983last p a {font-family:Verdana;font-weight:700;}#yiv3659882983 dd.yiv3659882983last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv3659882983 dd.yiv3659882983last p span.yiv3659882983yshortcuts {margin-right:0;}#yiv3659882983 div.yiv3659882983attach-table div div a {text-decoration:none;}#yiv3659882983 div.yiv3659882983attach-table {width:400px;}#yiv3659882983 div.yiv3659882983file-title a, #yiv3659882983 div.yiv3659882983file-title a:active, #yiv3659882983 div.yiv3659882983file-title a:hover, #yiv3659882983 div.yiv3659882983file-title a:visited {text-decoration:none;}#yiv3659882983 div.yiv3659882983photo-title a, #yiv3659882983 div.yiv3659882983photo-title a:active, #yiv3659882983 div.yiv3659882983photo-title a:hover, #yiv3659882983 div.yiv3659882983photo-title a:visited {text-decoration:none;}#yiv3659882983 div#yiv3659882983ygrp-mlmsg #yiv3659882983ygrp-msg p a span.yiv3659882983yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv3659882983 .yiv3659882983green {color:#628c2a;}#yiv3659882983 .yiv3659882983MsoNormal {margin:0 0 0 0;}#yiv3659882983 o {font-size:0;}#yiv3659882983 #yiv3659882983photos div {float:left;width:72px;}#yiv3659882983 #yiv3659882983photos div div {border:1px solid #666666;min-height:62px;overflow:hidden;width:62px;}#yiv3659882983 #yiv3659882983photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv3659882983 #yiv3659882983reco-category {font-size:77%;}#yiv3659882983 #yiv3659882983reco-desc {font-size:77%;}#yiv3659882983 .yiv3659882983replbq {margin:4px;}#yiv3659882983 #yiv3659882983ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv3659882983 #yiv3659882983ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv3659882983 #yiv3659882983ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv3659882983 #yiv3659882983ygrp-mlmsg select, #yiv3659882983 input, #yiv3659882983 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv3659882983 #yiv3659882983ygrp-mlmsg pre, #yiv3659882983 code {font:115% monospace;}#yiv3659882983 #yiv3659882983ygrp-mlmsg * {line-height:1.22em;}#yiv3659882983 #yiv3659882983ygrp-mlmsg #yiv3659882983logo {padding-bottom:10px;}#yiv3659882983 #yiv3659882983ygrp-msg p a {font-family:Verdana;}#yiv3659882983 #yiv3659882983ygrp-msg p#yiv3659882983attach-count span {color:#1E66AE;font-weight:700;}#yiv3659882983 #yiv3659882983ygrp-reco #yiv3659882983reco-head {color:#ff7900;font-weight:700;}#yiv3659882983 #yiv3659882983ygrp-reco {margin-bottom:20px;padding:0px;}#yiv3659882983 #yiv3659882983ygrp-sponsor #yiv3659882983ov li a {font-size:130%;text-decoration:none;}#yiv3659882983 #yiv3659882983ygrp-sponsor #yiv3659882983ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv3659882983 #yiv3659882983ygrp-sponsor #yiv3659882983ov ul {margin:0;padding:0 0 0 8px;}#yiv3659882983 #yiv3659882983ygrp-text {font-family:Georgia;}#yiv3659882983 #yiv3659882983ygrp-text p {margin:0 0 1em 0;}#yiv3659882983 #yiv3659882983ygrp-text tt {font-size:120%;}#yiv3659882983 #yiv3659882983ygrp-vital ul li:last-child {border-right:none !important;}#yiv3659882983

   
Reply | Threaded
Open this post in threaded view
|

Re: video files are not open and capture..... [1 Attachment]

muhammadjahanzaibkhan89

i tried my best from some days but not get any result.I hope  opencv experts solve my problem.And help me in learning opencv. Thanks mr.Fábián Kristóf  for giving your important time.And also thanku Bob Davies.
This is the hole project.
 

    On Wednesday, November 29, 2017 10:48 AM, "muhammad jahanzaib khan [hidden email] [OpenCV]" <[hidden email]> wrote:
 

     it not wort both are in same directory source and video file.

    On Wednesday, November 29, 2017 7:55 AM, "Bob Davies [hidden email] [OpenCV]" <[hidden email]> wrote:
 

     What is the current directory?  If it contains the avi file, it would work.  

     #yiv6514525653 #yiv6514525653 -- #yiv6514525653ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv6514525653 #yiv6514525653ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv6514525653 #yiv6514525653ygrp-mkp #yiv6514525653hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv6514525653 #yiv6514525653ygrp-mkp #yiv6514525653ads {margin-bottom:10px;}#yiv6514525653 #yiv6514525653ygrp-mkp .yiv6514525653ad {padding:0 0;}#yiv6514525653 #yiv6514525653ygrp-mkp .yiv6514525653ad p {margin:0;}#yiv6514525653 #yiv6514525653ygrp-mkp .yiv6514525653ad a {color:#0000ff;text-decoration:none;}#yiv6514525653 #yiv6514525653ygrp-sponsor #yiv6514525653ygrp-lc {font-family:Arial;}#yiv6514525653 #yiv6514525653ygrp-sponsor #yiv6514525653ygrp-lc #yiv6514525653hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv6514525653 #yiv6514525653ygrp-sponsor #yiv6514525653ygrp-lc .yiv6514525653ad {margin-bottom:10px;padding:0 0;}#yiv6514525653 #yiv6514525653actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv6514525653 #yiv6514525653activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv6514525653 #yiv6514525653activity span {font-weight:700;}#yiv6514525653 #yiv6514525653activity span:first-child {text-transform:uppercase;}#yiv6514525653 #yiv6514525653activity span a {color:#5085b6;text-decoration:none;}#yiv6514525653 #yiv6514525653activity span span {color:#ff7900;}#yiv6514525653 #yiv6514525653activity span .yiv6514525653underline {text-decoration:underline;}#yiv6514525653 .yiv6514525653attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv6514525653 .yiv6514525653attach div a {text-decoration:none;}#yiv6514525653 .yiv6514525653attach img {border:none;padding-right:5px;}#yiv6514525653 .yiv6514525653attach label {display:block;margin-bottom:5px;}#yiv6514525653 .yiv6514525653attach label a {text-decoration:none;}#yiv6514525653 blockquote {margin:0 0 0 4px;}#yiv6514525653 .yiv6514525653bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv6514525653 .yiv6514525653bold a {text-decoration:none;}#yiv6514525653 dd.yiv6514525653last p a {font-family:Verdana;font-weight:700;}#yiv6514525653 dd.yiv6514525653last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv6514525653 dd.yiv6514525653last p span.yiv6514525653yshortcuts {margin-right:0;}#yiv6514525653 div.yiv6514525653attach-table div div a {text-decoration:none;}#yiv6514525653 div.yiv6514525653attach-table {width:400px;}#yiv6514525653 div.yiv6514525653file-title a, #yiv6514525653 div.yiv6514525653file-title a:active, #yiv6514525653 div.yiv6514525653file-title a:hover, #yiv6514525653 div.yiv6514525653file-title a:visited {text-decoration:none;}#yiv6514525653 div.yiv6514525653photo-title a, #yiv6514525653 div.yiv6514525653photo-title a:active, #yiv6514525653 div.yiv6514525653photo-title a:hover, #yiv6514525653 div.yiv6514525653photo-title a:visited {text-decoration:none;}#yiv6514525653 div#yiv6514525653ygrp-mlmsg #yiv6514525653ygrp-msg p a span.yiv6514525653yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv6514525653 .yiv6514525653green {color:#628c2a;}#yiv6514525653 .yiv6514525653MsoNormal {margin:0 0 0 0;}#yiv6514525653 o {font-size:0;}#yiv6514525653 #yiv6514525653photos div {float:left;width:72px;}#yiv6514525653 #yiv6514525653photos div div {border:1px solid #666666;min-height:62px;overflow:hidden;width:62px;}#yiv6514525653 #yiv6514525653photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv6514525653 #yiv6514525653reco-category {font-size:77%;}#yiv6514525653 #yiv6514525653reco-desc {font-size:77%;}#yiv6514525653 .yiv6514525653replbq {margin:4px;}#yiv6514525653 #yiv6514525653ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv6514525653 #yiv6514525653ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv6514525653 #yiv6514525653ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv6514525653 #yiv6514525653ygrp-mlmsg select, #yiv6514525653 input, #yiv6514525653 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv6514525653 #yiv6514525653ygrp-mlmsg pre, #yiv6514525653 code {font:115% monospace;}#yiv6514525653 #yiv6514525653ygrp-mlmsg * {line-height:1.22em;}#yiv6514525653 #yiv6514525653ygrp-mlmsg #yiv6514525653logo {padding-bottom:10px;}#yiv6514525653 #yiv6514525653ygrp-msg p a {font-family:Verdana;}#yiv6514525653 #yiv6514525653ygrp-msg p#yiv6514525653attach-count span {color:#1E66AE;font-weight:700;}#yiv6514525653 #yiv6514525653ygrp-reco #yiv6514525653reco-head {color:#ff7900;font-weight:700;}#yiv6514525653 #yiv6514525653ygrp-reco {margin-bottom:20px;padding:0px;}#yiv6514525653 #yiv6514525653ygrp-sponsor #yiv6514525653ov li a {font-size:130%;text-decoration:none;}#yiv6514525653 #yiv6514525653ygrp-sponsor #yiv6514525653ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv6514525653 #yiv6514525653ygrp-sponsor #yiv6514525653ov ul {margin:0;padding:0 0 0 8px;}#yiv6514525653 #yiv6514525653ygrp-text {font-family:Georgia;}#yiv6514525653 #yiv6514525653ygrp-text p {margin:0 0 1em 0;}#yiv6514525653 #yiv6514525653ygrp-text tt {font-size:120%;}#yiv6514525653 #yiv6514525653ygrp-vital ul li:last-child {border-right:none !important;}#yiv6514525653

   
Reply | Threaded
Open this post in threaded view
|

Re: video files are not open and capture.....

Fábián Kristóf - Szabolcs
In reply to this post by muhammadjahanzaibkhan89
I said video and executable should be in the same directory. Executable = the ".exe" on windows for example, source file = ".cpp" , ".c", etc..


________________________________
Feladó: [hidden email] <[hidden email]>, meghatalmazó: muhammad jahanzaib khan [hidden email] [OpenCV] <[hidden email]>
Elküldve: 2017. november 29. 20:46
Címzett: [hidden email]
Tárgy: Re: [OpenCV] video files are not open and capture.....



yes video file and source in the same directory.But it not works.


On Wednesday, November 29, 2017 9:00 AM, "Fábián Kristóf - Szabolcs [hidden email] [OpenCV]" <[hidden email]> wrote:



Are you sure you're running the executable from the same directory? If your source is in the same directory with the video file and your executable isn't then it won't work.


________________________________
Feladó: [hidden email] <[hidden email]>, meghatalmazó: [hidden email] [OpenCV] <[hidden email]>
Elküldve: 2017. november 29. 13:59
Címzett: [hidden email]
Tárgy: [OpenCV] video files are not open and capture.....


Hi, i trying to open the video files but not open files.But the same code works well with webcam.
videos have the same path as application.

 kindly solve my problem.Thanku.

this the code.





#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace cv;

using namespace std;

int main(){

          VideoCapture cap("fffff.avi");
           if ( !cap.isOpened() )
        {
            cout << "Cannot open the file" << endl;
            return -1;
        }
    while(true){

        Mat cameraFrame;

        cap.read(cameraFrame);
        if (cameraFrame.empty())
                  continue;
        if (!cameraFrame.empty()) {
          imshow("window", cameraFrame);
           }

        waitKey(33);


}
     cap.release();
     destroyWindow("cameraFrame");


 }





Reply | Threaded
Open this post in threaded view
|

Re: video files are not open and capture.....

Gary Bradski
In reply to this post by muhammadjahanzaibkhan89
It may be you do not have the correct codecs to interpret the file (see how
ffmpeg is linked in). But probably, I assume you are not even finding the
file "ffff.avi" (or is it fffff.avi ... you should also make sure to count
your "f"s or name the file more sensibly), but, of course, give it the full
path to the file to be sure.