Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • To large apk file when using .so files

    12 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

  • How to stream live from iphone camera to server using rtsp ?

    12 septembre 2014, par Vishal Gupta

    I am using AVCaptureSession to record a video and audio of user. I am getting real time video and audio streams independently. I am able to encode them using h264 encoder and aac encoder respectively. Now I am not getting how to multiplexing them both and make a stream ? How to send them to specific server url which is protected by userName and Password ? If it can be done using RTMP also then also it's fine.

    I have taken a reference from here! But I am not getting much out from this.

    Is there any RTSP library project which can help me ?

    I have been struggling in it from a long.

    Is there any solution to my problem ?

    Thanks in advance.

  • Video rotated using Android ffmpeg Library

    12 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("-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\"");
    //      cmd.add("rotate=\"0\"");
    
            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()  
    
  • FFmpeg av_guess_format returns NULL

    12 septembre 2014, par Kage

    I'm following the example code here: http://cekirdek.pardus.org.tr/~ismail/ffmpeg-docs/output-example_8c-source.html

    My code is as follows:

    fmt = av_guess_format(NULL, filename, NULL);
    if (!fmt) {
            LOGE(1,"Could not deduce output format from file extension: using MPEG.\n");
            fmt = av_guess_format("mp4", NULL, NULL);
    }
        if (!fmt) {
            LOGE(1, "Could not find suitable output format\n");
            exit(1);
    }
    

    The two times that I call av_guess_format, it is returning NULL both times. I am calling both av_register_all() and avcodec_register_all() beforehand.

    Any ideas as to why this is returning NULL?

    Thanks in advance.

  • Adding a bitmap over video using ffmpeg for android

    11 septembre 2014, par Alin

    I am stuck in this area which I am not comfortable at all to work in.

    Here is what I did so far:

    • Made an Ubuntu VirtualBox machine
    • Downloaded latest ffmpeg version which is 2.3.3
    • Compiled ffmpeg to be compatible with armv7-a so in the end I get two folders: include and lib. In include I have the headers and in libs the *.so files (just as in http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/)

    enter image description here

    I have created a new android project and made a jni folder and this is how far I went... Even this, with all the struggle being new to linux and compiling took me almost a week to reach.

    Adding a watermark in ffmpeg I believe it is done on libavfilter ? I have to dig on this matter, however the original ffmpeg I need to translate into my project is:

    ffmpeg -i input.avi -i logo.png -filter_complex 'overlay=10:main_h-overlay_h-10' output.avi
    

    As far as I am studying now I need to do inside jni:

    • create a add_watermark.c file in which I need to somehow call the function that does the filter overlay call
    • create Android.mk to load this and the ffmpeg needed libraries

      LOCAL_PATH := $(call my-dir)

      include $(CLEAR_VARS)

      LOCAL_MODULE := add-watermark

      LOCAL_SRC_FILES := add-watermark.c

      LOCAL_LDLIBS := -llog -ljnigraphics -lz

      LOCAL_SHARED_LIBRARIES := libavformat libavcodec libswscale libavutil

      include $(BUILD_SHARED_LIBRARY)

      $(call import-module,ffmpeg-2.3.3/android/armv7-a)

    • create Application.mk

      APP_ABI := armeabi-v7a

      APP_PLATFORM := android-8

    • run ndk-build and use the generated libraries in my android project.

    I really need help on continuing, so every answer is received with great attention and pleasure.

    Later Edit: Would it be possible to somehow build ffmpeg.exe as a library and call its main with the exact same parameters as the original exe ? I do not want to run ffmpeg as a standalone executable, but have it integrated within the project. Something like http://www.roman10.net/how-to-port-ffmpeg-the-program-to-androidideas-and-thoughts/ What downsides would this approach have ?