Streaming media in RTP over UDP in Java, no libraries
**Posted on ServerFault, moved to StackOverflow**

So, I am writing a very simple piece of software that can take a file, in this case, a .WAV, packetize it for RTP, and stream the RTP packets over UDP to localhost:xxxx. I then want to read this stream using VLC player or something similar.

I have successfully streamed .MJpeg this way, although I played the output back using Java. When setting the payload of each packet, I just filled a byte array with I think 160 bytes of data, and then copied it into the payload byte array of the RTP packet. I had a timer go and send one of these packets every 20 milliseconds.

My question is, how do I packetize the payload for .WAV? Can I do something similar with a timer still when I xmit every 20 ms? How different is this from packetizing a .mp3?

I want to do the packetization, at least the RTP Headers, on my own, and preferably the payloading as well, but I am willing to use third party libraries (or java libraries) to get the job done. I want to be able at least hear audio from VLC by tomorrow night...is this possible? Or is this a lengthy task...

A more general question, perhaps this is suited for a different forum, but it is related so I will ask it here.

In my understanding, an audio file is created/manipulated in the following way:

A sample is encoded from Analog to Digital, resulting in a .WAV (always?) A .WAV is then compressed (optional), resulting in a compressed file format (.mp3) A file is uncompressed, .mp3 -> .WAV A file is decoded, .WAV -> Analog

Is encoding and compressing different as I have specified above? What are the differences? Does a DAC encode, convert, or sample?

And finally, how strict do I have to be during this packetization, both in RTP Header and Payload, to have VLC properly pick up this audio stream?

Streaming media in RTP over UDP in Java, no libraries
===

**Posted on ServerFault, moved to StackOverflow**

So, I am writing a very simple piece of software that can take a file, in this case, a .WAV, packetize it for RTP, and stream the RTP packets over UDP to localhost:xxxx. I then want to read this stream using VLC player or something similar.

I have successfully streamed .MJpeg this way, although I played the output back using Java. When setting the payload of each packet, I just filled a byte array with I think 160 bytes of data, and then copied it into the payload byte array of the RTP packet. I had a timer go and send one of these packets every 20 milliseconds.

My question is, how do I packetize the payload for .WAV? Can I do something similar with a timer still when I xmit every 20 ms? How different is this from packetizing a .mp3?

I want to do the packetization, at least the RTP Headers, on my own, and preferably the payloading as well, but I am willing to use third party libraries (or java libraries) to get the job done. I want to be able at least hear audio from VLC by tomorrow night...is this possible? Or is this a lengthy task...

A more general question, perhaps this is suited for a different forum, but it is related so I will ask it here.

In my understanding, an audio file is created/manipulated in the following way:

A sample is encoded from Analog to Digital, resulting in a .WAV (always?) A .WAV is then compressed (optional), resulting in a compressed file format (.mp3) A file is uncompressed, .mp3 -> .WAV A file is decoded, .WAV -> Analog

Is encoding and compressing different as I have specified above? What are the differences? Does a DAC encode, convert, or sample?

And finally, how strict do I have to be during this packetization, both in RTP Header and Payload, to have VLC properly pick up this audio stream?
