我需要将多个图像(我有完整的路径)编码到android上某个FPS的视频中。
审判:How to create a video from an array of images in Android?
为什么我不能让它工作:我在gradle文件中添加了Jcodec依赖性(
compile 'org.jcodec:jcodec:0.2.3'
compile 'org.jcodec:jcodec-android:0.2.2'
)然后我将代码粘贴到一个函数中,这就是我得到的结果:

如您所见,我成功地导入了SequenceEncoder (导入org.jcodec.api.SequenceEncoder;),但是它不识别缓冲图像(我认为这是因为我必须使用位图)
这给了我SequenceEncoder中的一个错误。
也不识别encodeImage方法。
然后,我尝试使用在JCodec webSite上找到的代码:
SeekableByteChannel out = null;
try {
out = NIOUtils.writableFileChannel("/tmp/output.mp4");
// for Android use: AndroidSequenceEncoder
AWTSequenceEncoder encoder = new AWTSequenceEncoder(out, Rational.R(25, 1));
for (...) {
// Generate the image, for Android use Bitmap
BufferedImage image = ...;
// Encode the image
encoder.encodeImage(image);
}
// Finalize the encoding, i.e. clear the buffers, write the header, etc.
encoder.finish();
} finally {
NIOUtils.closeQuietly(out);
}但是它不识别AWTSequenceEncoder,因此不识别encodeImage和finish方法。
我做错了什么?
发布于 2018-09-05 11:34:31
好的,我找到了这个问题的答案,从技术上讲是在这个问题的答案中:How to create a video from an array of images in Android?
但是只有两张选票,尽管是唯一对我有效的人,也是我发现的唯一应该起作用的人。您不能在android中使用SequenceEncoder,而最有投票权的do和我没有找到的AndroidSequenceEncoder.被替换为AndroidSequenceEncoder.
https://stackoverflow.com/questions/52168452
复制相似问题