Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • SIGSEV when loading ffmpeg library

    20 février 2014, par gookman

    I am trying to build ffmpeg for Android similar to AndroidFFmpeg.

    I have configured ffmpeg so that I have only what I need. My android_build.sh looks like this:

    #!/bin/bash
    
    if [ "$NDK" = "" ]; then
        echo NDK variable not set, exiting
        echo "Use: export NDK=/your/path/to/android-ndk"
        exit 1
    fi
    
    OS=`uname -s | tr '[A-Z]' '[a-z]'`
    function build_ffmpeg
    {
        PLATFORM=$NDK/platforms/$PLATFORM_VERSION/arch-$ARCH/
        CC=$PREBUILT/bin/$EABIARCH-gcc
        CROSS_PREFIX=$PREBUILT/bin/$EABIARCH-
        PKG_CONFIG=${CROSS_PREFIX}pkg-config
        if [ ! -f $PKG_CONFIG ];
        then
           cat > $PKG_CONFIG << EOF
    #!/bin/bash
    pkg-config \$*
    EOF
           chmod u+x $PKG_CONFIG
        fi
        NM=$PREBUILT/bin/$EABIARCH-nm
        cd ffmpeg
        export PKG_CONFIG_LIBDIR=$(pwd)/$PREFIX/lib/pkgconfig/
        export PKG_CONFIG_PATH=$(pwd)/$PREFIX/lib/pkgconfig/
        ./configure --target-os=linux \
            --prefix=$PREFIX \
            --enable-small \
            --enable-cross-compile \
            --extra-libs="-lgcc" \
            --arch=$ARCH \
            --cc=$CC \
            --cross-prefix=$CROSS_PREFIX \
            --nm=$NM \
            --sysroot=$PLATFORM \
            --extra-cflags=" -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums  -fno-strict-aliasing -finline-limit=300 $OPTIMIZE_CFLAGS " \
            --disable-shared \
            --enable-static \
            --enable-runtime-cpudetect \
            --extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib  -nostdlib -lc -lm -ldl -llog -L$PREFIX/lib" \
            --extra-cflags="-I$PREFIX/include" \
            --disable-everything \
            --enable-muxer=mp4 \
            --enable-protocol=file \
            --enable-decoder=mpeg4 \
            --enable-encoder=mpeg4 \
            --enable-avformat \
            --enable-avcodec \
            --enable-avresample \
            --enable-zlib \
            --disable-doc \
            --disable-ffplay \
            --disable-ffmpeg \
            --disable-ffplay \
            --disable-ffprobe \
            --disable-ffserver \
            --disable-avdevice \
            --enable-nonfree \
            --enable-version3 \
            --enable-memalign-hack \
            --enable-asm \
            $ADDITIONAL_CONFIGURE_FLAG \
            || exit 1
        make clean || exit 1
        make -j4 install || exit 1
    
        cd ..
    }
    
    function build_one {
        cd ffmpeg
        PLATFORM=$NDK/platforms/$PLATFORM_VERSION/arch-$ARCH/
        $PREBUILT/bin/$EABIARCH-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -L$PREFIX/lib  -soname $SONAME -shared -nostdlib  -z noexecstack -Bsymbolic --whole-archive --no-undefined -o $OUT_LIBRARY -lavcodec -lavformat -lavresample -lavutil -lc -lm -lz -ldl -llog --dynamic-linker=/system/bin/linker -zmuldefs $PREBUILT/lib/gcc/$EABIARCH/4.6/libgcc.a || exit 1
       cd ..
    }
    
    #arm v5
    EABIARCH=arm-linux-androideabi
    ARCH=arm
    CPU=armv5
    OPTIMIZE_CFLAGS="-marm -march=$CPU"
    PREFIX=../ffmpeg-build/armeabi
    OUT_LIBRARY=$PREFIX/libffmpeg.so
    ADDITIONAL_CONFIGURE_FLAG=
    SONAME=libffmpeg.so
    PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/$OS-x86_64
    PLATFORM_VERSION=android-5
    build_ffmpeg
    build_one
    
    #arm v7vfpv3
    EABIARCH=arm-linux-androideabi
    ARCH=arm
    CPU=armv7-a
    OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU "
    PREFIX=../ffmpeg-build/armeabi-v7a
    OUT_LIBRARY=$PREFIX/libffmpeg.so
    ADDITIONAL_CONFIGURE_FLAG=
    SONAME=libffmpeg.so
    PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/$OS-x86_64
    PLATFORM_VERSION=android-5
    build_ffmpeg
    build_one
    

    My Android.mk file looks like this:

    LOCAL_PATH := $(call my-dir)
    
    include $(CLEAR_VARS)
    LOCAL_MODULE := ffmpeg-prebuilt
    LOCAL_SRC_FILES := ffmpeg-build/$(TARGET_ARCH_ABI)/libffmpeg.so
    LOCAL_EXPORT_C_INCLUDES := ffmpeg-build/$(TARGET_ARCH_ABI)/include
    LOCAL_EXPORT_LDLIBS := ffmpeg-build/$(TARGET_ARCH_ABI)/libffmpeg.so
    LOCAL_PRELINK_MODULE := true
    include $(PREBUILT_SHARED_LIBRARY)
    
    include $(CLEAR_VARS)
    LOCAL_ALLOW_UNDEFINED_SYMBOLS=false
    LOCAL_MODULE    := native
    LOCAL_SRC_FILES := native.c
    LOCAL_LDLIBS := -llog
    LOCAL_C_INCLUDES := $(LOCAL_PATH)/ffmpeg-build/$(TARGET_ARCH_ABI)/include
    LOCAL_SHARED_LIBRARY := ffmpeg-prebuilt
    include $(BUILD_SHARED_LIBRARY)
    

    The actual code I am trying to use is very simple and looks like this:

    #include 
    #include log.h>
    #include avcodec.h>
    #include avformat.h>
    
    static jint Java_dk_bendingspoons_clipstitch_VideoLoader_start(JNIEnv * env, jobject thiz, jstring path)
    {
        __android_log_print(ANDROID_LOG_VERBOSE, "native", "Before register all.");
        av_register_all();
    
        return 0;
    }
    

    The compilation of both ffmpeg and my code is without any errors. The problem is that when I am loading the library in Android it fails with the error: Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 27050. This leads me to believe that there is something that I am doing wrong when compiling.

    I should mention that I am compiling on Ubuntu 13.10 x64 with NDK-r9c-x86_64.

    How should I proceed in finding out what the issue is?

  • Real time compression/encoding using ffmpeg in objective c

    20 février 2014, par halfwaythru

    I have a small application written in Objective-c that looks for the video devices on the machine and allows the user to record video. I need to be able to compress this video stream in real time. I do not want to save the whole video, I want to compress it as much as possible and only write out the compressed version.

    I also don't want to use the AVFoundation's build in compression methods and need to use a third party library like ffmpeg.

    So far, I have been able to record the video and get individual frames using 'AVCaptureVideoDataOutputSampleBufferDelegate' in this method:

    - (void)captureOutput:(AVCaptureOutput *)captureOutput
       didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
       fromConnection:(AVCaptureConnection *)connection
    

    So I have a stream of images basically, and I want to throw them into ffmpeg (which is all set up on my machine). Do I need to call a terminal command to do this? And if I do, how do I use the image stack as my input to the ffmpeg command, instead of the video. Also, how do I combine all the little videos in the end?

    Any help is appreciated. Thanks!

  • JPEG Image to AVFrame (ffmpeg)

    20 février 2014, par user3330252

    I'm currently working on a screen sharing like application and I need to compile a sequence of jpeg files (screenshots of the screen) to an mpeg file. After extensive searching, I found some similar questions that never got any replies, and the code used there is deprecated.

    I'm currently stuck with converting jpg images into AVFrames. I don't have any code to share since I'm not exactly sure how I should go about doing it. Any help, tips or code snippets are greatly appreciated.

    Thank you

    Edit: I don't really know why I'm being downvoted. If I missed a detail, or if I'm doing something wrong then please let me know as it'll only help me improve my questions in the future.

  • ffmpeg working from cmd prompt but not from scheduled job

    19 février 2014, par user2864822

    I've created a simple batch script to convert WAV files to MP3 in a folder on my server.

    When I double-click the script, or call it from a command prompt it works, but when I run it from task scheduler, it doesn't. The job runs under the administrator ID and I can see that it processes the line before and after the ffmpeg call so the job is definitely working, but for some reason the ffmpeg call doesn't seem to be. Instead it says that ffmpeg is not a valid command or filename...

    Do I need to use a different syntax to call ffmpeg in a scheduled script?

    for %%F in (*.WAV) DO (    
      echo ffmpeg -i %%~nF.WAV %%~nF.mp3      
      ffmpeg -i %%~nF.WAV %%~nF.mp3    
      del %%~nF.WAV     
    )
    
  • ffmpeg options for h264 and pal dvd output from 1080i footage

    19 février 2014, par user3310809

    How to setup ffmpeg for those outputs for best quality, I am using frameserver from Adobe Premiere and avisynth like input for ffmpeg?