Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How do you include ffmpeg in a php enviroment

    6 février 2019, par Joseph Williamson

    So looking through documentation and answers on stack overflow all leave out one detail thats throwing me off and thats how to actually include the library

    Following along the code listed here ffmpeg-php to create thumbnail of video

    class VideoTile
    {
        public static function createMovieThumb($srcFile, $destFile = "test.jpg")
        {
            // Change the path according to your server.
            $ffmpeg_path = 'D:\\ffmpeg\\bin\\';
    
            $output = array();
    
            $cmd = sprintf('%sffmpeg -i %s -an -ss 00:00:05 -r 1 -vframes 1 -y %s', 
                $ffmpeg_path, $srcFile, $destFile);
    
            if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN'))
                $cmd = str_replace('/', DIRECTORY_SEPARATOR, $cmd);
            else
                $cmd = str_replace('\\', DIRECTORY_SEPARATOR, $cmd);
    
            exec($cmd, $output, $retval);
    
            if ($retval)
                return false;
    
            return $destFile;
        }
    }
    

    The ffmpeg path is D:\\ffmpeg\\bin\\ I have downloaded the latest release for ffmpeg(4.1) and the uncompressed file does not contain any directory for bin

    I am very confused as to actually use this even with detailed code saying how to if I do not even know how to dictate the proper path

    I also realize that the link is almost 5 years old but as there are no post outlining how to do this in so long I figure its about time for some clear,concise, detailed solutions

  • How to merge image and audio to video with the same color ? (FFMPEG)

    6 février 2019, par JeanClothem

    i try to merge audio and image to video in ffmpeg,

    The problem that export does not have the same color as the original


    Here is a comparison on YouTube

    Original : https://www.youtube.com/watch?v=NsSBI9qwFE4

    Export ffmpeg : https://www.youtube.com/watch?v=FsxwqTSqpbQ

    ffmpeg -loop 1 -i rose.jpg -i rose.flac -c copy -shortest rose.mkv
    

    I want to get the same color as my original image

    Thank you!

  • Call to Process works fine with Debug, but it doesn't work in the installed application

    6 février 2019, par Santi

    I am developing a Windows Form program that has callings to ffmpeg library through the class Process.

    It works fine when I run it with the Debug in Visual Studio 2013. But when I install the program and I invoke the operation that call to the ffmpeg Process, it doesn't work. The cmd screen appears an disappears and nothing happens.

    I have tried to know what can be happening getting a log file with the output of ffmpeg, in case it was a problem in the ffmpeg libraries. However, after executing it the log is empty, what means that the ffmpeg command has not been executed.

    Can someone help me, please?

    The code is this:

    ProcessStartInfo startInfo = new ProcessStartInfo();
    startInfo.FileName = "cmd.exe";
    startInfo.Arguments = "/c " + ffmpegPath + " " + commandArguments;
    using (Process processTemp = new Process())
    {
        processTemp.StartInfo = startInfo;
        processTemp.EnableRaisingEvents = true;
        processTemp.Start();
        processTemp.WaitForExit();
    }
    

    I am invoking to cmd.exe (not directly ffmpeg.exe) because in the arguments sometimes there can be a pipe (that is why the command starts with "/c").

  • Make a zoom in FFMPEG

    6 février 2019, par Imonaboat

    I have a mp4 and i want to add a 300px X 300px image over the mp4 in the co-ordinates 600px down and 600px in from the left and have it zoom from 0px to 300 x 300 and when it zooms out do it from its centre point.

    I have the following code ffmpeg -i mov.mp4 -loop 1 -i image.png -filter_complex "[1:v]format=rgba,fade=in:st=1:d=3:alpha=1,fade=out:st=9.5:d=0.5:alpha=1[png];[0:v][png]overlay=0:0:shortest=1:enable='between(t,0,10)'" -y finished.mp4 which is great it fades a PNG over the mp4 at the top corner

    I am struggling to implement i think zoompan to do what im after

    Any help is appreciated

  • Compile FFMPEG + x264 - undefined references

    6 février 2019, par tishu

    I have been trying to find a solution online for a couple of days with no luck. I am using Ubuntu and trying to compile the latest FFMPEG stable version (1.0.1) with x264 support. I made sure I uninstalled any existing x264 then I downloaded the latest x264 source and compiled it with the following config:

    ./configure --prefix=$PREFIX \
        --enable-shared \
        --enable-static \
        --disable-gpac \
        --extra-cflags=" -I$ARM_INC -fPIC -DANDROID -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID -Wa,--noexecstack -MMD -MP " \
        --extra-ldflags=" -nostdlib -Bdynamic -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,nocopyreloc -Wl,-soname,/usr/lib/libz.so -Wl,-rpath-link=$ARM_LIB,-dynamic-linker=/system/bin/linker -L$ARM_LIB -lc -lm -ldl -lgcc" \
        --cross-prefix=${ARM_PRE}- \
        --disable-asm \
        --host=arm-linux \
    
        make clean
        make install
    

    All goes well, and I checked the installed version:

    x264 -V
        x264 0.129.x
        built on Dec 27 2012, gcc: 4.6.1
        configuration: --bit-depth=8 --chroma-format=all
        x264 license: GPL version 2 or later
    

    I then try to compile FFMPEG with the following options:

    ./configure --target-os=linux \
        --enable-libx264 \
        --enable-gpl \
        --prefix=$PREFIX \
        --extra-cflags="-I/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/android/armv7-a/include -I/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/x264 -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 " \
        --extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/android/armv7-a/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog" \
        --enable-cross-compile \
        --extra-libs="-lgcc" \
        --arch=arm \
        --cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
        --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
        --nm=$PREBUILT/bin/arm-linux-androideabi-nm \
        --sysroot=$PLATFORM \
    

    The configure and make clean/make install work well, but when I try to create the .so file the following command fails:

    /home/tishu/Apps/android-ndk-r8d/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-ld 
        -rpath-link=./android/armv7-a/usr/lib -L/home/tishu/Apps/android-ndk-r8d/platforms/android-14/arch-arm/usr/lib -soname libffmpeg.so -shared -nostdlib  -z,noexecstack -Bsymbolic \
        --whole-archive --no-undefined -o ./android/armv7-a/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog  \
        --warn-once \
        --dynamic-linker=/system/bin/linker /home/tishu/Apps/android-ndk-r8d/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
    

    This fails with the following output:

    libavcodec/libavcodec.a(libx264.o): In function `X264_frame':
    /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:159: undefined reference to `x264_picture_init'
    /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:179: undefined reference to `x264_encoder_reconfig'
    /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:190: undefined reference to `x264_encoder_encode'
    /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:196: undefined reference to `x264_encoder_delayed_frames'
    libavcodec/libavcodec.a(libx264.o): In function `encode_nals':
    /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:101: undefined reference to `x264_bit_depth'
    libavcodec/libavcodec.a(libx264.o): In function `X264_close':
    /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:231: undefined reference to `x264_encoder_close'
    libavcodec/libavcodec.a(libx264.o): In function `X264_init':
    /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:284: undefined reference to `x264_param_default'
    /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:292: undefined reference to `x264_param_default_preset'
    /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:314: undefined reference to `x264_param_parse'
    /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:459: undefined reference to `x264_param_apply_fastfirstpass'
    /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:490: undefined reference to `x264_param_apply_profile'
    /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:533: undefined reference to `x264_encoder_open_129'
    /home/tishu/Workspaces/ffmpeg/ffmpeg/jni/ffmpeg-1.0.1/libavcodec/libx264.c:544: undefined reference to `x264_encoder_headers'
    

    The x264 version it is looking for (129) is the one installed and compiled succesfully with --eanable-shared. Obviously all compiles fine when I do not include libx64.

    Question: How can I specify the include path for the last command? I tried adding the path to $PATH and also adding this as an argument with no luck: -I/home/tishu/Workspaces/ffmpeg/ffmpeg/jni/x264

    Thanks