0

I am using the following codes from JCodec in the MainActivity which extends AppCompatActivity to make a video with a set of images from memory in android, but getting confused about the actual path:

        Bitmap[] bitmaps = new Bitmap[3];
    bitmaps[0] = BitmapFactory.decodeResource(getResources(), R.raw.raw1);
    bitmaps[1] = BitmapFactory.decodeResource(getResources(), R.raw.raw2);
    bitmaps[2] = BitmapFactory.decodeResource(getResources(), R.raw.raw3);

    SeekableByteChannel out = null;
    try {
        out = NIOUtils.writableFileChannel("/tmp/output.mp4");
        // for Android use: AndroidSequenceEncoder
        AndroidSequenceEncoder encoder = new AndroidSequenceEncoder(out, Rational.R(25, 1));
        for (int i = 0; i < bitmaps.length; i++) {
            // Generate the image, for Android use Bitmap
            // Encode the image
            encoder.encodeImage(bitmaps[i]);
        }
        // Finalize the encoding, i.e. clear the buffers, write the header, etc.
        encoder.finish();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        NIOUtils.closeQuietly(out);
    }

I am getting the following Exception:

java.io.FileNotFoundException: /tmp/output.mp4: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:452)
at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
at java.io.FileOutputStream.<init>(FileOutputStream.java:127)
at java.io.FileOutputStream.<init>(FileOutputStream.java:116)
at org.jcodec.common.io.NIOUtils.writableFileChannel(NIOUtils.java:365)
at com.riseup.aamsharif.jcodectest.MainActivity.onCreate(MainActivity.java:37)
at android.app.Activity.performCreate(Activity.java:6323)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)
at android.app.ActivityThread.access$900(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1347)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5451)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
at libcore.io.IoBridge.open(IoBridge.java:438)

I want to see the generated output file from windows explorer. I am a newbie. What should I do. Please, help me.

AAMSharif
  • 1
  • 1
  • `want to see the generated output file from windows explorer.` Well it is not generated as you have a FileNotFoundException. Further you should use a file explorer app on your device if you wanna look for files on your device. Well if they are not in apps private internal storage. – greenapps Apr 28 '18 at 12:54
  • `out = NIOUtils.writableFileChannel("/tmp/output.mp4");` So you use a non existing and impossible path. Start to use a decent path first. – greenapps Apr 28 '18 at 12:56

0 Answers0