Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Compression Techniques FFmpeg 0.60 Problem – unsupported codec

  • FFmpeg 0.60 Problem – unsupported codec

    Posted by Tom Pepe on July 30, 2010 at 7:53 am

    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.2

    My 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.0

    Can anybody help me? Im thankful for every idea.

    Nice regards,

    Tom

    Michael Rampe replied 15 years, 11 months ago 2 Members · 3 Replies
  • 3 Replies
  • Michael Rampe

    August 3, 2010 at 5:28 am

    [tom pepe] “I’ve builded ffmpeg with the following configurations:

    ./configure –enable-gpl –enable-swscale –enable-nonfree”

    You have not installed or enabled the libfaad or libfaac libraries. This is why it is reporting:

    [tom pepe] “Unsupported codec!”

    Your ffplay does have these libraries installed and configured. This is why it works in FFplay but not FFmpeg.

    add –enable-libfaad and –enable-libfaac to your FFmpeg configure line.

    Michael

    “half-way to world domination A.K.A. the belligerent blue bike shed”

  • Tom Pepe

    August 3, 2010 at 9:34 am

    [Michael Rampe]You have not installed or enabled the libfaad or libfaac libraries. This is why it is reporting:

    [tom pepe] “Unsupported codec!”

    [Michael Rampe]Your ffplay does have these libraries installed and configured. This is why it works in FFplay but not FFmpeg.

    add –enable-libfaad and –enable-libfaac to your FFmpeg configure line.

    But when you have a look at the sourcecode:


    // 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
    }

    libfaad and libfaac are en- and decoder for audiostreams.
    But I never access to the audio channel – only to the video channel.

    So why should this be the solution for my problem?

    Nice Regards,

    Tom

    PS: Thanks for your reply.

  • Michael Rampe

    August 3, 2010 at 11:57 pm

    It appears that there is an audio stream in your input. Unless FFmpeg is told to ignore the audio (using -an for example on the command line), it will pass the stream through to the output. That is why I think you are having the problem of unsupported codec.

    Michael

    “half-way to world domination A.K.A. the belligerent blue bike shed”

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy