-
FFmpeg 0.60 Problem – unsupported codec
Hello,
i’ve got a strange problem with ffmpeg. Im trying to extend my Software with a small Videoplayer-feature. What i have to do is just to open a videofile and read the images. I only need the videodata of a video, because its a computer vision application.
So i found a website which descibes how to do this. (https://dranger.com/ffmpeg/tutorial01.html)
I use ffmpeg 0.60 for this application, which I’ve downloaded from the ffmpeg website.I’ve builded ffmpeg with the following configurations:
./configure –enable-gpl –enable-swscale –enable-nonfree
After make and make install I’ve copied the lib and headerfiles to my Projectdirectory. (It’s a Qt-Project)
Here is the sourcecode i use to open a videofile (Its just the code from the tutorial):
int FFmpegHandler::openVideoStream(QString fileName)
{
AVFormatContext *pFormatCtx;
int i, videoStream;
AVCodecContext *pCodecCtx;
AVCodec *pCodec;
AVFrame *pFrame;
AVFrame *pFrameRGB;
AVPacket packet;
int frameFinished;
int numBytes;
uint8_t *buffer;// Register all formats and codecs
av_register_all();// Open video file
if(av_open_input_file(&pFormatCtx, fileName.toLatin1(), NULL, 0, NULL)!=0)
return -1; // Couldn't open file// Retrieve stream information
if(av_find_stream_info(pFormatCtx)<0)
return -1; // Couldn't find stream information// Dump information about file onto standard error
dump_format(pFormatCtx, 0, fileName.toLatin1(), false);// Find the first video stream
videoStream=-1;
for(i=0; inb_streams; i++)
if(pFormatCtx->streams[i]->codec->codec_type==CODEC_TYPE_VIDEO)
{
videoStream=i;
break;
}
if(videoStream==-1)
return -1; // Didn't find a video stream// Get a pointer to the codec context for the video stream
pCodecCtx=pFormatCtx->streams[videoStream]->codec;// Find the decoder for the video stream
pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
if(pCodec==NULL)
{
fprintf(stderr, "Unsupported codec!n");
return -1; // Codec not found
}
return 0;
}
So when im running my application it always outputs in the console:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘/home/pollok/Desktop/out-7.mp4’:
Duration: 00:00:35.00, start: 0.000000, bitrate: 451 kb/s
Stream #0.0(und): Video: mpeg4, yuv420p, 320×240 [PAR 1:1 DAR 4:3], 15,00 tb(r)
Stream #0.1(und): Audio: libfaad, 48000 Hz, stereo
Unsupported codec!But when I use ffplay to display the video it works without prolems… What am I doing wrong? I need help urgent, because I’m trying to programm that since one week.
FFplay outputs the following: (This is an older Version of ffmpeg, which was already preinstalled on my Linux)
FFplay version SVN-r13582, Copyright (c) 2003-2008 Fabrice Bellard, et al.
configuration: –prefix=/usr –libdir=${prefix}/lib –shlibdir=${prefix}/lib –bindir=${prefix}/bin –incdir=${prefix}/include/ffmpeg –enable-shared –enable-libmp3lame –enable-gpl –enable-libfaad –mandir=${prefix}/share/man –enable-libvorbis –enable-pthreads –enable-libfaac –enable-libxvid –enable-postproc –enable-libamr-nb –enable-libamr-wb –enable-x11grab –enable-libgsm –enable-libx264 –enable-liba52 –enable-libtheora –extra-cflags=-Wall -g -fPIC -DPIC –cc=ccache cc –enable-swscale –enable-libdc1394 –enable-nonfree –disable-mmx –disable-stripping –enable-avfilter –enable-libdirac –disable-decoder=libdirac –enable-libschroedinger –disable-encoder=libschroedinger –disable-altivec –disable-armv5te –disable-armv6 –disable-vis
libavutil version: 49.7.0
libavcodec version: 51.58.0
libavformat version: 52.16.0
libavdevice version: 52.0.0
libavfilter version: 0.0.0
built on May 3 2009 12:02:42, gcc: 4.3.2My lib version, which i have compiled is:
libavcodec.52.72.2
libavdevice.52.2.0
libavfilter.1.19.0
libavformat.52.64.2
libavutil.50.15.1
libpostproc.51.2.0
libswscale.0.11.0Can anybody help me? Im thankful for every idea.
Nice regards,
Tom