1
votes

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!

1
Have you found a library?Sebastian Annies

1 Answers

0
votes

You have a couple of options: (1) FFMPEG-Java and (2) jjmpeg. However, they are both a bit old although the latter has had more recent activity since 2013. But these should be a good start.

Best of luck!