Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java video streaming project

I must make a video streaming java program as a project in the university, however I don't know how to start!

I must do both, main-server side and subserver side, the client side is going to be VLC.

So I need help to this points:

  • In the main server I must split the videos to say 10KB parts how to do that correctly?
  • How to stream a video from a sub-server to the client properly?

Note: I prefer to use mp4 videos, but I'm allowd to use whatever I want.

Thanks

like image 416
Mayiaz Abuarabi Avatar asked May 29 '18 05:05

Mayiaz Abuarabi


2 Answers

You need to decide whether you're building a true live stream (typically Apple HLS or MPEG DASH), or just a pseudo-live stream. Some formats, such as MP4, can be streamed when formatted correctly (see how to do that here).

In the main server I must split the videos to say 10KB parts how to do that correctly?

Sounds like you want to convert a mp4 into a mpeg-ts. Have a look at https://github.com/taktik/mpegts-streamer. Other option is to run ffmpeg

How to stream a video from a sub-server to the client properly?

Multi-source synchronization is a non-trivial matter when it comes to live streams. Depending on your implementation:

  1. Pseudo-live stream with MP4: make sure your streaming API supports seeking and restarting. When a client reconnects to another endpoint, it may send HTTP headers to indicate where to continue (not sure if VLC supports this)

  2. True live stream: keep track of chunks that were served to the client. Topic or elasticache sound reasonable for that. When a client connects to sub-server for the first time, analyze subscription or query elasticache to determine the best chunk.

like image 99
Michal Avatar answered Oct 02 '22 20:10

Michal


You may look at Ant Media Server project which is open source.

like image 24
mgct Avatar answered Oct 02 '22 21:10

mgct