Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • OpenCV and ffmpeg error. Reason Image not found

    13 septembre 2014, par Maggick

    I'm wrote some code using OpenCV to read in an image. My code compiles just fine but when I run the code I get the following error:

    dyld: Library not loaded: /opt/local/lib/libavcodec.54.dylib
      Referenced from: /usr/local/lib/libopencv_highgui.2.4.dylib
      Reason: image not found
    Trace/BPT trap: 5
    

    Has anyone seen this error before?

    Also I don't know why it is looking in /opt/local/lib my lib search path is only for /usr/local/lib/

    I am not even using ffmpeg but it seems that libavcoder is a ffmpeg library

    Any help or advice would be greatly appreciated

  • Video rotation using Android ffmpeg Library

    13 septembre 2014, par Adroid Freak

    I'm using Android ffmpeg Library, The library is working fine, the only issue I'm having is that the video is rotated. The original video is rotated by 90 degree, I tried many options by adding them to the library function below, the commented code is a sample of what I tried, I tried many other options but none of them is working.

    Anyone of you guys got it to work?

        public void processVideo(Clip in, Clip out, boolean enableExperimental, ShellCallback sc) throws Exception {
    
            ArrayList cmd = new ArrayList();
    
            cmd.add(mFfmpegBin);
    //      cmd.add("-vf \"transpose=1\"");Not working
    //      cmd.add(" -vfilters \"rotate=90\"");Not working
            cmd.add("-y");
    
            if (in.format != null)
            {
                cmd.add(Argument.FORMAT);
                cmd.add(in.format);
            }
    
            if (in.videoCodec != null)
            {
                cmd.add(Argument.VIDEOCODEC);
                cmd.add(in.videoCodec);
            }
    
            if (in.audioCodec != null)
            {
                cmd.add(Argument.AUDIOCODEC);
                cmd.add(in.audioCodec);
            }
    
            cmd.add("-i");
            cmd.add(new File(in.path).getCanonicalPath());
    
            if (out.videoBitrate > 0)
            {
                cmd.add(Argument.BITRATE_VIDEO);
                cmd.add(out.videoBitrate + "k");
            }
    
            if (out.width > 0)
            {
                cmd.add(Argument.SIZE);
                cmd.add(out.width + "x" + out.height);
    
            }
            if (out.videoFps != null)
            {
                cmd.add(Argument.FRAMERATE);
                cmd.add(out.videoFps);
            }
    
            if (out.videoCodec != null)
            {
                cmd.add(Argument.VIDEOCODEC);
                cmd.add(out.videoCodec);
            }
    
            if (out.videoBitStreamFilter != null)
            {
                cmd.add(Argument.VIDEOBITSTREAMFILTER);
                cmd.add(out.videoBitStreamFilter);
            }
    
    
            if (out.videoFilter != null)
            {
                cmd.add("-vf");
                cmd.add(out.videoFilter);
            }
    
            if (out.audioCodec != null)
            {
                cmd.add(Argument.AUDIOCODEC);
                cmd.add(out.audioCodec);
            }
    
            if (out.audioBitStreamFilter != null)
            {
                cmd.add(Argument.AUDIOBITSTREAMFILTER);
                cmd.add(out.audioBitStreamFilter);
            }
            if (out.audioChannels > 0)
            {
                cmd.add(Argument.CHANNELS_AUDIO);
                cmd.add(out.audioChannels+"");
            }
    
            if (out.audioBitrate > 0)
            {
                cmd.add(Argument.BITRATE_AUDIO);
                cmd.add(out.audioBitrate + "k");
            }
    
            if (out.format != null)
            {
                cmd.add("-f");
                cmd.add(out.format);
            }
    
            if (enableExperimental)
            {
                cmd.add("-strict");
                cmd.add("-2");//experimental
            }
    //      cmd.add("-metadata:s:v rotate=\"0\"");Not working
    //      cmd.add("rotate=\"0\""); Not working
    
            cmd.add(new File(out.path).getCanonicalPath());
    
            execFFMPEG(cmd, sc);
    
        }
    

    This is how I'm using it btw,

    FfmpegController fc = new FfmpegController(this, fileTmp);
    
    clip_out.videoFps = "30";
    clip_out.width = 480;
    clip_out.height = 320;
    clip_out.videoCodec = "mpeg4";
    clip_out.audioCodec = "copy";
    clip_out.videoBitrate = 450;
    
         fc.processVideo(clip_in, clip_out, false, new ShellUtils.ShellCallback()  
    

    Information about the compilation,

    /data/data/com.example.testffmpeg/app_bin/ffmpeg -filters 
    ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
     built on Nov 15 2013 00:50:10 with gcc 4.6 20120106 (prerelease)
    configuration: --arch=arm --cpu=cortex-a8 --target-os=linux --enable-runtime-cpudetect --enable-small --prefix=/data/data/info.guardianproject.ffmpeg/app_opt --enable-pic --disable-shared --enable-static --cross-prefix=/home/n8fr8/dev/android/ndk//toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --sysroot=/home/n8fr8/dev/android/ndk//platforms/android-3/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon' --extra-ldflags=-L../x264 --enable-version3 --enable-gpl --disable-doc --enable-yasm --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --enable-parsers --enable-protocols --enable-filters --enable-avresample --enable-libfreetype --disable-indevs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-libx264 --enable-zlib --enable-muxer=md5
    
  • Reduce size of APK when including .so files

    13 septembre 2014, par Arslan

    I am using a 3rd party API for camera library that is using ffmpeg frame recorder and .so files along with javacv.

    I am also using a 3rd party library for extracting meta data out from a video which also has some .so files

    When i merged all these files into only one folder "armeabi" my application did not work. So I have to copy all these files to all other folders "armeabi-v7a, mips, x86". Which works perfectly fine but obviously the size of the apk is now too large.

    Total size of these file are 20MB per folder. That make 80MB for all folder. My .apk size is 41MB. Please suggest ma what I can do to remove duplicate files/folders or reduce .apk size.

    Why I need all these folders armeabi, armeabi-v7a, mips, x86 enter image description here

    .so files in folder enter image description here

  • ffmpeg crop in a loop crops files incrementally

    13 septembre 2014, par Voprosnik

    I have a very large audio mp4 file that contains several songs.

    I have generated a script which reads a text file with the times and the song names and successfully assigns starttime, endtime and songtitle in 3 variables. The script successfully echoes the variables and returns the following format:

    00:00:00 00:10:15 Song1
    00:10:15 00:14:20 Song2
    

    and so on...

    Now I am intending to use this script with ffmpeg and crop each part of the big file into smaller audio files.

    The script thus, after feeding the variables in a while loop, it reaches to the command

    ffmpeg -ss $START -t $END -i ${1} -acodec copy $SONGNAME.mp4
    

    Then I realized that the -t option doesn't refer to the end point of the excerpt, but the duration. Eg. when I attempted to crop a song from 10:00 to 12:00 it resulted to a 12 minutes long sound file, far longer than the song itself. This resulted in increasingly bigger files.

    Therefore I found some date-manipulating algorithms. Subtracting $START from $END results to an integer with the song's duration in seconds. I tested it by echoing the results and it resulted to realisting figures (around 100-200).

    However when I replaced the -t option with $DUR instead of $END, this resulted also to increasingly larger files. I didn't measure the exact length of each, but it seems that the duration increased itself by each loop. I also added an echo $DUR line, which returned the realistic amounts it should. However the ffmpeg -t $DUR did not seem to agree.

    PS. -t has two options, input (before -i) and output (after -i). When I use it after the -i as output (i.e. the duration of the output file) it SEEMS to work, at least it generates realisticly sized files. The question remains why it behaves strangely in the first place.

  • how to resize an image stream from mongo gridfs

    13 septembre 2014, par CurlyFro

    i'm still new to node so bear with me.

    i have images stored in mongo gridfs. how do i resize the image stream? i'm trying to use ffmpeg. here's my method:

    exports.read = function (req, res) {
    var db = mongoose.connection.db;
    var id = new ObjectID(req.params.imageId);
    var store = new GridStore(db, id, 'r', {root: 'fs'});
    
    store.open(function (err, store) {
        if (err) return err;
    
        res.header("Content-Type", store.metadata['Content Type']);
        res.header("Content-Disposition", "attachment; filename='" + store.filename + "'");
    
        new ffmpeg()
            .input(store.stream(true))
            .size('650x365')
            .output('/temp/screenshot.png')
            .run();
    
        store.stream(true).pipe(res)
    });
    };
    

    but i'm getting an error:

    Error: ffmpeg exited with code 1: pipe:0: Invalid data found when processing input.

    what am i doing wrong?