Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to add a new audio (not mixing) into a video using ffmpeg ? [closed]

    22 janvier, par Vetalll

    I used a command like:

    ffmpeg -i video.avi -i audio.mp3 -vcodec codec -acodec codec output_video.avi -newaudio
    

    in latest version for adding new audio track to video (not mix).

    But I updated the ffmpeg to the newest version (ffmpeg version git-2012-06-16-809d71d) and now in this version the parameter -newaudio doesn't work.

    Tell me please how I can add new audio to my video (not mix) using ffmpeg.

  • avcodec_find_encoder(AV_CODEC_ID_H264) returns null

    22 janvier, par Monjura Rumi

    I am building an android application which will encode image captured from camera preview and later decode it. I am using ffmpeg library to encode and decode. To build static library with x264 I have used this tutorial. http://dl.dropbox.com/u/22605641/ffmpeg_android/main.html. As a source code of ffmpeg if I use the one downloaded from the link given in tutorial I can built it but can't build library if i use source code downloaded from here git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg. I have built library in ubuntu and using it in windows 7 in Eclipse. As I need only h264 encoder and decoder I have used following code for ffmpeg, slightly modified from tutorial.

    #!/bin/bash
    
    NDK=~/Documents/android-ndk-r8e
    PLATFORM=$NDK/platforms/android-8/arch-arm
    PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86
    PREFIX=/home/android-ffmpeg
    
    function build_one
    {
        ./configure --target-os=linux --prefix=$PREFIX \
        --enable-cross-compile \
        --enable-runtime-cpudetect \
        --disable-asm \
        --arch=arm \
        --cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
        --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
        --disable-stripping \
        --nm=$PREBUILT/bin/arm-linux-androideabi-nm \
        --sysroot=$PLATFORM \
        --enable-nonfree \
        --enable-version3 \
        --disable-everything \
        --enable-gpl \
        --disable-doc \
        --enable-avresample \
        --disable-ffplay \
        --disable-ffserver \
        --enable-ffmpeg \
        --disable-ffprobe \
        --enable-avcodec \
        --enable-libx264 \
        --enable-encoder=libx264 \
        --enable-encoder=libx264rgb \
        --enable-decoder=h263 \
        --enable-decoder=h264 \
        --enable-decoder=svq3 \   
        --enable-zlib \
        --enable-gpl \
        --enable-pic \
        --disable-devices \
        --disable-avdevice \
        --extra-cflags="-I/home/android-ffmpeg/include -fPIC -DANDROID -D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated -mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=armv7-a" \
        --extra-ldflags="-L/home/android-ffmpeg/lib"
    make -j4 install
    $PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o
    $PREBUILT/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -L$PREFIX/lib  -soname libffmpeg.so -shared -nostdlib  -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavfilter/libavfilter.a libavresample/libavresample.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog -lx264 --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
    }
    
    build_one
    

    After building library I have been able to build android ndk. A little part of my JNI code is here.

    JNIEXPORT jint JNICALL Java_com_example_testjava_TestjniActivity_initencoder(JNIEnv* env,jobject obj){
    
        av_register_all();
        avcodec_register_all();
        codec = avcodec_find_encoder(AV_CODEC_ID_H264);
        if (!codec) {
          __android_log_write(ANDROID_LOG_INFO, "debug", "not found");                
           return -1;
        }
    .
    .
    .
    }
    

    When I run my java source code that calls initencoder() I get -1 as return value and logcat prints "not found". That means avcodec_find_encoder() returns null and if condition is being ok. I don't know what's wrong. Why this function is returning null? I have searched a lot but did not find any solution that could guide me to right direction. some says to use avcodec_init(). But ndk-build command fails and shows error saying undefined reference to 'avcodec_init()'. I have started with library build because I thought may be I am doing wrong from the first stage. Did I make any mistake in library building like not enabling things that I should? Please help me here. This is kind of urgent for me.

  • How to batch generate EDL (edit decision list) files for a folder of videos with different run times

    22 janvier, par DnK

    How to batch generate EDL (edit decision list) files for a folder of videos with different run times? I need to skip exact amount of seconds from the start and another amount of seconds from the end. All the videos have different runtimes I can make EDL files for skipping the intro but need a way to read the video runtime and skip the last 60 or 90 seconds.

    This is the format for the EDL I am using with kodi

    0:00:00   0:01:20.    3
    

    So if the video is 40 mins 30 seconds the EDL generated skipping 80 seconds from the start and 90 seconds from the end should be

    0:00:00   0:01:20.    3
    0:39:00   0:40:30.    3
    

    More info about kodi EDL

    https://kodi.wiki/view/Edit_decision_list

  • Using ffmpeg as a server that handles multiple concurrent inputs [closed]

    22 janvier, par Parlor311

    I've been using "ffmpeg" as a subprocess in my Python server code where each new request runs a new instance of the command. However, I'm not sure this is the optimal way to go about it. I'm getting the impression that maybe "ffmpeg" is supposed to be executed separately as a server, and code is supposed to communicate with it using RTP or HTTP. Is this correct? The "listen" option seems to indicate so, but I can't find any resource on this use case.

  • How can I merge all the videos in a folder to make a single video file using FFMPEG

    21 janvier, par X_1

    I have a folder with 20+ video files and I need to merge them to make one long video file. How can I achieve this using FFMPEG in Python?

    I know the following command

    ffmpeg -vcodec copy -isync -i \ "concat:file1.mp4|file2.mp4|...|fileN.mp4" \
    

    outputfile.mp4

    But I'd rather not type all the names of the 20+ files.