Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4398
  • Last Modified:

RTSP (RTP)

http://dmoz.org/Computers/Internet/Protocols/RTSP/

Want to implement a very basic RTP stream in PHP:

The RTP information for the stream:

    * The codec specifies G.711 mu-Law.
    * The packet size specifies 20 ms.

Basically, i would have a wav or au file in the above codec, i want to make php send this info as an rtp stream to a specific IP (which is set to recieve) on port 20002

I'm thinking something like:

header("Content-type: audio/mp3\n");
header("Content-Disposition: attachment; filename=".$file."\n");
header("Content-length: ".filesize($filename)."\n");
$fp = fopen($filename, 'rb');
while(!feof($fp)) {
  print fread($fp, 4096); }
fclose($fp);

Where audio/mp3 would be replaced with something more appropriate and i would call the script like rtsp://domain/test.php.

I have no idea where to start or if RTSP even accepts headers, or how to make php broadcast on port 20002.

Any reasonable insight would be rewarded.
0
conner_bw
Asked:
conner_bw
1 Solution
 
VGRCommented:
to send data on port 20002, it's easy : fsockopen()
the correct MIME-Type has indeed to be specified
The rest should work.
You can also turn magic_quoting off while reading the binary raw data :   set_magic_quotes_runtime(0);

I would also suggets reading all the raw data, not as a text file with buffer of length 4096, but in a big block of data with file()
Then send it via fopen(specificIP:20002), fput or fputs, fclose()
0
 
conner_bwAuthor Commented:
This is much harder than i had orriginally anticipated. The answer was a good starting point, but does not help me make my own PHP RTSP "server"

For followups, anyone know of a PHP RSTP (RTP) server solution? All i can find are C and Java ones.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now