I need to write a small software that will show video. I don't know any thing about graphics at C.
What classes are there? Please point me to a place to start from.
Thanks, Nahum
Another simple library to use to display video is OpenCV (cross-platform):
int main(int argc, char** argv)
{
cvNamedWindow("xsample", CV_WINDOW_AUTOSIZE);
CvCapture* capture = cvCreateFileCapture("movie.avi");
if (!capture)
{
printf("!!! cvCreateFileCapture didn't found the file !!!\n");
return -1;
}
IplImage* frame;
while(1)
{
frame = cvQueryFrame( capture );
if (!frame)
break;
cvShowImage( "xsample", frame );
char c = cvWaitKey(33);
if (c == 27)
break; // ESC was pressed
}
cvReleaseCapture(&capture);
cvDestroyWindow("xsample");
return 0;
}
And that's it. However, you won't be able to play sound with OpenCV, just video. But if you are looking for a workaround on that, here is a little something I wrote some time ago using OpenCV and FFmpeg.
I don't know any thing about graphics at C
I strongly suggest you learn this first otherwise you'll have a hard time doing it.
Anyway: writing a well performing video player is no small feat. Luckily there are readily usable multimedia packages for Linux:
All of these can be embedded into your own program. Personally I recommend either libxine or the ffmpeg libraries, as those are the IMHO most solid and straightforward to use. GStreamer looks nice on the paper, but has problems with stability (in my experience).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With