views:

158

answers:

2

Hi! all, I am writing an application which is a kinda video streamer.The client is receiving a video stream using udp socket.Now as I am receiving the stream I want to play it simultaneous.It is different from playing local video file lying in your hard disk in which case it can be as simple as running the file using system("vlc filename").But here many issues are involved like there can be delay in receiving and player will have to wait for the incoming data.I have come to know about using vlc to run a video stream.Can you please elaborate the step for playing the stream using vlc.I am implementing my application in c++.

EDIT: Can somebody give me some idea regarding VLC API which can be used to stream a given video to particular destination and receive that stream at other end play it.

with regards, Mawia

+1  A: 

Well you can always take a look at VideoLan's own homepage Other than that, streaming is quite straightforward:

  1. Decide on a video codec that supports streaming. (ok obvious and probably already done)
  2. Choose appropriate packet size.
  3. Choose appropriate video quality.
  4. At the client side: pre-buffer at least 2 secs of video and audio.

Number 2 and 3 sound strange, but they are worth thinking about:

If you have a broadband connection, you can afford to pump big packets over to the client. Note: Packets here means consistent units of data that the client needs to have completely to decode the next bit of video. If you send big packets, say 4 secs of video, you risk lag due to waiting for the complete data unit of, well, full 4 seconds, whilst small 0.5 sec packets would get you laggy but still recognizable and relatively fluent video on a bad connection.

Same goes for quality. Pixelated and artifact ridden videos are bad, stuttering video/sound desyncing videos are worse. Rather switch down to a lower quality/higher compression setting.

If your question is purely about the getting it done part, well, points 1 and 4 should do for you.

You might ask: "If I want to do real time live video?" All of the advice above still applies, but all of it has to be done smarter. First things first: You cannot do realtime over bad connections. It's a reality thing. If your connection is fat enough you can reach almost real time, just pump each image and a small sound sample out without much processing or any buffering at all. It is possible to get a good client experience from that, but connections like that are highly unlikely. The trick here usually is, transmit a video quality slightly lower than the connection would allow in theory and still wiggle caching and packet reordering in there... have fun. It is hard.

AndreasT
A lot of thanks for the reply.Is'nt there any VLC API to call them from the application programme and use this streaming interface?
mawia
A: 

Unfortunately really the only API vlc has is the command line or equivalent of the command line (you can start player instances, passing them essentially what you would have on the command line). You can use libvlc if you need multiple instances or callbacks but it's pretty opaque still...

rogerdpack