简体   繁体   English

ffmpeg H264 字节流转图像或视频文件 [Java]

[英]ffmpeg H264 bytestream to image or video file [Java]

I have a Java function which receives bytes of an H264 stream as follows:我有一个 Java 函数,它接收 H264 流的字节,如下所示:

void bytesReceived(byte[] bytes, int size) void bytesReceived(byte[] bytes, int size)

Using ffmpeg, how can I transcode these bytes to some sort of image format?使用 ffmpeg,如何将这些字节转码为某种图像格式? I would be happy with mp4, jpeg, etc. I've seen lots of examples using files and ffmpeg, but I don't know how I'd use the command line operations it offers to handle a stream of bytes.我对 mp4、jpeg 等很满意。我看过很多使用文件和 ffmpeg 的示例,但我不知道如何使用它提供的命令行操作来处理字节流。

Thanks.谢谢。

Since you incoming data is already compressed (H.264) and you are fine with MP4.由于您传入的数据已经被压缩(H.264)并且您可以使用 MP4。 I'd use https://github.com/sannies/mp4parser to just wrap your incoming H.264 stream into a MP4 file in pure Java.我会使用https://github.com/sannies/mp4parser将传入的 H.264 流包装成纯 Java 的 MP4 文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM