каков абсолютный путь к output.mp4, сгенерированному из этих примеров кодов jcodec? - PullRequest
0 голосов
/ 28 апреля 2018

Я использую следующие коды из JCodec в MainActivity, что расширяет AppCompatActivity для создания видео с набором изображений из памяти в Android, но я путаюсь с фактическим путем:

        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);
    }

Я получаю следующее исключение:

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)

Я хочу увидеть сгенерированный выходной файл из проводника Windows. Я новичок. Что я должен делать. Пожалуйста, помогите мне.

...