Login   Register  
PHP Classes
elePHPant
Icontem

How to save rtsp stream to file

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      YouTube API  >  All threads  >  How to save rtsp stream to file  >  (Un) Subscribe thread alerts  
Subject:How to save rtsp stream to file
Summary:saving google stream on Ubuntu
Messages:5
Author:Juris Malinens
Date:2008-07-08 11:56:20
Update:2010-04-07 10:51:41
 

  1. How to save rtsp stream to file   Reply  
Picture of Juris Malinens
Juris Malinens
2008-07-08 11:56:20
How can I save rtsp stream to file? I have Ubuntu 7.10.

I am trying it with mplayer but it don't work:

root@server1:/var/www/web1# mplayer rtsp://rtsp2.youtube.com/ChoLENy73wIaEQlQ4Ap9shkVAhMYESARFEgGDA==/0/0/0/video.3gp -dumpstream -dumpfile video.3gp
MPlayer dev-SVN-r27138-4.1.3 (C) 2000-2008 MPlayer Team
CPU: AMD Athlon(tm) 64 Processor 3000+ (Family: 15, Model: 47, Stepping: 2)
CPUflags: MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE SSE2

Playing rtsp://rtsp2.youtube.com/ChoLENy73wIaEQlQ4Ap9shkVAhMYESARFEgGDA==/0/0/0/ video.3gp.
Resolving rtsp2.youtube.com for AF_INET6...
Couldn't resolve name for AF_INET6: rtsp2.youtube.com
Resolving rtsp2.youtube.com for AF_INET...
Connecting to server rtsp2.youtube.com[66.249.93.177]: 554...
A single media stream only is supported atm.
rtsp_session: unsupported RTSP server. Server type is 'Google RTSP 1.0'.
Resolving rtsp2.youtube.com for AF_INET6...
Couldn't resolve name for AF_INET6: rtsp2.youtube.com
Resolving rtsp2.youtube.com for AF_INET...
Connecting to server rtsp2.youtube.com[66.249.93.177]: 80...
connect error: Connection refused
No stream found to handle url rtsp://rtsp2.youtube.com/ChoLENy73wIaEQlQ4Ap9shkVA hMYESARFEgGDA==/0/0/0/video.3gp


Exiting... (End of file)


I hope You help me! Thank You for this php class :)

  2. Re: How to save rtsp stream to file   Reply  
Picture of Er. Rochak Chauhan
Er. Rochak Chauhan
2008-07-08 12:14:40 - In reply to message 1 from Juris Malinens
Hi Juris,

First of all, thank you for your appreciation.

One of the main features of using a streaming server is to make sure the media is not being copied.

Having said that, in case of youtube.com there is an other way around.

http://demo.dmwtechnologies.com/YouTubeDownloader/index.php

You can fetch a download link from the above by using a cURL call.Also there are other classes availble which extracts the download link from the youtube URL.

However, if you still face any issue, let me know I'll provide you another solution.

Best Regards,
Rochak Chauhan.

  3. Re: How to save rtsp stream to file   Reply  
Picture of Juris Malinens
Juris Malinens
2008-07-09 10:45:02 - In reply to message 1 from Juris Malinens
Yes, it is easy to download flv file from Youtube :)
But is it possible to download a .3gp file directly from Youtube?

I can get video using mencoder:
mencoer rtsp://rtsp.youtube.com/youtube/videos/JpBGRA6HHtY/video.3gp -o done.3gp -rtsp-stream-over-tcp -xvidencopts pass=1 -ovc xvid

but it takes a while to download 3gp file from Youtube in this way...

Yesterday I tried to use cURL:
<?php
error_reporting(E_ALL);
$LOGINURL = 'rtsp://rtsp2.youtube.com/ChoLENy73wIaEQko8veyeciXWhMYESARFEgGDA==/0/0/0/video.3gp';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$LOGINURL);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT
5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)");
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie\cookie_file");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie\cookie_file");
curl_setopt($ch, CURLOPT_REFERER,
"http://youtube.com");
$fileContent = curl_exec ($ch);
curl_close ($ch);
echo $fileContent;
$file = fopen('test.3gp', "wb");
fputs($file,$fileContent);
fclose($file);
?>

But I got blank screen. I think cURL don't "understand" rtsp protocol...

  4. Re: How to save rtsp stream to file   Reply  
Picture of Er. Rochak Chauhan
Er. Rochak Chauhan
2008-07-09 12:35:49 - In reply to message 3 from Juris Malinens
Hi

I have Added new function "getDownloadLink()" to extract title and download link from any youtube URL.
Please download this class again.

In case of any furhter difficulty, let me know.

Happy Coding,
Rochak Chauhan.

  5. Re: How to save rtsp stream to file   Reply  
Picture of Ahmed
Ahmed
2010-04-07 10:51:41 - In reply to message 4 from Er. Rochak Chauhan
the download link function don't work