title: JavaCV generate video from images Crashes
body: <p>I am doing javacv with android since yesterday and getting error while generating video from image (IplImage) using <strong>FFmpegFrameRecorder</strong> or <strong>FrameRecorder</strong> while getting succes in imagefiltering using <strong>cvCvtColor</strong> and <strong>cvCvtColor</strong>.</p>
  
  <p><img src="https://i.stack.imgur.com/BX8KW.png" alt="grayscale"></p>
  
  <p>As shown in picture , <strong>Grayscale</strong> and <strong>flip</strong> filter is done by clicking second Button <strong>(Apply Effect)</strong>.</p>
  
  <p>But when clicking <strong>(Make Video)</strong> it crashes. </p>
  
  <p>Here is my code for making video from image.</p>
  
  <pre><code>String path = Environment.getExternalStorageDirectory().getPath() + "/test.mp4";
  Log.i("path", path);
  FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(path, 256, 256);
  try {
  
      recorder.setVideoCodec(avcodec.AV_CODEC_ID_MPEG4);
      // recorder.setCodecID(avcodec.AV_CODEC_ID_H263);
      recorder.setFormat("mp4");
      recorder.setPixelFormat(avutil.AV_PIX_FMT_YUV420P);
      recorder.start();
      for (int i = 0; i &lt; 10; i++) {
  
          recorder.record(image);
      }
      recorder.stop();
  } catch (Exception e) {
  
      e.printStackTrace();
  }
  </code></pre>
  
  <p><strong>image</strong> is of type IplImage</p>
  
  <p>getting error on <strong>recorder</strong> object creation.</p>
  
  <p>I am using 2 devices </p>
  
  <p>1)Asus zenfone 5</p>
  
  <p><strong>Stacktrace</strong></p>
  
  <pre><code>Caused by: java.lang.NoClassDefFoundError: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avcodec
              at org.bytedeco.javacpp.Loader.load(Loader.java:387)
              at org.bytedeco.javacpp.Loader.load(Loader.java:353)
              at org.bytedeco.javacpp.avformat.&lt;clinit&gt;(avformat.java:13)
              at org.bytedeco.javacv.FFmpegFrameRecorder.&lt;clinit&gt;(FFmpegFrameRecorder.java:106)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.makeVideo(MainActivity.java:191)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.doInBackground(MainActivity.java:180)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.doInBackground(MainActivity.java:152)
              at android.os.AsyncTask$2.call(AsyncTask.java:288)
              at java.util.concurrent.FutureTask.run(FutureTask.java:237)
              at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
              at java.lang.Thread.run(Thread.java:841)
       Caused by: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avcodec
              at java.lang.Class.classForName(Native Method)
              at java.lang.Class.forName(Class.java:251)
              at org.bytedeco.javacpp.Loader.load(Loader.java:385)
              at org.bytedeco.javacpp.Loader.load(Loader.java:353)
              at org.bytedeco.javacpp.avformat.&lt;clinit&gt;(avformat.java:13)
              at org.bytedeco.javacv.FFmpegFrameRecorder.&lt;clinit&gt;(FFmpegFrameRecorder.java:106)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.makeVideo(MainActivity.java:191)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.doInBackground(MainActivity.java:180)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.doInBackground(MainActivity.java:152)
              at android.os.AsyncTask$2.call(AsyncTask.java:288)
              at java.util.concurrent.FutureTask.run(FutureTask.java:237)
              at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
              at java.lang.Thread.run(Thread.java:841)
       Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app-lib/com.example.javacvex1-1/libjniavcodec.so" has unexpected e_machine: 40
              at java.lang.Runtime.loadLibrary(Runtime.java:364)
              at java.lang.System.loadLibrary(System.java:526)
              at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:535)
              at org.bytedeco.javacpp.Loader.load(Loader.java:410)
              at org.bytedeco.javacpp.Loader.load(Loader.java:353)
              at org.bytedeco.javacpp.avcodec.&lt;clinit&gt;(avcodec.java:12)
              at java.lang.Class.classForName(Native Method)
              at java.lang.Class.forName(Class.java:251)
              at org.bytedeco.javacpp.Loader.load(Loader.java:385)
              at org.bytedeco.javacpp.Loader.load(Loader.java:353)
              at org.bytedeco.javacpp.avformat.&lt;clinit&gt;(avformat.java:13)
              at org.bytedeco.javacv.FFmpegFrameRecorder.&lt;clinit&gt;(FFmpegFrameRecorder.java:106)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.makeVideo(MainActivity.java:191)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.doInBackground(MainActivity.java:180)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.doInBackground(MainActivity.java:152)
              at android.os.AsyncTask$2.call(AsyncTask.java:288)
              at java.util.concurrent.FutureTask.run(FutureTask.java:237)
              at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
              at java.lang.Thread.run(Thread.java:841)
       Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app-lib/com.example.javacvex1-1/libavcodec.so" has unexpected e_machine: 40
  </code></pre>
  
  <p>2) Htc me tablet</p>
  
  <p><strong>(Stacktrace)</strong></p>
  
  <pre><code>Caused by: java.lang.ExceptionInInitializerError
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.makeVideo(MainActivity.java:191)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.doInBackground(MainActivity.java:180)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.doInBackground(MainActivity.java:152)
              at android.os.AsyncTask$2.call(AsyncTask.java:264)
              at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
              at java.util.concurrent.FutureTask.run(FutureTask.java:137)
              at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
              at java.lang.Thread.run(Thread.java:856)
       Caused by: java.lang.ExceptionInInitializerError
              at org.bytedeco.javacv.FFmpegFrameRecorder.&lt;clinit&gt;(FFmpegFrameRecorder.java:106)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.makeVideo(MainActivity.java:191)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.doInBackground(MainActivity.java:180)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.doInBackground(MainActivity.java:152)
              at android.os.AsyncTask$2.call(AsyncTask.java:264)
              at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
              at java.util.concurrent.FutureTask.run(FutureTask.java:137)
              at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
              at java.lang.Thread.run(Thread.java:856)
       Caused by: java.lang.ExceptionInInitializerError
              at java.lang.Class.classForName(Native Method)
              at java.lang.Class.forName(Class.java:217)
              at org.bytedeco.javacpp.Loader.load(Loader.java:385)
              at org.bytedeco.javacpp.Loader.load(Loader.java:353)
              at org.bytedeco.javacpp.avformat.&lt;clinit&gt;(avformat.java:13)
              at org.bytedeco.javacv.FFmpegFrameRecorder.&lt;clinit&gt;(FFmpegFrameRecorder.java:106)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.makeVideo(MainActivity.java:191)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.doInBackground(MainActivity.java:180)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.doInBackground(MainActivity.java:152)
              at android.os.AsyncTask$2.call(AsyncTask.java:264)
              at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
              at java.util.concurrent.FutureTask.run(FutureTask.java:137)
              at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
              at java.lang.Thread.run(Thread.java:856)
       Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1936]:    76 could not load needed library 'libavcodec.so' for 'libjniavcodec.so' (find_library[1199]:    76 'libavcodec.so' failed to load previously)
              at java.lang.Runtime.loadLibrary(Runtime.java:370)
              at java.lang.System.loadLibrary(System.java:535)
              at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:535)
              at org.bytedeco.javacpp.Loader.load(Loader.java:410)
              at org.bytedeco.javacpp.Loader.load(Loader.java:353)
              at org.bytedeco.javacpp.avcodec.&lt;clinit&gt;(avcodec.java:12)
              at java.lang.Class.classForName(Native Method)
              at java.lang.Class.forName(Class.java:217)
              at org.bytedeco.javacpp.Loader.load(Loader.java:385)
              at org.bytedeco.javacpp.Loader.load(Loader.java:353)
              at org.bytedeco.javacpp.avformat.&lt;clinit&gt;(avformat.java:13)
              at org.bytedeco.javacv.FFmpegFrameRecorder.&lt;clinit&gt;(FFmpegFrameRecorder.java:106)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.makeVideo(MainActivity.java:191)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.doInBackground(MainActivity.java:180)
              at com.example.javacvex1.MainActivity$asyncImageProcVideo.doInBackground(MainActivity.java:152)
              at android.os.AsyncTask$2.call(AsyncTask.java:264)
              at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
              at java.util.concurrent.FutureTask.run(FutureTask.java:137)
              at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
              at java.lang.Thread.run(Thread.java:856)
       Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1936]:    76 could not load needed library 'libswresample.so' for 'libavcodec.so' (load_library[1091]: Library 'libswresample.so' not found)
  </code></pre>
  
  <p>At last I am putting my <strong>build.gradle</strong> with <strong>jniLibs</strong> on left side.</p>
  
  <p><img src="https://i.stack.imgur.com/abZOW.png" alt="enter image description here"></p>
  
  <p>No luck with answers from other questions. Stuck since last 24 hours. :(</p>
  
  <p>Any help will be great.</p>