1

Android で基本的なビデオ エディターを構築しようとしています。これは、複数のビデオ ファイルを取得し、それらを 1 つのビデオ ファイルに次々と書き込むだけです。小さなクリップをすべて取得して書き込むループを作成しようとしました。 1つの大きなファイルに変換しますが、これにより、すべてのファイルを大きなビデオに書き込む代わりに、破損したファイルが1つしか得られません。どうすればこれを実現できますか? 以下は私がこれを行うために書いた私のコードです。

File[] files = tempDirectory.listFiles();

    if (files != null) {

        try {

            for (File f : files) {

                FileOutputStream fileOutput = new FileOutputStream(assembleFile);

                InputStream is = new FileInputStream(f);

                byte[] buffer = new byte[1024];
                int bufferLength = 0;

                while ((bufferLength = is.read(buffer)) > 0) {
                    // add the data in the buffer to the file in the file
                    // output
                    // stream (the file on the sd card
                    fileOutput.write(buffer, 0, bufferLength);
                }
                // close the output stream when done
                fileOutput.close();
                is.close();

            }

        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }
4

1 に答える 1

0

単一の作業ビデオを作成することを期待して、ビデオ ファイルを接着することはできません。この質問で言及されているようなビデオ操作ライブラリを使用してみてください: Java でビデオを操作するためのライブラリ/チュートリアル

于 2013-06-14T00:05:40.637 に答える