Tuesday, December 6, 2011

FFmpeg4Android




FFmpeg4Android is a way your application can run FFmpeg commands,  only Java, no need for C code, or NDK.

* Android Q (and below) support.
* 64-bit full support.
* Performance oriented. 

Android Studio full demo with ffmpeg4android_lib
Download version 4.1_07


Running FFmpeg4Android demo project (Android Studio)

Just Download the Android Studio project above, open the zip,
On Studio, File, Open the project.
Build, and run to your device.

Add FFmpeg support to your app (Android Studio)

The easy way:
Add this line to your app gradle.build: 
implementation 'com.netcompss:ffmpeg4android_lib:41.07'
And basically you are done, to test it see the readme on our git.

The customizable way:

Commands Examples

This commands verified to work with FFmpeg4Android:

This are only some basic examples, a lot more is possible...


Video Compress:

// simple regular commad
ffmpeg -y -i /sdcard/videokit/in.mp4 -strict experimental -s 160x120 -r 25 -vcodec mpeg4 -b 150k -ab 48000 -ac 2 -ar 22050 /sdcard/videokit/out.mp4

 

// compress with h264 (to support chrome)

// Note that you will need to use the Extras (see below) distribution to use this command.

ffmpeg -y -i /sdcard/videokit/in.mp4 -strict experimental -vcodec libx264 -preset ultrafast -crf 24 -acodec aac -ar 44100 -ac 2 -b:a 96k -s 320x240 -aspect 4:3 /sdcard/videokit/out3.mp4


// As complex command, don't forget to use setCommandComplex(complexCommand)

// Use this format to support files that contains spaces and special characters

String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/video kit/in.mp4","-strict","experimental","-s", "160x120","-r","25", "-vcodec", "mpeg4", "-b", "150k", "-ab","48000", "-ac", "2", "-ar", "22050", "/sdcard/video kit/out.mp4"};


// running compression command, while keeping metadata information (including rotation metadata):
ffmpeg -y -i /sdcard/videokit/in.mp4 -strict experimental -map_metadata 0:g -s 160x120 -r 25 -vcodec mpeg4 -b 150k -ab 48000 -ac 2 -ar 22050 /sdcard/videokit/out1.mp4


The parameters that control the quality are the -s (resolution, currently set on 160x120) and the -b (the bitrate, currently set on 150k).
Increase them, e.g -s 480x320
And -b 900k
To improve quality (and get less compression).



Audio Compression

 

String commandStr = "ffmpeg -y -i /sdcard/vk2/in.wav -ar 44100 -ac 2 -ab 64k -f mp3 /sdcard/videokit/out.mp3";


Audio Trim (Crop)

String commandStr ={"ffmpeg","-y","-i","/storage/emulated/0/vk2/in.mp3","-strict","experimental","-acodec","copy","-ss","00:00:00","-t","00:00:03.000","/storage/emulated/0/videokit/out.mp3"};

 

Video Rotate (90 degrees cw):

ffmpeg -y -i /sdcard/videokit/in.mp4 -strict experimental -vf transpose=1 -s 160x120 -r 30 -aspect 4:3 -ab 48000 -ac 2 -ar 22050 -b 2097k /sdcard/video_output/out.mp4

 

Video Crop:

ffmpeg -y -i /sdcard/videokit/short.mp4 -strict experimental -vf crop=100:100:0:0 -s 320x240 -r 15 -aspect 3:4 -ab 12288 -vcodec mpeg4 -b 2097152 /sdcard/videokit/out.mp4

 

Extract Picture from Video:

ffmpeg -y -i /sdcard/videokit/in.mp4 -strict experimental -an -r 1/2 -ss 00:00:00.000 -t 00:00:03 /sdcard/videokit/filename%03d.jpg

 

Extract Sound from Video:

ffmpeg -y -i /sdcard/videokit/in.avi -strict experimental -acodec copy /sdcard/videokit/out.mp3

ffmpeg -y -i /sdcard/videokit/in.mp4 -strict experimental -vn -ar 44100 -ac 2 -ab 256k -f mp3 /sdcard/videokit/out.mp3

 

Re-encode Audio in Video:

ffmpeg -y -i /sdcard/in.mp4 -strict experimental -vcodec copy -acodec libmp3lame -ab 64k -ac 2 -b 1200000 -ar 22050 /sdcard/out.mp4


Change Video Resolution:

ffmpeg -y -i /sdcard/in.mp4 -strict experimental -vf transpose=3 -s 320x240 -r 15 -aspect 3:4 -ab 12288 -vcodec mpeg4 -b 2097152 -sample_fmt s16 /sdcard/out.mp4


Cut time segment from Video:

ffmpeg -ss 00:00:01.000 -y -i /sdcard/videokit/in.mp4 -strict experimental -t 00:00:02.000 -s 320x240 -r 15 -vcodec mpeg4 -b 2097152 -ab 48000 -ac 2 -b 2097152 -ar 22050 /sdcard/videokit/out.mp4


Transcode Audio:

ffmpeg -y -i /sdcard/videokit/big.wav /sdcard/videokit/small.mp3


WaterMark:

 //  test with watermark.png 128x128, add it to /sdcard/videokit/

String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/videokit/in.mp4","-strict","experimental", "-vf", "movie=/sdcard/videokit/watermark.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]","-s", "320x240","-r", "30", "-b", "15496k", "-vcodec", "mpeg4","-ab", "48000", "-ac", "2", "-ar", "22050", "/sdcard/videokit/out.mp4"}; 


Streaming simple:

Stream from Android device to a PC

 

* note that all streaming examples will need to add internet permission to the Android project Manifest file ( <uses-permission android:name="android.permission.INTERNET" />  )

 
// use this command on ffmpeg4android ( 192.168.1.11 is the PC IP)
ffmpeg -i /sdcard/videokit/2.mpg -strict experimental -f mpegts udp://192.168.1.11:8090

// You can use any player that supports streaming, on the target machine, to play the stream, in this case we used ffplay

// (192.168.1.14 is the Android device IP)

ffplay -f mpegts -ast 1 -vst 0 -ar 48000 udp://192.168.1.14:8090 



Stream raw video from camera preview:

  

getting the raw stream from the camera preview:


Parameters parameters = camera.getParameters();
imageFormat = parameters.getPreviewFormat();
if (imageFormat == ImageFormat.NV21) {
                Camera.Size previewSize = parameters.getPreviewSize();
                frameWidth = previewSize.width;
                frameHeight = previewSize.height;
                Rect rect = new Rect(0, 0, frameWidth, frameHeight);
                YuvImage img = new YuvImage(data, ImageFormat.NV21, frameWidth, frameHeight, null);
                try {
                                outStream.write(data);
                                outStream.flush();
                }
}



Encode and stream using FFmpeg4Android: 

"ffmpeg -f rawvideo -pix_fmt nv21 -s 640x480 -r 15 -i " + Environment.getExternalStorageDirectory().getAbsolutePath().toString() + "/yuv.data rtmp://host/stream.flv"


Stream on one device, receive a steam on second device and save it:

on the first device:

ffmpeg -i /sdcard/one3.mp4 -f mpegts udp://192.168.0.107:8090


on the second device:

String[] complexCommand = {"ffmpeg","-y" ,"-i", "udp://192.168.0.108:8090","-strict","experimental","-crf", "30","-preset", "ultrafast", "-acodec", "aac", "-ar", "44100", "-ac", "2", "-b:a", "96k", "-vcodec", "libx264", "-r", "25", "-b:v", "500k", "-f", "flv", "/sdcard/videokit/t.flv"};

* this needs internet permission in the manifest. 

H264 encoding (Needs Extras):
ffmpeg -y -i /sdcard/Video/1.MTS -strict experimental -vcodec libx264 -preset ultrafast -crf 24 /sdcard/videokit/out.mp4

ffmpeg -y -i /sdcard/videokit/m.mkv -strict experimental -vcodec libx264 -preset ultrafast -crf 24 -sn /sdcard/videokit/m2.mkv

Subtitles:
ffmpeg -y -i /sdcard/videokit/m2.mkv -i /sdcard/videokit/in.srt -strict experimental -vcodec libx264 -preset ultrafast -crf 24 -scodec copy /sdcard/videokit/mo.mkv

ffmpeg -y -i /sdcard/videokit/m2.mkv -i /sdcard/videokit/in.srt -strict experimental -scodec copy /sdcard/videokit/outm3.mkv

Convert Audio file to m4a
ffmpeg -i /sdcard/videokit/in.mp3 /sdcard/videokit/out.m4a

Encode h264 video and aac audio in one command (Needs Extras)
ffmpeg -y -i /sdcard/videokit/in.mp4 -strict experimental -vcodec libx264 -crf 24 -acodec aac /sdcard/videokit/out.mkv


Vintage filter

commandStr = "ffmpeg -y -i /sdcard/videokit/in.mp4 -strict experimental -vf curves=vintage -s 640x480 -r 30 -aspect 4:3 -ab 48000 -ac 2 -ar 22050 -b 2097k -vcodec mpeg4 /sdcard/videokit/curve.mp4";

Black & White filter (Gray Scale):

commandStr = "ffmpeg -y -i /sdcard/videokit/in.mp4 -strict experimental -vf hue=s=0 -vcodec mpeg4 -b 2097152 -s 320x240 -r 30 /sdcard/videokit/out.mp4";


Sepia using colorchannelmixer

String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/videokit/sample.mp4","-strict", "experimental", "-filter_complex",
"[0:v]colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131[colorchannelmixed];[colorchannelmixed]eq=1.0:0:1.3:2.4:1.0:1.0:1.0:1.0[color_effect]",
 "-map", "[color_effect]","-map", "0:a", "-vcodec", "mpeg4","-b", "15496k", "-ab", "48000", "-ac", "2", "-ar", "22050","/sdcard/videokit/out.mp4"};

Create filter using Photoshop curves 

You can create some effects using Photoshop curves operation (Image, Adjustments, Curves (CNTL + M)), export the curves acv file, and apply it using this command:

String[]
complexCommand={"ffmpeg","-y","-i","/storage/emulated/0/vk2/in.mp4","-strict","experimental","-vf","curves=psfile=/storage/emulated/0/videokit/sepia.acv","-b","2097k","-vcodec","mpeg4","-ab","48000","-ac","2","-ar","22050","/storage/emulated/0/videokit/out.mp4"}

Fade in and out transition
String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/videokit/in.m4v","-acodec", "copy", "-vf", "fade=t=in:st=0:d=5, fade=t=out:st=20:d=5", "/sdcard/videokit/out.mp4"};


Join 2 files using of the same size using filter_complex
String[] complexCommand = {"ffmpeg","-y","-i", "/sdcard/videokit/in1.mp4", "-i", "/sdcard/videokit/in2.mp4", "-strict","experimental", "-filter_complex", "[0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1", "/sdcard/videokit/out.mp4"};



// concat videos with different codecs, and different sizes, different rate and different aspect ratio:

String[] complexCommand = {"ffmpeg","-y","-i","/storage/emulated/0/videokit/sample.mp4",
    "-i","/storage/emulated/0/videokit/in.mp4","-strict","experimental",
    "-filter_complex",
    "[0:v]scale=640x480,setsar=1:1[v0];[1:v]scale=640x480,setsar=1:1[v1];[v0][0:a][v1][1:a] concat=n=2:v=1:a=1",
    "-ab","48000","-ac","2","-ar","22050","-s","640x480","-r","30","-vcodec","mpeg4","-b","2097k","/storage/emulated/0/vk2_out/out.mp4"}



Create a video from pictures

// note that this commands are sensitive to the pictures size.
// all pictures should be with the same size, and correspond to -s particular video resolution.
// e.g hd video is: 1280x720, and this should be the pictures size 
commandStr = "ffmpeg -y -r 1/5 -i /sdcard/videokit/pic00%d.jpg /sdcard/videokit/out.mp4";


// with audio. (Works on all players) png also works, pictures size in this case should be 320x240
ffmpeg -y -r 1 -i /sdcard/videokit/pic00%d.jpg -i /sdcard/videokit/in.mp3 -strict experimental -ar 44100 -ac 2 -ab 256k -b 2097152 -ar 22050 -vcodec mpeg4 -b 2097152 -s 320x240 /sdcard/videokit/out.mp4


Advanced filtering
String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/videokit/in.mp4","-strict","experimental", "-vf", "crop=iw/2:ih:0:0,split[tmp],pad=2*iw[left]; [tmp]hflip[right]; [left][right] overlay=W/2", "-vb", "20M", "-r", "23.956", "/sdcard/videokit/out.mp4"};

Increase video and audio speed
String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/videokit/in.mp4","-strict","experimental", "-filter_complex", "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]","-map","[v]","-map","[a]", "-b", "2097k","-r","60", "-vcodec", "mpeg4", "/sdcard/videokit/out.mp4"};

Overlay 2 videos side by side
 
     String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/Movies/sample.mp4","-i", "/sdcard/Movies/sample2.mp4", "-strict","experimental",
                "-filter_complex",
                "[0:v:0]pad=iw*2:ih[bg];" +
                "[bg][1:v:0]overlay=w",
                "-s", "320x240","-r", "30", "-b", "15496k", "-vcodec", "mpeg4","-ab", "48000", "-ac", "2", "-ar", "22050",
                "/sdcard/videokit/out.mp4"};  



  vintage + watermark
 
      String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/Movies/sample.mp4","-strict","experimental",
                "-vf",
                "movie=/sdcard/videokit/watermark002.png [watermark];" +
                "[in][watermark] overlay=main_w-overlay_w-10:10 [out_overlay];" +
                "[out_overlay]curves=vintage[out]", 
                "-s", "320x240","-r", "30", "-b", "15496k", "-vcodec", "mpeg4","-ab", "48000", "-ac", "2", "-ar", "22050",
                "/sdcard/videokit/out_water_vinta.mp4"};



Watermark + audio replace
 
    String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/Movies/sample.mp4","-i", "/sdcard/videokit/in.mp3", "-strict","experimental",
                "-filter_complex",
                "[1:a]atempo=1.0[a1];" +
                "movie=/sdcard/videokit/watermark002.png [watermark];" +
                "[0:v][watermark] overlay=main_w-overlay_w-10:10 [outv]",
                "-map", "[outv]", "-map", "[a1]",
                "-s", "320x240","-r", "30", "-b", "15496k", "-vcodec", "mpeg4","-ab", "48000", "-ac", "2", "-ar", "22050",
                "-shortest","/sdcard/videokit/out_water.mp4"};


Looping on a picture and adding audio with audio encoding support
 
      String commandStr = "ffmpeg -y -loop 1 -i /sdcard/videokit/pic001.jpg -i /sdcard/videokit/in.mp3 -strict experimental -s 1270x720 -r 25 -aspect 16:9 -vcodec mpeg4 -vcodec mpeg4 -ab 48000 -ac 2 -b 2097152 -ar 22050 -shortest /sdcard/videokit/out2.mp4";


Replacing video audio track, using the shotest (video or audio)

String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/videokit/sample.mp4","-i", "/sdcard/videokit/in.mp3", "-strict","experimental",
                "-map", "0:v", "-map", "1:a",
                "-s", "320x240","-r", "30", "-b", "15496k", "-vcodec", "mpeg4","-ab", "48000", "-ac", "2", "-ar", "22050","-shortest","/sdcard/videokit/out.mp4"};

Animated GIF

//Compress animated gif:
fmpeg -f gif -i /sdcard/videokit/pic1.gif -strict experimental -r 10 /sdcard/videokit/pic1_1.gif

//Convert mp4 to animated gif:
ffmpeg -y -i /sdcard/videokit/in.mp4 -strict experimental -r 20 /sdcard/videokit/out.gif

//Convert animated gif to mp4:
ffmpeg -y -f gif -i /sdcard/videokit/infile.gif /sdcard/videokit/outfile.mp4


Flash Support

//converting mp4 to swf:
ffmpeg -y -i sdcard/videokit/in.mp4 -strict experimental -acodec mp3 -ab 128000 -ar 44100 -vcodec flv1 -s 352x288 sdcard/videokit/out.swf

// converting mp4 to flv (Need extras):
ffmpeg -y -i /sdcard/videokit/in.mp4 -strict experimental -vcodec libx264 -preset ultrafast -crf 24 -acodec aac -ar 44100 -ac 2 -b:a 96k -s 320x240 -aspect 4:3 /sdcard/videokit/out3.flv


Karaoke

/phase cancellation on a stereo track with centered vocals
{"ffmpeg","-y","-i","/storage/emulated/0/videokit/in.mp3,"-af", "pan=stereo|c0=c0|c1=-1*c1", "-ac","2", "/storage/emulated/0/videokit/karaoke.mp3"}





ARM64-v8a support

Fully supported in the latest version.







Using complex commands

A complex command is a command that contains embedded elements (in most cases it uses quotations for that.
Here is an example:
ffmpeg -i /sdcard/videokit/in.mp4 -aspect 1:1 -vf split "[main][tmp];[tmp] crop=iw/2:ih:0:0, hflip[tp],[tp] pad=2*iw[left]; [main] crop=iw/2:ih:iw/2:0[right]; [left][right] overlay=W/2" -vb 20M -r 23.956 /sdcard/videokit/outs.mp4

To set a complex command you should create a String array and use the method:
setCommandComplex()

Like this:
String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/videokit/mo.mkv","-strict","experimental", "-vf", "crop=iw/2:ih:0:0,split[tmp],pad=2*iw[left]; [tmp]hflip[right]; [left][right] overlay=W/2", "-vb", "20M", "-r", "23.956", "/sdcard/videokit/out.mp4"};

setCommandComplex(complexCommand);


Size Tuning - Keeping your app apk small

FFmpeg4Android lib contains a build specifically to tackle this issue - Small App Size.
This build contains a subset of FFmpeg4Android that contains features (filters, coders, encoders, muxers etc), That are the most commonly used - the "essentials build".
This build is great for apps that need to keep small size.
All the performance benefits of the full ffmpeg4android are kept.

  
To use this build, goto ffmpeg_lib libs/armeabi-v7a folder,
simply rename libvideokit.so to libvideokit.so.full, 
and rename libvideokit.so.ess to libvideokit.so
Refresh the ffmpeg_lib project, and build your project (that use the ffmpeg_lib).
Your project will now use the essentials build, and you will see that the apk created is much smaller in size.

You can also remove the  libs/x86 folder, x86 devices will still work using the Houdini ARM real time translation, of course it will be slower then using the native.

You can also remove the libs/arm64-v8a folder since currently most devices does not support this platform, and all that do have backward compatibility with armeabi-v7a.

Make sure you test and see that all the functionality you need is still there.


Performance Tuning

  • Prefer mpeg4 codec (-codec mpeg4), since with this codec, ffmpeg4android can utilize all device cores.
Here is an example of command that use mpeg4 codec (in this case this command is doing a video compression):

String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/video kit/in.mp4","-strict","experimental","-s", "160x120","-r","25", "-vcodec", "mpeg4", "-b", "150k", "-ab","48000", "-ac", "2", "-ar", "22050", "/sdcard/video kit/out.mp4"};


  • If its possible, reduce output video resolution (-s) and bitrate (-b), the lower the video quality is, the faster it will take to produce.
  • Encoding using h264 can't utilize all device cores, and thus is much slower. If you must use it, use the -preset ultrafast flag.
  • Using the -threads flag can only degrade the performance, as ffmpeg4android automatically detects the number of cores your device has, and set the optimal number of threads for the command used. 

 


Audio Pack

If Your app needs Audio only support, we have a very small compilation (2.9M), that contain only the audio part of ffmpeg4android.
You can download it from here:
https://drive.google.com/open?id=1k_FmZeZZjEZ9se-cO6IMG-MagkTqRGja

To use it, simply replace the jniLibs/armeabi-v7a with the one in this zip.

FFmpeg Command Correctness

FFmpeg command can be quite complex, and in some cases, getting it right can be hard.
To help you with that, FFmpeg4Android will create a file called vk.log that contains the ffmpeg log in the device demo folder (by default /sdcard/videokit) This log can be very useful when understanding what is wrong with the FFmpeg command, and in most cases it will pinpoint you to the section in the command that is wrong.
If you still don't understand what is wrong with your command, make sure the command works on a windows machine, and you can email us the command for inspection.

Known issues & TroubleShooting

* If you use only armeabi-v7a you must make sure all your other JNI libs are restricted to this architecture,  If not the loader will fail to find the library so file (it will try to find it in x64 folders).
To do it, add this configuration in your module build.gradle (under defaultConfig):

ndk {
    abiFilter "armeabi-v7a"
}



Latest version release notes
4.1_07
---------

* Fixed some bugs related to 32bit devices.
* removed x264 from command validation warnings.

* Critical bug fix related to 64 to 32 bit switching.
* 64-bit support with great performance.
* Moved to ffmpeg 4.1 as base version.
* Improved loader performance and stability.






         

261 comments:

  1. Hi, i have download ur demo but when i press invoke it does not go in the if statement

    if (remoteService != null) {
    ....
    }
    can u tell me why remoteService variable is empty

    ReplyDelete
  2. You need to start and bind before invoking the service.

    ReplyDelete
  3. yes i have first push the vid.mp4 in my sdcard then i start the app
    then click start then start and then i click invoke

    if (remoteService != null) {
    Toast.makeText(FFMpegClientDemo.this, "Started", Toast.LENGTH_SHORT).show();
    ...
    }

    as u can see have toast in the if and it does not show
    can u plz help i am really stuck... thankx

    ReplyDelete
  4. Yes, first i started and then bind and then i clicked invoke, i have checked in emulator and also my phone.
    HTC Desire android 2.2 but nothing happens when i click invoke i have add toast in the if statement but it will not toast
    plz help

    ReplyDelete
  5. Try to run the demo directly from ffmpeg4android, does it run?

    ReplyDelete
  6. Not clear what u mean by directly form ffmpeg4android\..?

    ReplyDelete
  7. The demo application use ffmeg4android, but its also possible to run the demo from inside ffmpeg4android (the lib also includes the demo app), if its still not clear, read the guide again.

    ReplyDelete
  8. Ok, good now it works, ok the one question i want to use ffmpeg with my app so i downloaded ffmpeg from here
    http://bambuser.com/opensource
    built it and got folder called built/
    so i picked file built/ffmpeg/armeabi-v7a/bin/ffmpeg

    and used this code in my acitvity

    Process process = Runtime.getRuntime().exec("data/data/com.koder.testffmpeg2/files/ffmpeg -version");

    but it gives error
    java.io.IOException: Error running exec(). Command:[/data/data/com.koder.testffmpeg2/files/ffmpeg -version] Working Directory: null Environment:null

    not clear what it mean can u plz help me with this
    i would appriciate it a lot
    Thankx

    ReplyDelete
  9. In order to run it this way, you will need a rooted device.
    Anyway, I'm not familiar with this specific build (there are almost endless possibilities for building ffmpeg, and you need to make sure you chose correctly), anyway, when I build ffmpeg for ffmpeg4android, I had also to make some code changes to make it work on some devices.
    anyway running it via JNI is better, since you will not have to have a rooted phone.

    ReplyDelete
  10. OK, thankx buddy, i dont think i have time to learn ndk thankx anyway

    ReplyDelete
  11. can I use it to stream (using http, rtsp) without converting the video-file. The idea would be to use FFMpeg since it supports much more codecs than native Anroid-code.

    ReplyDelete
    Replies
    1. Yes you can.
      Use this command:
      ffmpeg -i INPUTFILE http://:8090/feed1.ffm
      Where is where ffserver is running, note that if you run ffserver on android, you need to have a rooted device.
      Also, ffserver if not part of ffmgeg4android, You'll need to build and install it separately.
      Note that you can run it on a separate machine.

      Delete
  12. FFmpeg4Android currently does not support streaming.

    ReplyDelete
    Replies
    1. are you planning to support streaming? It would be great - in this way I could show streaming-contents within my app without relying on an external player. I guess I could also use OSD-features (on screen commands). Any plans to implement streaming-support and if yes, any indication when?

      Thanks!

      Delete
    2. This comment has been removed by the author.

      Delete
    3. Yes you can.
      Use this command:
      ffmpeg -i INPUTFILE http://ffserver-host:8090/feed1.ffm
      Where ffserver-host is the host where ffserver is running, note that if you run ffserver on android, you need to have a rooted device.
      Also, ffserver if not part of ffmgeg4android, You'll need to build and install it separately.
      Note that you can run it on a separate machine (and it does not have to be android device).

      Delete
  13. I've been pulling my hair out trying to get FFmpeg to compile with libmp3lame support, while using the Android NDK r7. I was also using the Bambuser build script, and since it sets sysroot to the NDK directory, it can never find libmp3lame. I can build FFmpeg manually, and it finds libmp3lame every time.

    After four days, I've given up.

    I guess my questions is, before I invest time in working with your code:
    1. Can you convert 3GPP/MPEG-4 audio to MP3 (i.e. were you able to add libmp3lame support?)

    ReplyDelete
    Replies
    1. We don't support this external lib, I will add it to our next version wish list.

      Delete
  14. libmp3lame is now supported!

    ReplyDelete
  15. i got remoteService==null when i am invoke then...so can u help to how to reslove this problem...

    ReplyDelete
    Replies
    1. Make sure you start and bind before you invoke.
      Please follow the client demo code.
      If you still have problems, read the Mir posts (above).

      Delete
  16. Hello, My name is Ramiro Coll Doñetz, I am part of the company InfinixSoft. The reason I communicate with you is to consult about your library "FFMPEG 4 Android", which I am interested in implementing one of my applications, which will be distributed and perhaps sell at the Google Play.

    I'm interested to know the price of the license, and if I can use in all applications that I make.

    Also wanted to ask if I can integrate the service into my application, that does not depend on having installed the "FFMPEG 4 Android" from the Google Play.

    Thank you.

    Ramiro Coll Doñetz.

    ReplyDelete
    Replies
    1. Hi Ramiro,
      Please see more pricing and licensing information at:
      http://ffmpeg4android.netcompss.com/
      Regarding your second question, no, you can have it as part of your application.
      If you have more questions,
      Please contact Eli at: eli.hasson@netcompss.com

      Delete
  17. This comment has been removed by the author.

    ReplyDelete
  18. Hi!

    This is a pretty great accomplishment! It is exactly what I needed for my thesis project!

    A question if I may: How would I go about extracting a thumbnail/frame from a
    given video.

    I have tried the usual ffmpeg commands but none work.

    Also as a side note, most of these commands are meant to save the extracted frames to jpg or png files. Is there any logical way to add them to some buffer or bitmap variable?

    I am rather new at ffmpeg so I may be missing some obvious links

    Thank you!

    ReplyDelete
    Replies
    1. Hi Dimitri,
      Here is a command to grab a picture from a video:
      ffmpeg -y -i /sdcard/videokit/in.mp4 -an -r 1/2 -ss 00:00:00.000 -t 00:00:03 /sdcard/videokit/filename%03d.jpg

      Delete
    2. Explanation:
      after the -ss is the time you want to extract the picture from.
      since the rate is 1/2 and the time (-t) is 3 secs, it will grab 6 pictures.

      Delete
  19. Many thanks!

    May I ask one more question?
    What kind of licensing scheme would be needed to use ffmpeg4Android in an academic thesis (published paper)?

    regards!

    ReplyDelete
  20. Please contact Eli from NetComps regarding licensing options:
    eli.hasson@netompss.com

    ReplyDelete
  21. And I'm back with more questions!

    I haven't contacted Eli yet about the license issue but if this next problem is solvable I definitely will (didn't want to bother anyone needlessly)

    So here goes:
    I have managed to get comfortable calling ffmpeg string commands and generating the required thumbnails as image files.
    Now the problem is getting these images into android UI views such as ImageViews etc. as fast as possible.
    What would be the best way to do this? Loading the created files doesn't sound like the best plan, could I somehow send the output straight to an Android bitmap?

    Thanks again for all the help!

    ReplyDelete
    Replies
    1. Hi Dimitry,
      Well, FFMpeg (The native library) is a beast that like to work with files, it does not know what is bitmap, nevertheless Android bitmap, it will take a lot of effort to implement, and I don't think there is a good reason to do so.
      Loading a file from the sdcard, is a very quick operation (few 10 milisecs, depends on the file size), creating a bitmap from the file (that is now loaded into the memory is even quicker), so its actually should work for you very fast,
      Can you test and post here the results?

      Thanks,
      John

      Delete
    2. Hello again!

      I did some tests and indeed loading from the sd card is fast enough!

      The problem now is extracting the frames fast from the video as fast as possible.

      I tried running a single ffmpeg command to extract 1 frame every minute from the video but it is way to slow. For this I used the -r command on the output. Is there maybe a better way?

      The next thing I tried was to extract a single frame with with each command and then seek to the required time position with -ss

      The problem is that apparently I cannot call new ffmpeg commands in rapid succession.

      I am using a slightly modified version of the Invoke function from the demo. In LogCat a serviceDisconnected message appears after every invoke so I suspect that I must find a way not to disconnect the service after every call (if indeed that is what is happening)

      Any insight? I do apologise for the barrage of questions

      cheers!

      Delete
  22. Updated client source to the latest version.

    Eli

    ReplyDelete
  23. Does the current version support streaming from a usb mic or usb camera? What streaming protocols are supported? Can i stream from a usb mic to say a flash or wowza server?. During a streaming process can i transcode from mpeg2 to mpeg4?

    ReplyDelete
    Replies
    1. I would like to know this also, I have tried this with no go:

      ffmpeg -i /dev/graphics/fb0 http://ip:8090/cam1.ffm

      I have also tried:

      ffmpeg -i /dev/video0 http://ip:8090/cam1.ffm

      Neither works, no output from FFMpeg.

      Delete
  24. Is it possible to redirect ffmpeg to accept OutputStream as its input for encoding?

    ReplyDelete
  25. Its not tested, its possible it will work.

    ReplyDelete
  26. Hi.
    Is now the "FFMpeg4Android project library" free? I saw a `if (! isLicenseValid()) return;`.
    Thanks.

    ReplyDelete
  27. Its free for personal use,
    If you want to bundle it with your app, the price is 399USD

    ReplyDelete
  28. Intent intent = new Intent();
    intent.setClassName("com.netcompss.ffmpeg4android", "FFMpegRemoteServiceBridge");
    ComponentName cn = startService(intent);

    startService(intent) returns null!

    ReplyDelete
    Replies
    1. Is there any clear guide on how to start and bind to the service?

      Thanks.

      Delete
    2. Lets start from the end, does the apk works for you?
      If yes, can you compile and run the lib on your device?

      Delete
  29. Hi Eli,

    Sorry I don't get what you mean by "the apk".

    The Demo app works on my device. I downloaded the sources and put the service in my build path in Eclipse. It is built without error. But I cannot get the service running.

    ReplyDelete
    Replies
    1. I have also declared it in the Android manifest.

      Delete
    2. The compiled demo client does not run on the device:

      Unable to resolve supperclass of Lcom/examples/ffmpegforAndroid_demo/DemoClient;

      Delete
    3. you need to install ffmpeg4android apk (from the market) or compile and run it via eclipse before you run the demo.

      Delete
    4. Well that's the very first thing I did before going for the source codes! It works very well on my device and I tested several commands on it.

      Unless there is a compatibility issue between the source that I downloaded and the version that I have on my device (SGS3).

      Delete
    5. I just downloaded the latest version (5.0.2) of ffmpeg4android and installed it. The Demo client cannot link to the class and crashes.

      Please advise.

      Delete
    6. There is no startService call in the demo client?

      Delete
    7. No, version 5 is much more simple, basically you set the command and call run, the framework does everything else.
      Looks like Your problem relates to the version change.,
      You need to make sure that everything (apk, ffmpeg4android, and demo client) are 5.0.2

      Delete
    8. All are 5.0.2, the apk works fine, but compiled Demo client crashes when "invoke" button is clicked, my own application also crashes when invokeService() is called:

      at com.netcompss.ffmpeg4android_client.BaseWizard.is LicenseValid(BaseWizard.java:100)

      Delete
    9. Try this (it worked for me on a fresh machine):
      1. download, import and compile the 2 projects (ffmpeg4android, client demo).
      Verify that in both the version is 5.0.2

      2. Go to ffmpeg4android properties, unchecked the "is library" checkbox, and click the run button (with your device connected), this will install ffmpeg4android apk on your device.

      3. Run the demo client (with your device connected), try to run the command, it should work now.

      Delete
    10. I found the issue, it seems that for some reason the blog post was not updated with the correct link to version 5.0.2, so you downloaded an older version.
      I fixed it, now both the links are directing to the correct location (version 5.0.2 for the demo client, and the ffmpeg4android library)

      Delete
    11. Yes. Doing this it works.
      But is it supposed to work also if we launch the DemoClient project with ffmpeg4android checked as library?

      Delete
    12. No, the demo client must have the apk installed.
      If you want it to work without the apk, you should bundle your code with the ffmpeg4andoid project, where com.example package is the place holder for your code.

      Delete
    13. @John Here is what I tried:

      1- Downloaded everything version 5.0.2 for sure 100%
      2- Imported Demo Client project into Eclipse
      3- Imported FFmpeg4Adnroid into Eclipse
      4- Uninstalled everything on my device (previous Demo and ffmpeg4Adroid)
      5- Run FFmpeg4Android as you said, to have the apk on my device
      6- Run Demo Client, it freezes after I click invoke
      7- Run my application, invokeService() is called but an exception occurs as below (in Logcat):

      dalvikvm Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/netcompss/ffmpeg4android/LicensecheckJNI;

      then:

      dalvikvm threadid=1: thread exiting with uncaught exception (group=0x....)

      AndroidRuntime FATAL EXCEPTION: main
      .
      .
      .
      and lots of error messages regarding LicenseCheckJNI (and this one: Couldn't load license-jni: findLibrary returned null)

      Delete
  30. the apk from the market?
    Anyway, perfectly clear.

    ReplyDelete
  31. Hi guys,
    Your package looks good!
    What happens if I use ffplay -i rtp://@224.0.0.1:1234 in the demo (Multicast RTP)
    Should it work?
    Phil

    ReplyDelete
    Replies
    1. This was verifed to work:
      ffplay -f mpegts -ast 1 -vst 0 -ar 48000 udp://192.168.0.114:8090
      String command = "ffmpeg -i /sdcard/videokit/2.mpg -f mpegts udp://192.168.0.114:8090";

      Regarding RTP, I was able to send RTP packages using this command:
      ffmpeg -i in.mp4 -an -f rtp rtp://192.168.0.109:20000
      I sniffed the packages on the target machine, But I was not able to play them.

      Delete
    2. Just to clarify,
      The: ffplay -f mpegts -ast 1 -vst 0 -ar 48000 udp://192.168.0.114:8090
      Is run on the target machine to play the streamed video, when ffmpeg4android used this command to stream:
      String command = "ffmpeg -i /sdcard/videokit/2.mpg -f mpegts udp://192.168.0.114:8090";

      Delete
    3. thanks John, can you confirm that the "streamer" side was run on a different machine than the one where you are playing the stream (192.168.0.114)?

      Delete
  32. @John just repeated the above post in case you haven't seen this.

    Here is what I tried:

    1- Downloaded everything version 5.0.2 for sure 100%
    2- Imported Demo Client project into Eclipse
    3- Imported FFmpeg4Adnroid into Eclipse
    4- Uninstalled everything on my device (previous Demo and ffmpeg4Adroid)
    5- Run FFmpeg4Android as you said, to have the apk on my device
    6- Run Demo Client, it freezes after I click invoke
    7- Run my application, invokeService() is called but an exception occurs as below (in Logcat):

    dalvikvm Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/netcompss/ffmpeg4android/LicensecheckJNI;

    then:

    dalvikvm threadid=1: thread exiting with uncaught exception (group=0x....)

    AndroidRuntime FATAL EXCEPTION: main
    .
    .
    .
    and lots of error messages regarding LicenseCheckJNI (and this one: Couldn't load license-jni: findLibrary returned null)

    It seems LicenseCheckJNI is trying to create resources that are not accessible when it is bundled with my application. I think I cannot use it in my app...I am going to build ffmpeg under Ubuntu and use it in my app instead.

    ReplyDelete
  33. You can remove this call:
    if (! isLicenseValid()) return;
    from the DemoClient.java

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. Alex,
      Sorry for the lack of docs, till then, I'm here to answer any question.
      The ffmpeg4android source is available for use and change.
      Note that in ffmpeg4android project, com.example is a place holder for your code, this is the quickest way to bundle your app with ffmpeg4android.
      Of-course, you will need to refactor the project name, add your resources, etc,
      but this is relatively very easy.

      You can also add the code to your project, but in this case you need to be more careful, and make sure you have everything (packages, resources), and do it slowly and gradually.

      I wish it could work as a library, the problem is that it looks like ADT does not support NDK results in a library.

      Delete
  34. Hi, i am trying to extract info of the re-encoded video i just created and i entered this command
    ffmpeg -i /sdcard/videokit/A16.mp4
    but i got this error "At least one output file must be specified" and i assumed i needed a text file so i edited the command to
    ffmpeg -i /sdcard/videokit/A16.mp4 /sdcard/videokit/out.txt
    but i got an invalid argument error.
    How can i extract the video information. I have looked at the log but i require more details and some information in the log is contradicting, for instance there are two bitrates or maybe i am the one who doesn't know how to interpret the log. Please let me know how i can extract the video information. Thanx

    ReplyDelete
    Replies
    1. Your first command is fine, the information will show in the log file in the videokit folder, and also you can view it from the app using the show last run log (in the options menu).

      Delete
  35. This comment has been removed by the author.

    ReplyDelete
  36. I want to change bitrate of MP3 file from 320kb/s to 80kb/s, In FFmpeg 4 Android I typed this command:
    ffmpeg -i /sdcard/320.mp3 -ab 80k /sdcard/80.mp3
    but it not success, can you tell me why ?

    ReplyDelete
  37. Here is a working command:

    ffmpeg -y -i /sdcard/videokit/in.mp3 -ab 128k -ac 2 -b 1200000 -ar 22050 /sdcard/videokit/out.mp3

    ReplyDelete
  38. Thank you so much, it work good, but I have a problem. Now I want to build an Android simple project, such as:
    Input: a mp3 file with (128kb/s)
    Ouput : a mp3 file with (80kb/s)
    When I click on "Convert" button, it will start transfering process. Could you tell me what steps must I follow to do that.

    ReplyDelete
  39. I'm trying to get this implemented into my existing project, and I'm running into some issues:

    Where is this vk.log file supposed to be created? Am I missing something about the service that should be happening in the background? I keep getting LogCat errors saying that the getDutationFromVCLogRandomAccess() method has failed:

    05-09 15:14:49.851: I/ffmpeg4android(8678): ========calc progress=======
    05-09 15:14:49.859: W/ffmpeg4android(8678): /storage/sdcard0/videokit/vk.log: open failed: ENOENT (No such file or directory)
    05-09 15:14:49.859: W/ffmpeg4android(8678): Prefs.durationOfCurrent is null
    05-09 15:14:49.859: I/ffmpeg4android(8678): onProgressUpdate: 0
    05-09 15:14:50.132: I/ffmpeg4android(8678): Cancel clicked
    05-09 15:14:50.132: I/ffmpeg4android(8678): Setting Prefs.forceStopFlag to true
    05-09 15:14:50.140: I/ffmpeg4android(8678): DeadObject Exception after fexit()

    Any ideas?

    ReplyDelete
    Replies
    1. Is this an issue with the ffmpeg service wanting to put the output in the /sdcard/videokit/ folder instead of what I actually have which is /storage/sdcard0/videokit?

      Delete
    2. I found my error, FFMPEG doesn't like spaces in the name.

      Delete
  40. Hi,
    Is this library supports Video4linux2 (v4l2) as source of video stream (/dev/video*) and will it be possible to stream video to Wowza Media Servers ?

    With thanks and regards

    Prasad Munaga

    ReplyDelete
    Replies
    1. Sorry, its not supported.

      Delete
    2. Hi John,

      Is there any other solution to achieve the desired result as my project got stuck over on this issue. Your kind help is very much appreciated.

      With thanks and regards

      Prasad Munaga

      Delete
  41. Hi,

    I am looking for a solution to mix 2 video on android :
    -one will normally have alpha channel(for now, I don't have choose the format mays you help me here two)
    -the second file will be a classical mp4
    after that, I'll have to add 2 other MP3 files as audio. I was trying to achieve this with ffmpeg but I am still new with it. Could you help me and if it is possible with your librairy, I will buy it.

    Thank

    ReplyDelete
  42. This comment has been removed by the author.

    ReplyDelete
  43. I have a small question :
    since I work all the day on ffmpeg, I would like to know if it's possible to use this command with your ffmpeg4android :

    ffmpeg -i main.mp4 -vf movie=effect.mp4 -filter_complex 'overlay' out.mp4

    Thank

    ReplyDelete
    Replies
    1. There is a problem with all commands that contain the ' character.
      I will need to look into it, it will take some time till I will allocate some time for this

      Delete
  44. Hi
    There seems to be problem with video encoding.
    I tried many combinations and i am getting same error "No such file or directory"
    The command is to create a video from a set of images " img000.jpg to img390.jpg"

    ffmpeg -f image2 -r 1/2 -i /sdcard/videokit/img%03d.jpg -c:v libx264 -r 30 out.mp4

    Is there a problem is with path taken for the command image2 ?

    Thanks

    ReplyDelete
    Replies
    1. Yes,
      Its a known issue.
      It works on high end devices only.
      Verified on n7.

      Delete
    2. Hello John,
      I checked in another exynos quad device as well. I think this is a path issue for the image2 command.
      Could you check again once more ?
      Regards,
      Shyam

      Delete
    3. Hi Shyam,
      Its not a path issue, this is an open issue, the only thing we know is that it works on some devices (mostly high end, GS2, Galaxy Nexus, N7), and on some not (Galaxy 1, Nexus one).
      I suspect its related directly for the ARM version, but this is still not verified.
      Note that this happens only for this command:
      ffmpeg -y -f image2 -i /sdcard/videokit/pic%d.jpg /mnt/sdcard/videokit/video.mpg
      Without any evidence to relate to the OS version, it will not work on N1 even with 4.1 or on Galaxy1 even with 4.2.2
      This suggests that the issue is directly related to the ARM command set.

      Regards,
      J

      Delete
  45. Please check the Prefs.java and change DEFAULT_WORK_FOLDER to DEFAULT_WORK_FOLDER = Environment.getExternalStorageDirectory().getAbsolutePath()+"/videokit/"; and DEFAULT_OUT_FOLDER to public static final String DEFAULT_OUT_FOLDER = Environment.getExternalStorageDirectory().getAbsolutePath()+"/videokit/"; otherwise it wont work on some devices like Samsung Galaxy S2 and Google Nexus S.

    ReplyDelete
  46. Hello,

    I am an Android developer and I am thinking of buying this software. However, before I buy I want to be sure that it will do what my application need. I am taking snapshot of user's picture after applying different age to that user's face (we are using third party library to apply different age to the user's face). Based on the age of the user, we might be taking approximately 8-10 pictures of the user. Next what we want to do is to create a video from those snapshot pictures and store it in a directory which we want to upload it to the facebook. So the question is whether your software can help us creating a video from the static images? And can this be done with by using only Java? Also, what is the support level that we can expect from you?

    ReplyDelete
    Replies
    1. Hi,
      Yes, this functionality is supported, but make sure your try it and make sure its what you need before the purchase.
      We have one year of free support after purchase.

      Delete
    2. You should use this command:
      String command = "ffmpeg -y -f image2 -r 1 -i /sdcard/videokit_output/pic%03d.jpg -vcodec libx264 -r 30 /sdcard/videokit_output/video_images.mp4";

      the pictures should be pic001.jpeg, pic002.jpg etc

      Delete
    3. This comment has been removed by the author.

      Delete
    4. Hi John,

      I have been trying to run the ffmpeg command as stated above but I am seeing this in my Logcat (splitting my log file into two since there is limitations on characters):

      *****************************************************************************


      08-12 14:37:18.192: D/ffmpeg4android(16797): Client Cannot unbind - service not bound
      08-12 14:37:18.192: D/ffmpeg4android(16797): Client stopService()
      08-12 14:37:18.192: I/ffmpeg4android(16797): !!!!!!!!!!!!!!!!!!services.size(): 1
      08-12 14:37:18.192: I/ffmpeg4android(16797): putting Base categoty
      08-12 14:37:18.202: D/ffmpeg4android(16797): started: com.netcompss.ffmpeg4android.FFMpegRemoteServiceBridge
      08-12 14:37:18.202: D/ffmpeg4android(16797): Client startService()
      08-12 14:37:18.202: D/ffmpeg4android(16797): bindService() called
      08-12 14:37:18.202: D/ffmpeg4android(16797): Client bindService()
      08-12 14:37:18.202: I/Choreographer(16797): Skipped 48 frames! The application may be doing too much work on its main thread.
      08-12 14:37:18.262: I/ffmpeg4android(16949): =======service onCreate(): Stopping forground (to overcome 2.3.x bug)
      08-12 14:37:18.262: I/ffmpeg4android(16949): =======service onBind()=======
      08-12 14:37:18.262: I/ffmpeg4android(16949): ===onStartCommand called====
      08-12 14:37:18.262: I/ffmpeg4android(16949): ===onStartCommand cat: Base
      08-12 14:37:18.262: D/ffmpeg4android(16949): onStartCommand, START_STICKY, base Command
      08-12 14:37:18.282: I/ffmpeg4android(16949): Run called.
      08-12 14:37:18.282: D/ffmpeg4android(16949): Sleeping, waiting for command
      08-12 14:37:18.392: D/ffmpeg4android(16797): Client onServiceConnected()
      08-12 14:37:18.392: I/ffmpeg4android(16797): invokeService called
      08-12 14:37:18.392: D/ffmpeg4android(16949): command items num: 13
      08-12 14:37:18.392: D/ffmpeg4android(16949): command: ffmpeg -y -f image2 -r 1 -i /storage/emulated/0/FaceRetirement/usersnapshot/ffmpeg/image%03d.jpg -vcodec libx264 -r 30 /storage/emulated/0/FaceRetirement/video/snapshot-video.mp4
      08-12 14:37:18.392: D/ffmpeg4android(16797): deleteing: /storage/emulated/0/FaceRetirement/videokit/logs/vk.log isdeleted: false
      08-12 14:37:18.392: D/ffmpeg4android(16797): deleteing: /storage/emulated/0/FaceRetirement/videokit/logs/ffmpeg4android.log isdeleted: false
      08-12 14:37:18.392: D/ffmpeg4android(16797): deleteing: /storage/emulated/0/FaceRetirement/videokit/logs/videokit.log isdeleted: true
      08-12 14:37:18.392: D/ffmpeg4android(16797): Client invokeService()
      08-12 14:37:18.392: D/ffmpeg4android(16797): Acquire wake lock
      08-12 14:37:18.452: D/ffmpeg4android(16797): TranscodeBackground doInBackground started
      08-12 14:37:18.452: I/ffmpeg4android(16949): =======service runTranscoding() called, setting _run to true======
      08-12 14:37:18.592: D/dalvikvm(16949): Trying to load lib /data/app-lib/com.motionportrait.sample-2/libvideokit.so 0x424b8998
      08-12 14:37:18.592: D/dalvikvm(16949): Added shared lib /data/app-lib/com.motionportrait.sample-2/libvideokit.so 0x424b8998
      08-12 14:37:18.602: I/Videokit(16949): Loading native library compiled at 16:36:42 Jun 6 2013
      08-12 14:37:18.602: I/ffmpeg4android(16949): ===============Running command from thread===============
      08-12 14:37:18.602: I/Videokit(16949): licenseCheck...
      08-12 14:37:18.602: I/Videokit(16949): isLicExists...
      08-12 14:37:18.602: I/Videokit(16949): trying to open /sdcard/videokit/ffmpeglicense.lic
      08-12 14:37:18.602: I/Videokit(16949): license file not found...
      08-12 14:37:18.602: D/Videokit(16949): license check rc: -4
      08-12 14:37:18.602: I/ffmpeg4android(16949): RemoteService: FFMPEG finished.

      Delete
    5. 08-12 14:37:18.602: I/ffmpeg4android(16949): =======ProgressBackgroundRemote doInBackground=========
      08-12 14:37:20.594: W/ffmpeg4android(16949): /storage/emulated/0/FaceRetirement/videokit/logs/vk.log: open failed: ENOENT (No such file or directory)
      08-12 14:37:20.594: W/ffmpeg4android(16949): Prefs.durationOfCurrent is null (remote)
      08-12 14:37:20.604: I/ffmpeg4android(16949): ========================Progress from remote: 0
      08-12 14:37:20.744: I/ffmpeg4android(16797): ========calc progress=======
      08-12 14:37:20.744: W/ffmpeg4android(16797): /storage/emulated/0/FaceRetirement/videokit/logs/vk.log: open failed: ENOENT (No such file or directory)
      08-12 14:37:20.744: W/ffmpeg4android(16797): Prefs.durationOfCurrent is null
      08-12 14:37:20.744: I/ffmpeg4android(16797): onProgressUpdate: 0
      08-12 14:37:20.744: D/ProgressBar(16797): setProgress = 0
      08-12 14:37:20.744: D/ProgressBar(16797): setProgress = 0, fromUser = false
      08-12 14:37:20.754: D/ProgressBar(16797): mProgress = 0mIndeterminate = false, mMin = 0, mMax = 100
      08-12 14:37:22.576: I/ffmpeg4android(16797): ========calc progress=======
      08-12 14:37:22.576: W/ffmpeg4android(16797): /storage/emulated/0/FaceRetirement/videokit/logs/vk.log: open failed: ENOENT (No such file or directory)
      08-12 14:37:22.576: W/ffmpeg4android(16797): Prefs.durationOfCurrent is null
      08-12 14:37:22.576: I/ffmpeg4android(16797): onProgressUpdate: 0
      08-12 14:37:22.576: D/ProgressBar(16797): setProgress = 0
      08-12 14:37:22.576: D/ProgressBar(16797): setProgress = 0, fromUser = false
      08-12 14:37:22.576: D/ProgressBar(16797): mProgress = 0mIndeterminate = false, mMin = 0, mMax = 100
      08-12 14:37:22.636: W/ffmpeg4android(16949): /storage/emulated/0/FaceRetirement/videokit/logs/vk.log: open failed: ENOENT (No such file or directory)
      08-12 14:37:22.636: W/ffmpeg4android(16949): Prefs.durationOfCurrent is null (remote)
      08-12 14:37:22.636: I/ffmpeg4android(16949): ========================Progress from remote: 0
      08-12 14:37:22.876: I/ffmpeg4android(16797): ========calc progress=======
      08-12 14:37:22.876: W/ffmpeg4android(16797): /storage/emulated/0/FaceRetirement/videokit/logs/vk.log: open failed: ENOENT (No such file or directory)
      08-12 14:37:22.876: W/ffmpeg4android(16797): Prefs.durationOfCurrent is null
      08-12 14:37:22.876: I/ffmpeg4android(16797): onProgressUpdate: 0
      08-12 14:37:22.876: D/ProgressBar(16797): setProgress = 0
      08-12 14:37:22.876: D/ProgressBar(16797): setProgress = 0, fromUser = false
      08-12 14:37:22.876: D/ProgressBar(16797): mProgress = 0mIndeterminate = false, mMin = 0, mMax = 100
      08-12 14:37:22.977: D/GestureDetector(16797): [Surface Touch Event] mSweepDown False, mLRSDCnt : -1 mTouchCnt : 8 mFalseSizeCnt:0
      08-12 14:37:22.977: I/ffmpeg4android(16797): Cancel clicked
      08-12 14:37:22.977: I/ffmpeg4android(16797): Setting Prefs.forceStopFlag to true
      08-12 14:37:22.977: E/ffmpeg4android(16949): Calling fexit()
      08-12 14:37:22.977: D/Videokit(16949): calling fexit()
      08-12 14:37:22.977: D/Videokit(16949): from ffmpeg: fexit() called
      08-12 14:37:22.977: E/Videokit(16949): ffmpeg_exit(0) called!

      Delete
    6. 08-12 14:37:22.977: A/libc(16949): Fatal signal 11 (SIGSEGV) at 0x0000047c (code=1), thread 16961 (Binder_2)
      08-12 14:37:23.177: I/ffmpeg4android(16797): ========calc progress=======
      08-12 14:37:23.177: W/ffmpeg4android(16797): /storage/emulated/0/FaceRetirement/videokit/logs/vk.log: open failed: ENOENT (No such file or directory)
      08-12 14:37:23.177: W/ffmpeg4android(16797): Prefs.durationOfCurrent is null
      08-12 14:37:33.187: I/ffmpeg4android(16797): DeadObject Exception after fexit()
      08-12 14:37:33.187: I/Choreographer(16797): Skipped 611 frames! The application may be doing too much work on its main thread.
      08-12 14:37:33.207: I/ffmpeg4android(16797): onProgressUpdate: 0
      08-12 14:37:33.207: D/ffmpeg4android(16797): Releasing wake lock
      08-12 14:37:33.207: D/ffmpeg4android(16797): TranscodeBackground onPostExecute
      08-12 14:37:33.207: D/ffmpeg4android(16797): /storage/emulated/0/FaceRetirement/videokit/logs/null length in bytes: 0
      08-12 14:37:33.207: D/ffmpeg4android(16797): showNotifications
      08-12 14:37:33.207: D/ffmpeg4android(16797): /storage/emulated/0/FaceRetirement/videokit/logs/null length in bytes: 0
      08-12 14:37:33.207: I/ffmpeg4android(16797): setting Prefs.forceStopFlag to false for the next time
      08-12 14:37:33.217: I/ffmpeg4android(16797): FFMPEG finished.
      08-12 14:37:33.227: D/ffmpeg4android(16797): onServiceDisconnected
      08-12 14:37:33.257: E/ViewRootImpl(16797): sendUserActionEvent() mView == null
      08-12 14:37:38.362: I/ffmpeg4android(17110): =======service onCreate(): Stopping forground (to overcome 2.3.x bug)
      08-12 14:37:38.382: I/ffmpeg4android(17110): =======service onBind()=======
      08-12 14:37:38.382: D/ffmpeg4android(16797): Client onServiceConnected()
      08-12 14:37:38.382: I/ffmpeg4android(16797): invokeService called
      08-12 14:37:38.382: D/ffmpeg4android(16797): Not invoking
      08-12 14:37:38.382: I/ffmpeg4android(17110): ===onStartCommand called====
      08-12 14:37:38.382: D/ffmpeg4android(17110): Not running since the OS auto started the service after crash
      08-12 14:37:38.392: I/ffmpeg4android(17110): Cancel notification: 5326



      I followed the instruction as has been laid out in your documentation. I am not sure who creates this vk.log. Also, I am not clear on whether the command is getting executed or not. Can you help me to figure this out so that we can make a decision to buy the software?

      Thanks
      Raj

      Delete
    7. Hi Raj,
      Looks like your code is correct.
      The thing is FFmpeg4Android native code assume /sdcard/ softlink exists on your device.
      What device are you using?

      Delete
    8. Hi John,

      I am using Samsung S4. Is there a way I can like create softlink myself if it is not there?

      Thanks
      Raj

      Delete
    9. And when I tried it on Motorola Droid 4 I got the same lines in the log file

      Delete
    10. I'm dealing with this issue, hopefully I'll have a solution that doesn't need hard coding the external storage in a few days.
      You can use in the meanwhile a device which supports /sdcard/
      Most devices do.

      Delete
    11. BTW,
      You can try to install ffmpeg4android from the market and see if it works on your device, it was tested on s4.

      Delete
    12. This comment has been removed by the author.

      Delete
    13. Hi John,

      Ignore my previous email. It seems that there was an extra space before -r in the command. I am now able to create the video in my S4!! This is good news. I am now waiting for you to fix the code so that I can dynamically create the video from my code.

      The video quality was not so great but I am sure it requires few tweaking which we can take a look later on.

      Thanks
      Raj

      Delete
    14. Hi Raj,
      This are great news!
      Btw, you don't have to wait on me, and you can create videos dynamically from your code.
      The issue I'm fixing is the /sdcard/ dependency, which should not effect you since you have this softlink, as 99% of the android devices out there.
      You should note that I recently found out that this command works on devices that support neon only, which means most of the high end devices will work, but some mid, and most low will not.

      Delete
    15. Hello John,

      I can't create a video dynamically from my code because of the same issue that I posted earlier:

      08-14 13:13:49.006: D/ffmpeg4android(14121): Client Cannot unbind - service not bound
      08-14 13:13:49.006: D/ffmpeg4android(14121): Client stopService()
      08-14 13:13:49.006: I/ffmpeg4android(14121): !!!!!!!!!!!!!!!!!!services.size(): 2
      08-14 13:13:49.006: I/ffmpeg4android(14121): putting Base categoty
      08-14 13:13:49.016: D/ffmpeg4android(14121): started: com.netcompss.ffmpeg4android.FFMpegRemoteServiceBridge
      08-14 13:13:49.016: D/ffmpeg4android(14121): Client startService()
      08-14 13:13:49.016: D/ffmpeg4android(14121): bindService() called
      08-14 13:13:49.016: D/ffmpeg4android(14121): Client bindService()
      08-14 13:13:49.146: D/ffmpeg4android(14121): Client onServiceConnected()
      08-14 13:13:49.146: I/MPSample : invokeService()(14121): invokeService called
      08-14 13:13:49.146: D/ffmpeg4android(14121): deleteing: /storage/emulated/0/FaceRetirement/videokit/logs/vk.log isdeleted: false
      08-14 13:13:49.146: D/ffmpeg4android(14121): deleteing: /storage/emulated/0/FaceRetirement/videokit/logs/ffmpeg4android.log isdeleted: false
      08-14 13:13:49.146: D/ffmpeg4android(14121): deleteing: /storage/emulated/0/FaceRetirement/videokit/logs/videokit.log isdeleted: true
      08-14 13:13:49.146: D/ffmpeg4android(14121): Client invokeService()
      08-14 13:13:49.156: D/ffmpeg4android(14121): Acquire wake lock
      08-14 13:13:49.206: D/ffmpeg4android(14121): TranscodeBackground doInBackground started
      08-14 13:13:50.657: D/ffmpeg4android(14121): onServiceDisconnected
      08-14 13:13:51.508: I/ffmpeg4android(14121): ========calc progress=======
      08-14 13:13:51.508: W/ffmpeg4android(14121): /storage/emulated/0/FaceRetirement/videokit/logs/vk.log: open failed: ENOENT (No such file or directory)
      08-14 13:13:51.508: W/ffmpeg4android(14121): Prefs.durationOfCurrent is null
      08-14 13:13:51.508: I/ffmpeg4android(14121): onProgressUpdate: 0


      I am running the code on Samsung S4. Is there something different that I need to do?

      Thanks
      Raj

      Delete
    16. Please send me the log to android@netcompss.com (ADT log TAGS ffmpeg4android and Videokit)
      If you changed the working directory from /sdcard/videokit to whatever, please revert the change, currently the working directory must be /sdcard/videokit

      Delete
  47. Hi John,

    I have sent you an email with all the logs file and code snippet. Please let me know if you need anything else.

    Thanks
    Raj

    ReplyDelete
  48. I will use the ffmpeg4android library in my application. i want to know if i need purchase it. and ,i want to know ,if i purchase it , i can use the newer vision ffmpeg4android free?

    ReplyDelete
    Replies
    1. Yes, you can build it yourself, or I can send you the apk.

      Delete
    2. I don't need the apk, i mean that i want use ffmpeg mothod in my java code of my android applycation. If I do this, do I need purchase it? And after purchase, I can use the newer vision ffmpeg4android free?. Thank you .

      Delete
    3. You don't need to purchase to use FFmpg4Android, only if you want to benefit from improved performance.
      Actually, its best that you make sure everything is working for you (using the included personal license) before you purchase.

      Delete
    4. Thank you, now,i know the aac encoding is not supported in the FFmpg4Android. I want to know what can i do to use aac and h264 encoding? because my android application need the aac and h264 encoding.

      Delete
    5. H264 is supported (you can see the example commands above), regarding aac, i'll need to check if its possible to add.

      Delete
    6. yes,i just want to know about acc encoding.thank you

      Delete
    7. To convert an audio file to aac please use this command:
      ffmpeg -i /sdcard/videokit/in.mp3 /sdcard/videokit/out.m4a

      Delete
    8. This is also possible:
      ffmpeg -y -i /sdcard/videokit/in.mp4 -strict experimental -vcodec libx264 -crf 24 -acodec aac /sdcard/videokit/out.mkv

      It will do the h264 encoding video encoding and the aac encoding both in one command.

      Delete
    9. if i want to convert a video with h264 and aac encoding, can i use the ffmpeg4android deal with it?

      Delete
    10. Then if i use the ffmpeg4android and this commend , i need not to purchase it ? Even i will publish my application in google play?

      Delete
    11. This comment has been removed by the author.

      Delete
    12. Hi,
      I did some checking, and unfortunately our licensing does not allow publishing on Google Play if you use personal license.
      Persona license if intended for personal use only.
      Only using OEM license you can publish on Google Play.

      Delete
    13. Hi,
      I Want to know Is ffmpeg4android support multiple filtering??????

      Delete
    14. Its currently not supported, but we are working on it.
      Its very possible we will have a beta version in about a week.

      Delete
  49. hello John,
    I have already purchased license of ffmpeg4android and I need multiple filtering functionality to my application.Its too much urgent for me so will you assure me to add this functionality as fast as possible.Here is my mail address mindtestandroid@gmail.com .I want to share my command with you to know whether ffmpeg4android will support my command????

    ReplyDelete
    Replies
    1. Please send the command, and we will prioritize it.

      Delete
    2. I sent you command on this mail address "android@netcompss.com" please check it

      Delete
  50. Hello,
    first of all, great project, and just what I currently need. :)
    I do have a slight issue in getting the demo code to work on a Samsung Galaxy Tab 2 10.1, Acer Iconia Tab A101, and Samsung Xcover.

    More specifically I try to run the following command:

    ffmpeg -i /sdcard/videokit/in.mp3 -i /sdcard/videokit/in.mp4 /sdcard/videokit/out.mp4

    But nothing happens, except lots of print lines of:

    /mnt/sdcard/videokit/vk.log: open failed: ENOENT (No such file or directory)

    which is silly, since both the directory and file are there (I manually added them, just to be sure they actually did exist).
    After n seconds the app just crashes, and unfortunately no log is created, so no real idea why it crashes.

    Apart from that, it works just fine on Samsung Galaxy S2 and Samsung Galaxy Nexus.

    The company I work for would love to buy a license, but before that I do need to ensure I can actually get it to work on our test devices. And so far it only works on 2 out of 5 devices, which really isn't assuring.

    Any idea why it's not working, and possibly how to make it work?

    Thanks in advance.

    Jens

    www.onlimited.dk

    ReplyDelete
    Replies
    1. Hi Jens,
      Its possible version 7 has issues on some devices.
      Please contact Eli (android@netcompss.com) and he will send you version 6.1

      Delete
    2. I added a section to this tutorial to deal with your issue,
      Please see:
      Supporting all ARM based devices
      Section

      Delete
    3. You can also make a quick test with version 6 apk and check if it works for you, download version 6 from here:
      https://docs.google.com/file/d/0Bx0UFjlzTeT2QllJRnJUSE40TXc/edit?usp=sharing

      Delete
  51. i want ffmpeg command to do transition effect between images.

    ffmpeg -y -r 1/5 -i img00%d.jpg -loop_input -shortest -i 4.mp3 -acodec copy out.avi


    above command is correctly working,
    now i want to do transition effects between each image like

    - fade in
    - fade out
    - left slide
    - right slide

    already tried the below code not working correctly...

    ffmpeg -y -r 1/5 -i img00%d.jpg -loop_input -shortest -i 4.mp3 -vf fade=in:0:3 out.avi

    ReplyDelete
    Replies
    1. Hi,
      This is working on our next version:
      ffmpeg -y -r 1/5 -i /sdcard/videokit/pic00%d.jpg -shortest -i /sdcard/videokit/in.mp3 -acodec copy -vf fade=in:0:10 /sdcard/videokit/out.avi

      Delete
    2. thanks for your reply.....how to do left slide,right slide,fadein,fadeout between each image...

      Delete
    3. Hi Raj,
      I don't see any slide support in the FFmpeg docs, if you know otherwise please point me in the right direction.
      also, the filters does not "know" where is the next picture you need to tell it by setting the frame number in which you want to start the filter.

      Delete
    4. ok then tell me how to do tranisition effect like left slide,right slide etc for every 5 frame

      Delete
  52. Hi, I'm using FFmpeg4android and want to run two commands in sequence, first run 1) command and when first command finish run the second one, for example:

    1) ffmpeg -y -i /sdcard/Woop/VID_1.mp4 -vf crop=480:480:0:0 -r 15 -aspect 1:1 /sdcard/Woop/out.mp4
    2) ffmpeg -y -i /sdcard/Woop/out.mp4 -vf transpose=1 -r 15 -aspect 1:1 /sdcard/Woop/out2.mp4

    How can i do this? I tried setCommand(command1); setCommand(command2); runTranscoing(); but it doesn't work.

    ReplyDelete
    Replies
    1. I have also tried this, but LogCat give me this error -> "Error opening filters!", if I put a colon (,) between crop & transpose commands LogCat give me this error -> ", invalid argument":

      ffmpeg -y -i /sdcard/Woop/VID_1.mp4 -vf "crop=480:480:0:0,transpose=1" -r 15 -aspect 1:1 /sdcard/Woop/out.mp4

      Delete
    2. Hi Leo,
      This will be supported in out next version (due in a few days).

      Delete
    3. Ok thanks, but what I want is only crop the video and then transpose it. is there no way to do it by chaining filters?

      Delete
    4. It will be supported in the coming version.

      Delete
  53. Is there a way that encoding run in background? how can i do it? a dialog window is always launched when doing it.

    ReplyDelete
    Replies
    1. Acualy, it always work on the background. To do other stuff click on the home button, and follow the progress via the notification icon.

      Delete
  54. 8.0.01 published:
    Old devices support is now introduced back to ver 8.

    ReplyDelete
  55. Please help me with a ffmpeg command for curves. I want to make vintage a video recorded with android device. Thanks

    ReplyDelete
    Replies
    1. commandStr = "ffmpeg -y -i /sdcard/videokit/in.mp4 -strict experimental -vf curves=vintage -s 640x480 -r 30 -aspect 4:3 -ab 48000 -ac 2 -ar 22050 -b 2097k -vcodec mpeg4 /sdcard/videokit/curve.mp4";

      Delete
  56. New version published:
    8.0.02
    ------
    * Improved error detection.

    ReplyDelete
  57. New version 8.0.04
    * transcoding engine upgraded (1.1.02)
    1.1.02
    -------
    1. ffmpeg4android version code added.
    2. removed docs.
    3. removed ffmpeg configuration.

    ReplyDelete
  58. Hello,

    It seems that demo doesnt support multiple input. Am I doing something wrong or it is demo limitation? I specify multiple input files through -i /path/to/file

    ReplyDelete
  59. Its supported,
    Please make sure you use the latest version, and see in the commands2.txt similar example.
    If you still have problems, please post your command here, and I will try to assist.

    ReplyDelete
  60. Version 8.1 is published (Google Play and source code in our site).
    * Added support for setting the output file.
    * Added support for setting the finish notification description.
    * Added support for playing the output file via the notification.
    * 4.3 play file bug fix.
    * Demo command changed output file name to make it more consistent.

    ReplyDelete
  61. Hello,

    It is possible to use your library without having a popup for the transcoding? And it is compatible with Intel x86 phones?

    ReplyDelete
    Replies
    1. Yes, its possible via using the native directly, or customizing the java source, I will upload a guide soon.
      Regarding Intel, I tested on tab3 10.1 and it worked perfectly, Intel is doing some kind of ARM emulation, and its performes well.

      Delete
    2. Thank your for this fast answer ! I have another question, how it is possible that the transcoding is faster with OEM license? I tried to change the licenseCheck() method to 1 to test the performences of the OEM verison to know if I will buy it, but it doesn't go faster...

      Delete
    3. Its no longer works like this, from version 8.1, both trial and oem have the same performance, and use the transcoding engine.
      Trial is limited to 15 days.

      Delete
  62. I tried to use your library in my application, here what i have done :

    String commandStr = "ffmpeg -y -i /sdcard/music.wav /sdcard/music.mp3";
    setCommand(commandStr);
    runTranscoding();

    My activity extends BaseWizard.

    But the conpression doesn't start...

    Here is the log :

    Command is set
    Client Cannot unbind - services not bound
    Client stopService()
    !!!!!!!!!!!!!!!services.size():0
    Client startService()
    bindService called
    Client bindService()

    Can you help me find out the problem?

    PS : I successfuly compressed mp3 files with a test application i done with your library, so I dont know why it fail in my application...

    ReplyDelete
    Replies
    1. Hi Victor,
      Did you follow the project creation guide?
      https://docs.google.com/document/d/1Bgdg_I3IrQ2ifvMClLTNaVlA_WbGgkoPIVXpuaYaMLM/edit?usp=sharing

      Delete
    2. I didn't know this document, but yes I did all the step. I succeeded in compressing the audio file with the Demo App but not in my application...

      The last log i see is "Client bindService()"

      And after, nothing...

      Delete
    3. In the onCreate of my activity that extends BaseWizard, i have also :

      _prefs = new Prefs();
      _prefs.setContext(this);

      setWorkingFolder("/sdcard/ffmpeg/");

      copyLicenseAndDemoFilesFromAssetsToSDIfNeeded();

      Delete
    4. The DemoClient is a fairly Simple class, all it does is to Extend the BaseWizard, then, setCommand(commandStr);
      runTranscoing();

      If your Class will do the same it should work.

      Delete
    5. I put

      _prefs = new Prefs();
      _prefs.setContext(this);

      setWorkingFolder("/sdcard/ffmpeg/");
      setProgressBar(progressBar);

      copyLicenseAndDemoFilesFromAssetsToSDIfNeeded();

      just before a called setCommand and runTranscoding, and it worked !

      Delete
    6. Yes,
      Currently the :
      _prefs = new Prefs();
      _prefs.setContext(this);

      Are needed (which is stupid), I will try to remove it for the next version.

      Delete
  63. Sorry to disturb you again, but what is the list of the audio formats that are available in your library? I tried mp3 but it's using liblame, witch is the codec i was already using before, so it's not faster, it's even longer... It take 1 min to compress 1min40 of audio (very long). So maybe other codecs can be faster ?

    Also, the conversion stops when the length of the output mp3 is 1 min... It is a limitation to the OEM license or a bug?

    Thank you in advance,

    Victor

    ReplyDelete
    Replies
    1. 1. I will have to extract the list, please send me your email to android@netcompss.com and I will send you the list.

      2. What device do you use? and what command, this can greatly effect performance.

      3. In some cases of memory shortage, or incoming phone call, android can remove the transcoding process. this is not related to the license.

      Delete
  64. I just send you an email.
    I use a Galaxy Note 2
    This is the command i use : "ffmpeg -y -i /sdcard/music.wav /sdcard/out.mp3"
    I also tried to change the bitrate (-ab 256K) but it doesn't change the performance.
    It always stop after precisely 1min of encodage, always. And what is strange is that the percentage of progress is 100% after 1 minute, so it doesn't really stops like a bug or an error...

    ReplyDelete
    Replies
    1. OK, I will try to reproduce it.

      Delete
    2. I used this command:
      ffmpeg -y -i /sdcard/videokit/out.wav /sdcard/videokit/sha2.mp3

      out.wav is 43M in size.
      It was converted in around 30secs to sha2.mp3 which its size was 1.43M
      No errors in the log, I played the output, and it was OK.

      Please send me the /sdcard/videokit/vk.log content, and I will try to trace your issue.

      Delete
    3. Hello,

      I downloaded the last version (8.1.03) and made a little test application, and it also stopped after 1min of encoding...

      Here is my test application with music.wav and the created out.mp3 : http://goo.gl/rNkxNa

      And the vk.log : http://pastebin.com/JbmgSVeS

      Thank you for your patience !

      Delete
    4. Thanks,
      I found the issue, I will send you a fix shortly

      Delete
    5. Published version 8.1.04 that contains the fix.

      Delete
    6. Thank you, I just downloaded the new version and It now seems to encode the entire file (the out.mp3 size is 4.47Mo).
      But, the transcoding is very slow, it took more than 4 min... (and i was strange because at the end it stays at 100 % for like 1 min even if the transcoding was not finished yet)

      Can you try the project i gave to you with the same .wav file ? (http://goo.gl/rNkxNa)

      Regards,

      Delete
    7. Hi Victor,
      This is around the time it takes me, it should be stuck on 99% for one min, this is because the sound file you used does not contain a duration information, and the default duration is used (3mins).
      So, basicly, everything is as designed.

      Delete
    8. I'm sorry but you said
      "out.wav is 43M in size.
      It was converted in around 30secs to sha2.mp3 which its size was 1.43M"
      So I didn't really understand your last comment. Can you send a zip file with the project and .wav file you used ?

      Regards,

      Delete
    9. Yes, I said it, but it happened because of the bug you reported (and it now fixed), it only converted the first one minute.

      Delete
  65. 8.1.03
    ------
    * Removed the need to use the prefs in the clients (e.g demo activity).
    * Full support for old devices (armv5).

    ReplyDelete
  66. 8.1.04
    -------
    * Critical bug fix related to cases in which the duration can't be found in the input file.

    ReplyDelete
  67. Hello,

    first good work for the lib, is great in order to avoid the native integration mess

    I have a pretty specific need, to play a mkv on android devices, atm the idea has been to get the mkv (is a net stream) and straem it back via udp, then read the udp:

    - On the demo client, invoke " ffmpeg -re -i http//mystreamurl.mkv -strict -2 -f rtp -an udp://127.0.0.1:1111 "

    This works, as i can then play the udp stream (video only ofc) on mx player

    But, I need to now play the stream from inside the app - videoView doesnt play udp directly, so I try in the demo client the following:

    - Added a player activity
    - On player activity oncreate: " ffplay udp://localhost:1111 "

    but keep fails - looks like when I launch another command it ends the previous straeming... so the question is: how I can stream and playback in the same device?

    ReplyDelete
  68. Hi,
    Ffplay is not part of ffmpeg4android,
    You need to write a player that supports streaming, my guess is the best place to start is vlc android code.

    ReplyDelete
    Replies
    1. Hello John - thanks for the reply

      on the sample commands I see:

      // use this command to play the video on the target machine
      ffplay -f mpegts -ast 1 -vst 0 -ar 48000 udp://192.168.0.114:8090

      I also actually don't get immediately an error when launching ffplay from ffmpeg4android... the logs shows me the file start to be read, but nothing show and then it force close (fexit) the previous ongoing command that do the stream

      I would avoid vlc for android as from the last tests i do with it looks still too much unstable and early beta for use as a base for a production project (otherwise I would used it from start as it supports mkv playback alraedy) - is a bit out of topic but can you eventually point me to something else? atm the only thing I want to accomplish is play a udp stream from udp://localhost:1111 (ass aid the stream comes as i can play it with mx player)

      Delete
    2. Thanks for the info, I fixed the post so it would be more clear regarding ffplay.
      Another way to go (investigate) is to look for Java rtp implementations, then extend the sdk player to support it.

      Delete
  69. My activity has to extend SherlockFragment, so I can't also extend BaseWizard. What can I do?
    thanks.

    ReplyDelete
  70. You have full source code,
    You can create a new base class that extends this fragment, follow the lead of BaseWizard.

    ReplyDelete
  71. I am trying to trim the video using FFmpeg4android library, and trying the following commands:

    ffmpeg -i video.avi -vcodec copy -acodec copy -ss 00:00:00 -t 00:00:04 trimmed_video.avi (running)

    ffmpeg -ss 00:00:43 -t 00:01:08 -i /mnt/sdcard/Beasting366/thenationalanthem.mp4 -acodec copy -vcodec copy /mnt/sdcard/Beasting366/1385205055475.mp4

    ffmpeg -ss 00:00:43 -t 00:01:08 -i /mnt/sdcard/Beasting366/in2.mp4 -acodec copy -vcodec copy
    /mnt/sdcard/Beasting366/1385231199249.mp4

    but none of the above commands are working. The above commands are working only with new FFmpeg4android application version which is given in play store.
    Please help me for solving this problem.

    ReplyDelete
  72. You need to uninstall the market version and delete the /sdcard/videokit folder, then run your app to the device.

    ReplyDelete
  73. Thanks for the reply. I have also followed the above process. But still I am getting the same problem.
    The command:
    "ffmpeg -y -i 101_0077.MP4 -vcodec copy -acodec copy -ss 00:00:00 -t 00:00:01 out.mp4"
    is working with play store version but it is not working with the source version and also source version does not give full log. I am getting the log:
    "Input file size: -1
    VK log is not changing in size, and no exit token found
    TranscodeBackground onPostExecute ifexist called from ffmpeg".

    ReplyDelete
    Replies
    1. Uploaded new version which fix your issue (make sure you upgrade your demo client, and the ffmpeg4android library):

      8.1.07
      ------
      * Kitkat play support.
      * SDK upgraded to 4.4.
      * Added alert dialog in case license validation failed.
      * Removed license file from the demo client assets.

      Delete
  74. Thanks you very much for the upgraded version.

    I want to fast forward the video to a particular time. Can you please give me the command for that which can run in your library. Or the command should atleast increase the frame rate of the video to make it fast forward.

    ReplyDelete
    Replies
    1. String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/videokit/in.mp4","-strict","experimental", "-filter_complex", "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]","-map","[v]","-map","[a]", "-b", "2097k","-r","60", "-vcodec", "mpeg4", "/sdcard/videokit/out.mp4"};

      Delete
  75. Thanks the above code is working absolutely fine.
    I have used following command for concat two files:

    String[] joinVidComm = { "ffmpeg", "-y", "-i",
    "/sdcard/videokit/in3.mp4", "-i", "/sdcard/videokit/in5.mp4",
    "-strict", "experimental", "-filter_complex",
    "[0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1", outputFile };

    But the above command works only for concating the same file. Can you give command for concat two different files?

    ReplyDelete
    Replies
    1. Hi,
      Yep, and its written in the description, its for video files with the same codec size fps.
      This command should merge cuts from the original video.
      I think your request is possible to implement (in one command), I just don't have it on my commands list, and I'm not an FFmpeg command line expert.
      I'll appreciate if someone from our excellent users can help on this.

      Delete
    2. Hi John,

      Do you have command for joining two different video files?

      Delete
  76. hi John

    I'm try the command
    "ffmpeg -y -i frame%d.jpg -r 30 output.mp4"
    but it not working
    I try run command in the device Galaxy S2
    the frame name be frame1.jpg, frame2.jpg etc
    Please help me!

    ReplyDelete
    Replies
    1. Hi,
      Please try to use full paths:
      commandStr = "ffmpeg -y -r 1/5 -i /sdcard/videokit/pic00%d.jpg /sdcard/videokit/out.mp4";

      Delete
  77. Hello,

    We would like to develop a video editing app on Android for our client. The app would allow user to preview the video when adding some filter/effect to it. I know that ffplay command can do that, e.g.
    ffplay 1.mp4 -vf curves=vintage

    But from the previous comments above, it seems that your library does not support ffplay.
    Do you have any plan to support it in the near future?

    Thanks,
    David

    ReplyDelete
    Replies
    1. Hi David,
      No, we don't plan to support ffplay.
      Just curious, why use ffplay when you can convert the video using ffmpeg, and play it using the SDK player?

      Delete
    2. Hi John,

      Appreciate for your prompt reply.
      Actually the client expect real-time preview, i.e. user can choose an effect and preview it immediately. Converting the video would take a while and they don't want user to wait.

      -David

      Delete
    3. I see, that's for the clarification.

      Delete