Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • How to install ffmpeg in ubuntu 12.04 ? [on hold]

    14 août 2013, par Dhaval

    I have used ubuntu 12.04 and i want to use ffmpeg for thumbnail image for flv file but not install in my machine and also php.ini file.

  • How to install FFMpeg in WampServer 2.1 (Windows XP)

    14 août 2013, par Raja Bilal Ahmed

    I m using php 5.3.5 on windows xp and now i try to install ffmepg from this link http://sergey89.ru/files/ffmpeg-php-win32-all.zip when i resart my wamp server i got this warning PHP Startup:ffmpeg: Unable to initialize module Module compiled with modle API=2006013 PHP compiled with module API=20060626 These options need to match Kindly someone guide me how i correct this problem.

  • How to execute command line ffmpeg commands programatically in android ?

    14 août 2013, par Md. Arafat Al Mahmud

    I have successfully built ffmpeg for android using the bambuser . Now I have to build a sample converter application like mp4 to 3gp. I know there are command line commands ffmpeg -i video_origine.avi video_finale.mpg. But I don't know how to execute these commands programatically. I have sample code like

    jint Java_com_example_ndklearning1_MainActivity_logFileInfo(JNIEnv * env, jobject this, jstring filename)
    {
        av_register_all();
    
        AVFormatContext *pFormatCtx;
        const jbyte *str;
        str = (*env)->GetStringUTFChars(env, filename, NULL);
    
        if(av_open_input_file(&pFormatCtx, str, NULL, 0, NULL)!=0)
        {
            LOGE("Can't open file '%s'\n", str);
            return 1;
        }
        else
        {
            LOGI("File was opened\n");
            LOGI("File '%s', Codec %s",
                pFormatCtx->filename,
                pFormatCtx->iformat->name
            );
    
        }
        return 0;
    }
    

    This code open's a file and extracts the codec information. All I want is that, to convert the opened file in a desired format. Any kind of help such as code snippet or steps to follow will be highly appreciated.

    Can ffmpeg API serve my purpose ? If there is existing API available, it will be more helpful

  • "Vorbis Extradata missing" when trying to get stream's information about the codec

    14 août 2013, par noobed

    Hello I've got a problem when loading AVCodec for an flv file. (there seems to be no problem when loading mp3 or avi file)

    The actual error is : [vorbis @ 0x1550aa0] Extradata missing.

    So I'll keep it simple and ask you:

    1) Anyone familiar with this type of error?

    Since I've spent some hours googling but with no success

    2) What exactly does "extradata missing" mean in context of ffmpeg avcodec_open2()

    You can see my code below:

    #ifdef __cplusplus
    
    #define __STDC_CONSTANT_MACROS
    
    #ifdef _STDINT_H
    
        #undef _STDINT_H
    
    #endif
    
    #endif
    
    #include 
    extern "C" { 
    #include avcodec.h>
    #include avformat.h> 
    #include avutil.h>
    #include samplefmt.h>
    
    }
    #include 
    
    
    
    int main(int argc, char * argv[])
    {
    if(argc < 2)
    {
        printf("you need to specify filename \n");
        return -1;
    }
    av_register_all();
    avcodec_register_all();
    
    //opening a file
    AVFormatContext *avFormatContext = NULL;
    int ret = avformat_open_input(&avFormatContext, argv[1], NULL, NULL);
    if (ret < 0) 
    return -2; // Couldn't open file
    
        //print some basic info
    printf("num of streams = %u\n", *(&avFormatContext->nb_streams));
    printf("filename = %s\n", *(&avFormatContext->filename));
    printf("start time = %ld \n", *(&avFormatContext->start_time));
    printf("duration = %ld \n", *(&avFormatContext->duration));
    printf("bit rate = %d\n", *(&avFormatContext->bit_rate));
    printf("audio codec id = %d \n\n\n", *(&avFormatContext->audio_codec_id));
    
    AVCodecContext * pCodecContext;
    int audioStreamId = -1;
    for(int i = 0; i < avFormatContext->nb_streams; i++)
    {
        if(avFormatContext->streams[i]->codec->codec_type == \
        AVMEDIA_TYPE_AUDIO)//CODEC_TYPE_AUDIO)
        {
            audioStreamId = i;
            break;
        }
    }       
    
    if(audioStreamId == -1)
        return -3; //Didn't find an audio stream
    
    
    printf("audioStreamId = %d \n", audioStreamId);
    
    pCodecContext = avFormatContext->streams[audioStreamId]->codec;
    if(pCodecContext == NULL)
        return -10;
    
    
    
    
    //The stream's information about the codec is in what 
    //we call the "codec context." This contains all the information 
    //about the codec that the stream is using, and now we have a pointer to it. 
    //But we still have to find the actual codec and open it:
    
    
    AVCodec *pCodec;
    AVDictionary *options;
    //Find the decoder for the audio stream
    pCodec = avcodec_find_decoder(pCodecContext->codec_id);
    
    printf("TEST codec name = %s fullName = \
       %s\n",pCodec->name, pCodec->long_name);
    
    if(pCodec == NULL)
        return -4; //Codec not found
    //Open codec
    //avcodec_open2 - This function is not thread safe!
    //Prior to using this function the context has to be allocated with 
        //  avcodec_alloc_context3().
    pCodecContext = avcodec_alloc_context3(pCodec);
    
    printf("test 0\n");
    if(pCodecContext == NULL)
        return -5; //Could not allocate audio codec context
    
    printf("test 1\n");
    if(avcodec_open2(pCodecContext, pCodec, NULL) < 0)
        return -6; //Couldn't open codec
    
    printf("test 2\n");
    
    avformat_close_input(&avFormatContext);
    
    return 0;
    }
    

    These are the last lines of my output screen:

    TEST codec id = 86021
    t0
    t1
    [vorbis @ 0x19eeaa0] Extradata missing.
    
  • using ffmpeg to generate thumbnails from remote URL

    13 août 2013, par Wendy Lam

    I can generate thumbnails from local file, but don't know how to do the tricks to the remote url.

    ffmpeg -itsoffset -30 -i /home/test/test.flv -vcodec mjpeg -vframes 1 -an -f rawvideo -s 160x120 test.jpg"

    but ffmpeg -itsoffset -30 -i http://www.test.com/test.flv -vcodec mjpeg -vframes 1 -an -f rawvideo -s 160x120 test.jpg"

    using the URL it won't generate any thumbs.