Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • 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

  • Windows server crashs in video transcode during

    6 février 2019, par parsa

    I'm using ffmpeg for transcoding of my videos on a HP Blade dedicated server with these details:

    OS: Windows Server 2012 R2 64Bit
    CPU: Intel XEON X5650
    RAM: 16GB
    Hard disk: A sas normal disk

    This command is a sample for creating qualities which has 4K as top level and I use this command for creating lower qualities from that as parallel at the same time.

    ffmpeg -i input.mp4 -filter_complex 
    [0:v]split=4[s0][s1][s2][s3];
    [s0]scale=uhd2160[v0];
    [s1]scale=hd1080[v1];
    [s2]scale=hd720[v2];
    [s3]scale=hd480[v3];
    [s4]scale=nhd[v4];
    [s5]scale=cga[v5]
    -map [v0] -map [v1] -map [v2] -map [v3] -map [v4] -map [v5] -map 0:a 
    -c:v libx264 -c:a aac -f tee -g 48 -threads 0 
    "[select='v\:0,a':f=hls:hls_list_size=0:hls_time=6]../video/2160p/out.m3u8| 
     [select='v\:1,a':f=hls:hls_list_size=0:hls_time=6]../video/1080p/out.m3u8| 
     [select='v\:2,a':f=hls:hls_list_size=0:hls_time=6]../video/720p/out.m3u8| 
     [select='v\:3,a':f=hls:hls_list_size=0]../video/480p/out.m3u8| 
     [select='v\:3,a':f=hls:hls_list_size=0:hls_time=6]video/360p/out.m3u8| 
     [select='v\:3,a':f=hls:hls_list_size=0:hls_time=6]video/200p/out.m3u8"
    


    Some times in transcoding time windows goes to reconnecting and count up to 20 and then goes to black screen. I cannot find anythings in windows logs. And finally I restart server from button of that server. What's hapenning? How can I find a clue, about this issue?
    Any one know anything about this issue?

  • how to extract h264 raw video from mov using ffmpeg ?

    6 février 2019, par Chris Tsui

    I can use MP4Box to extract the h264 track from a mov file:

    $MP4Box -raw 1 test.mov
    $file test_track1.h264
    test_track1.h264: JVT NAL sequence, H.264 video, main @ L 30
    

    How can i do it by ffmpeg?

    I've try with these options but none acts like MP4Box.

    $ffmpeg -i test.mov -vcodec copy -an -f rawvideo 1.h264
    $file 1.h264 
    1.h264: data
    
    $ffmpeg -i test.mov -vbsf h264_mp4toannexb -vcodec copy -an -f rawvideo 2.h264
    $file 2.h264
    2.h264: data
    
  • ffmpeg - Hyperthreading causes "Conversion failed" with multiple parallel instances

    6 février 2019, par MeanStreet

    I'm trying to extract images from multiple videos in parallel, using ffmpeg. Here's my bash script:

    for video in *.MOV; do
        base=`basename "$video" .MOV`
        ffmpeg -i "$video" -r 0.02 "$base"/out_%02d.png > logs/"$base" 2>&1 &
    done
    

    When running this (on 60 videos), I check the logs/ files and 40 of them have crashed at the beginning with the following error:

    Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

    Conversion failed!

    However it works fine with a smaller amount of videos (around 5, even on videos that didn't work before).

    EDIT: I tried to disable hyperthreading and it works fine now. Why is hyperthreading causing ffmpeg to fail ?

  • How to display quick preview of output generated from FFMPEG command ? [android]

    6 février 2019, par akash varlani

    Basically I am developing a video editing app that lets user choose some of their images and create video slide show with music.

    I am using FFMPEG to generate video slide show from images but the problem is I can only show preview of the video after executing FFMPEG command.

    Is googled so many blogs and all and I know there is a possible way available to display preview of the output.

    Check below image from reference app. I am developing something similar to this app. There is an option to replace the image in video. This app displays instant preview once I change the image.

    enter image description here

    Here is the link of the reference app if anyone wants to check: https://play.google.com/store/apps/details?id=com.newbiz.mvmaster

    Clicking an EXPORT button this app lets you generate video output. I can do that as I know FFMPEG and how to generate OUTPUT FILE using FFMPEG but what I don't know is how to display quick preview of OUTPUT VIDEO before generating actual VIDEO FILE.

    On my UBUNTU device I can view output of FFMPEG command using FFPLAY tool but how to do the same on android device.

    Some useful link: http://androidwarzone.blogspot.com/2011/12/ffmpeg4android.html