c++ - How to use libavcodec in Qt4? -
how use libavcodec in qt4 access individual video frames?
after verifying video stream can decoded libavcodec compiling this example, moved source code c++ program. av_open_input_file()
unable open video file (returning errorcode: -2).
the call looks right now:
... // register formats , codecs avcodec_register_all(); // open video file qstring videofilename("/absolute/path/to/video.avi"); // somewhere else in application const char* filename = videofilename.tostdstring().c_str(); int err = 0; if((err = av_open_input_file(&pformatctx, filename, null, 0, null)) != 0) { doerrorhandling(err, filename); // err = -2 }
when @ const char* filename
inside debugger looks correct. making basic mistake in mixing c , c++ code (for first attempt dumped code example constructor of class)?
note: in order application compile include headers this:
extern "c" { #define __stdc_constant_macros // uint64_c #include <libavcodec/avcodec.h> #include <libavformat/avformat.h> #include <libswscale/swscale.h> }
i have tried hard code path video file application without success:
av_open_input_file(&pformatctx, "/home/bjoernz/video.avi", null, 0, null);
i able compile , execute example (avcodec_sample.0.5.0.c) using g++
.
error -2 means no such file or directory
. i'm pretty sure file you're attempting open isn't located in "current working directory" when running application.
Comments
Post a Comment