【问题标题】:Android and JNI, pipe data to FFmpegAndroid 和 JNI,管道数据到 FFmpeg
【发布时间】:2014-03-03 01:08:49
【问题描述】:

我正在尝试创建一个基于 FFmpeg 的元数据检索器。由于原始 Android 应用程序资源通常只能使用文件描述符访问,因此我需要一种通过 JNI 将这些数据传输到 FFmpeg 的方法。我知道 FFmpeg 支持“管道”协议:

UNIX pipe access protocol.

Allow to read and write from UNIX pipes.

The accepted syntax is: 

    pipe:[number]

number is the number corresponding to the file descriptor of the pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If number is not specified, by default the stdout file descriptor will be used for writing, stdin for reading.

For example: cat test.wav | ffmpeg -i pipe:0

我的问题是,如何以编程方式模拟 cat test.wav | ffmpeg -i pipe:0 使用 JNI 和 avformat_open_input 使用 FileDescriptor?这可能吗?

【问题讨论】:

  • 这个问题怎么样?
  • 我不确定我明白你在问什么,你能改写一下这个问题吗?
  • 想问如何在Java层创建命名管道,并传递JNI

标签: java android ffmpeg java-native-interface


【解决方案1】:

来自AndroidFFmpeg 项目的人实现了“jni://”协议以通过 JNI 流式传输数据,请参阅https://github.com/appunite/AndroidFFmpeg/blob/master/FFmpegLibrary/jni/jni-protocol.c

我不知道它是如何使用的,只是我偶然发现了那个文件并看到了你的问题。我认为您可以使用相同的解决方案。

您可能想看看这篇文章:https://stackoverflow.com/a/24747137/1028256 关于将 FileDescriptor 传递给 JNI

【讨论】:

  • You may want to look at this post... 你把他推荐给了他自己的帖子。
猜你喜欢
  • 2011-05-20
  • 2018-03-27
  • 2020-01-30
  • 1970-01-01
  • 2015-11-16
  • 2016-07-07
  • 2022-11-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多