Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Unknown encoder 'libfaac' ubuntu 12.04 and ruby on rails 3

    5 novembre 2013, par hyperrjas

    I'm using carrierwave-video to upload video with my ruby on rails app. But I have this problem when try enconde the video:

    Unknown encoder 'libfaac'
    
    Errors: no output file created.
    

    I have tried with:

    sudo apt-get install libfaac-dev
    

    but I get the same error.

    Updated:

    After compile ffmpeg, I get the same error:

    Metadata:
        major_brand     : mp42
        minor_version   : 0
        compatible_brands: mp42isomavc1
        creation_time   : 2011-10-13 18:54:50
        encoder         : HandBrake 0.9.5 2011010300
      Duration: 00:06:43.28, start: 0.000000, bitrate: 380 kb/s
        Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 960x600 [SAR 1:1 DAR 8:5], 279 kb/s, 9.25 fps, 25 tbr, 90k tbn, 180k tbc
        Metadata:
          creation_time   : 2011-10-13 18:54:50
          handler_name    : 
        Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, s16, 97 kb/s
        Metadata:
          creation_time   : 2011-10-13 18:54:50
          handler_name    : 
    Please use -q:a or -q:v, -qscale is ambiguous
    Unknown encoder 'libfaac'
    
    Errors: no output file created. 
    
  • FFMpeg build -lavdevice error on mac [on hold]

    5 novembre 2013, par Ilya Kharlamov

    I'm trying to build ffmpeg for kxmovie, but in the end I get the message here is:

    Build settings from command line:
        ARCHS = armv7s
        SDKROOT = iphoneos7.0
        SYMROOT = tmp/build
    
    === BUILD TARGET kxmovie OF PROJECT kxmovie WITH CONFIGURATION Release ===
    
    Check dependencies
    
    Libtool tmp/build/Release-iphoneos/libkxmovie.a normal armv7s
        cd /Volumes/Files/Kharlamov/Desktop/kxtorrent/submodules/kxmovie
        setenv IPHONEOS_DEPLOYMENT_TARGET 7.0
        setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only armv7s -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -L/Volumes/Files/Kharlamov/Desktop/kxtorrent/submodules/kxmovie/tmp/build/Release-iphoneos -L/Volumes/Files/Kharlamov/Desktop/kxtorrent/submodules/kxmovie/libs -filelist /Volumes/Files/Kharlamov/Desktop/kxtorrent/submodules/kxmovie/tmp/build/kxmovie.build/Release-iphoneos/kxmovie.build/Objects-normal/armv7s/kxmovie.LinkFileList -ObjC -all_load -framework Foundation -framework CoreGraphics -lavcodec -lavdevice -lavformat -lavutil -lswresample -lswscale /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/libz.dylib -framework MediaPlayer -framework CoreAudio -framework AudioToolbox -framework Accelerate -framework QuartzCore -framework OpenGLES -o /Volumes/Files/Kharlamov/Desktop/kxtorrent/submodules/kxmovie/tmp/build/Release-iphoneos/libkxmovie.a
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: -dynamic not specified, -all_load invalid
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: -dynamic not specified the following flags are invalid: -ObjC 
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't locate file for: -lavdevice
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: -lavdevice is not an object file (not allowed in a library)
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/libz.dylib is a dynamic library, not added to the static library
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/libz.dylib is a dynamic library, not added to the static library
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/libz.dylib is a dynamic library, not added to the static library
    Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool failed with exit code 1
    
    ** BUILD FAILED **
    
    
    The following build commands failed:
        Libtool tmp/build/Release-iphoneos/libkxmovie.a normal armv7s
    (1 failure)
    rake aborted!
    ******** Build failed ********
    

    Help please, what is the problem and how to fix it? P.S. I'm sorry for my english, I'm just learning :)

  • ffmpeg unique frames only

    5 novembre 2013, par William

    I have a video sequence (MPEG1) of 30 fps that is decoded in two ways:

    • opencv_ffmpeg returns 30 images per second, but only 5 of them are unique, while all others are clones of the unique ones.

    • proprietary players (MediaPlayer) returns only the 5 unique frames and "holds" them for (1/5) sec each.

    Is there a way to grab only the unique frames that the coder knows and not the total amount the ffmpeg decoder produces to fulfill the fps rate?

    I'm developing a tracker and my tracker is forced to run 6 times slower and do many mistakes due to these "cloned frames".

    Does anyone know any technical term to the problem? Unfortunately, ffmpeg is a black box for an opencv user and the documentation is sparse.

  • how to play mp3 using ffmpeg

    5 novembre 2013, par Ari

    I'm trying to play audio mp3 file using ffmpeg in android but I'm facing a problem in the below mentioned code

    how to play mp3 using ffmpeg

     void JNICALL  Java_com_music_MainActivity_loadFile(JNIEnv* env, jobject obj,jstring file,jbyteArray array)
    {
        jboolean            isfilenameCopy;
        const char *        filename = (*env)->GetStringUTFChars(env, file, &isfilenameCopy);
        AVCodec *codec;
        AVCodecContext *c= NULL;
        int out_size, len;
        FILE *f, *outfile;
        uint8_t *outbuf;
        uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
        AVPacket avpkt;
        jclass              cls = (*env)->GetObjectClass(env, obj);
        jmethodID           play = (*env)->GetMethodID(env, cls, "playSound", "([BI)V");//At the begining of your main function
    
        av_init_packet(&avpkt);
    
        printf("Audio decoding\n");
    
    
        __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG, "inside load file");
        /* find the mpeg audio decoder */
        codec = avcodec_find_decoder(CODEC_ID_MP3);
        if (!codec) {
            fprintf(stderr, "codec not found\n");
            exit(1);
        }
    
        c= avcodec_alloc_context();
    
        /* open it */
        if (avcodec_open(c, codec) < 0) {
            fprintf(stderr, "could not open codec\n");
            exit(1);
        }
    
        __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG, "open avcode");
        outbuf = malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);
       __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG, "open %s",outbuf);
    
        f = fopen(filename, "rb");
        if (!f) {
            fprintf(stderr, "could not open %s\n", filename);
            exit(1);
        }
    
        /* decode until eof */
        avpkt.data = inbuf;
        avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f);
        __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG, "data =%s and size %d",avpkt.data,avpkt.size);
        while (avpkt.size > 0) {
            out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
            len = avcodec_decode_audio3(c, (short *)outbuf, &out_size, &avpkt);
            __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG, "length =%d",len);
            if (len < 0) {
                fprintf(stderr, "Error while decoding\n");
                __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG, " failed length =%d",errno);
    
                exit(1);
            }
            if (out_size > 0) {
                /* if a frame has been decoded, output it */
                jbyte *bytes = (*env)->GetByteArrayElements(env, array, NULL);
                memcpy(bytes, outbuf, out_size); //
                (*env)->ReleaseByteArrayElements(env, array, bytes, 0);
                (*env)->CallVoidMethod(env, obj, play, array, out_size);
    
            }
            avpkt.size -= len;
            avpkt.data += len;
            if (avpkt.size < AUDIO_REFILL_THRESH) {
                /* Refill the input buffer, to avoid trying to decode
                 * incomplete frames. Instead of this, one could also use
                 * a parser, or use a proper container format through
                 * libavformat. */
                memmove(inbuf, avpkt.data, avpkt.size);
                avpkt.data = inbuf;
                len = fread(avpkt.data + avpkt.size, 1,
                            AUDIO_INBUF_SIZE - avpkt.size, f);
                if (len > 0)
                    avpkt.size += len;
            }
        }
    
        fclose(f);
        free(outbuf);
    
        avcodec_close(c);
        av_free(c);
    }
    

    i am getting the len = - 1 in

    len = avcodec_decode_audio3(c, (short *)outbuf, &out_size, &avpkt);
    

    what am i doing wrong??

    please help

  • compile FFmpeg error on windows when run ./configure

    5 novembre 2013, par user1325717

    I want to use FFmpeg to decode mp3 and acc on android, I use android-ndk-r7 and the newest cygwin.

    I wrote a shell config.sh, which content is:


    TMPDIR=/cygdrive/c/temp
    
    PREBUILT=/cygdrive/c/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows
    PLATFORM=/cygdrive/c/android-ndk-r7/platforms/android-8/arch-arm
    
    ./configure --target-os=linux --arch=arm --enable-version3 --enable-gpl --enable-nonfree --disable-stripping --disable-ffmpeg --disable-ffplay --disable-ffserver --disable-ffprobe --disable-encoders --disable-muxers --disable-devices --disable-protocols --enable-protocol=file --enable-avfilter --disable-network --disable-mpegaudio-hp --disable-avdevice --enable-cross-compile --cc=$PREBUILT/bin/arm-linux-androideabi-gcc --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- --nm=$PREBUILT/bin/arm-linux-androideabi-nm --extra-cflags="-fPIC -DANDROID" --disable-asm --enable-neon --enable-armv5te --extra-ldflags="-Wl,-T,$PREBUILT/arm-eabi/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o -lc -lm -ldl"
    

    I open cmd and do bash to open cygwin shell, then do ./config, the problem is appeared: "/cygdrive/c/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-gcc is unable to create an executable file..."

    the config.log is:

    check_ld
    check_cc
    BEGIN /cygdrive/c/temp/ffconf.SFJc3t92.c
        1   int main(void){ return 0; }
    END /cygdrive/c/temp/ffconf.SFJc3t92.c
    gcc -fPIC -DANDROID -std=c99 -c -o /cygdrive/c/temp/ffconf.YKRv5TSp.o /cygdrive/c/temp/ffconf.SFJc3t92.c
    /cygdrive/c/temp/ffconf.SFJc3t92.c:1:0: warning: -fPIC ignored for target (all code is position independent)
    gcc -Wl,-rpath-link=/cygdrive/c/android-ndk-r7/platforms/android-4/arch-arm/usr/lib -L/cygdrive/c/android-ndk-r7/platforms/android-4/arch-arm/usr/lib -nostdlib /cygdrive/c/android-ndk-r7/platforms/android-4/arch-arm/usr/lib/crtbegin_static.o /cygdrive/c/android-ndk-r7/platforms/android-4/arch-arm/usr/lib/crtend_android.o -lc -lm -ldl -o /cygdrive/c/temp/ffconf.Yf1Ftjmo /cygdrive/c/temp/ffconf.YKRv5TSp.o
    /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: /cygdrive/c/android-ndk-r7/platforms/android-4/arch-arm/usr/lib/crtbegin_static.o: Relocations in generic ELF (EM: 40)
    /cygdrive/c/android-ndk-r7/platforms/android-4/arch-arm/usr/lib/crtbegin_static.o: could not read symbols: File in wrong format
    collect2: ld returned 1 exit status
    C compiler test failed.
    

    I don't know what is happened, is there someone who know what is happened, thanks.