1

我正在尝试使用管道从视频中提取帧以获得更好的提取性能。我花了 1s 从视频中提取 1080x720 帧。所以,我的想法是使用管道协议,在使用 ffmpeg 命令提取时,我有另一个线程将管道读取为位图。可能吗?

这就是我在 Android 中所做的:

String pipe = Config.registerNewFFmpegPipe(context);
FFmpeg.execute("ffmpeg -re -y -i rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov -f image2pipe -r 1 " + pipe);

然后,我在另一个线程中读取了管道:

if (fileInputStream == null) {
      fileInputStream = new BufferedInputStream(new FileInputStream(pipe)); // open pipe once
}
String value = convertStreamToString(fileInputStream); // read from pipe

但是,这段代码 new FileInputStream(pipe) 需要很长时间才能完成。我的代码有问题吗?

4

0 回答 0