1

SO...

I have a Java FX application that runs an embedded HTTP Live Streaming server for video playback using the Media class (NOT live streaming, video on demand). The video playback consists of multiple files that are actually storing a collection of RTP packets. When my HttpHandler is called to handle the get request for the files (entries in the .m3u8 index file), I plan on...

  • Loading the file into memory
  • Creating a byte array of the RAW H264 packets
  • Convert (wrap?) the RAW H264 to a MPEG-2 TS (ffmpeg -i video.h264 video.ts)
  • Write the MPEG-2 TS contents to the response body so that it can be played

...one of my requirements is that I am not able to create local files, even temp ones. So I cannot create a .h264 file, use ffmpeg to create a .ts file, read the ts file and then write the contents to the response body.

As far as I can tell, Xuggler does not work with streams and JCodec is slow. I am fairly confident that I can dig into and understand the MPEG-2 TS format and simply convert the RAW H264 into the appropriate format, but this seems like a lot of needless work that should have been done before.

Anyone know of a simple way to convert RAW H264 to MPEG-2 TS? Or MP4 to MPEG-2 TS? I can use MP4Parser to create the MP4 data in memory quickly, I just need a java library that can generate MPEG-2 TS data, thanks!

4

1 回答 1

0

您有几个选择:(1) FFMPEG-Java和 (2) jjmpeg。然而,尽管后者自 2013 年以来有更多的活动,但它们都有点老了。但这应该是一个好的开始。

祝你好运!

于 2014-04-29T23:54:43.313 回答