/ Published in: Bash
URL: http://snipplr.com/view/57846/curl--rtsp-to-get-sdp-descriptor-for-media-stream/
From a std page containing youtube video, how could you drill down to the youtube rtsp for that specific video and then get just the audio track?
Expand |
Embed | Plain Text
--display the source from the page, even if it is flash, you should see the youtube videoID as below: <param name="movie" value="http://www.youtube.com/v/kgfctMNeDtg?version=3&feature=player_detailpage"> videoID=kgfctMNeDtg --use the api in order to get the url for the yt:format=1 feed type containing the AMR-NB audio track. This is good quality at low bandwidth REQ: https://gdata.youtube.com/feeds/api/videos/kgfctMNeDtg?fields=media%3Agroup%2Fmedia%3Acontent%5B%40yt%3Aformat%3D%221%22%5D&v=2 response: <entry xmlns='http://www.w3.org/2005/Atom' xmlns:media='http://search.yahoo.com/mrss/' xmlns:yt='http://gdata.youtube.com/schemas/2007'><media:group><media:content url='rtsp://v6.cache3.c.youtube.com/CiILENy73wIaGQnYDl7DtNwHkhMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='1340' yt:format='1'/></media:group></entry> --get the url tag from the above and use that url with a curl program - src at the URL above - to request the RTSP DESCRIBE which returns the SDP (detailed data on audio/video tracks) for the format type=1 video $ ./rtsp_client.exe rtsp://v6.cache3.c.youtube.com/CiILENy73wIaGQnYDl7DtNwHkhMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp rtsp://v6.cache3.c.youtube.com/CiILENy73wIaGQnYDl7DtNwHkhMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp * About to connect() to v6.cache3.c.youtube.com port 554 (#0) * Trying 74.125.213.85... * connected * Connected to v6.cache3.c.youtube.com (74.125.213.85) port 554 (#0) > OPTIONS rtsp://v6.cache3.c.youtube.com/CiILENy73wIaGQnYDl7DtNwHkhMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp RTSP/1.0 CSeq: 1 < RTSP/1.0 200 OK RTSP/1.0 200 OK < Public: DESCRIBE, GET_PARAMETER, OPTIONS, PAUSE, PLAY, SETUP, SET_PARAMETER, TEARDOWN Public: DESCRIBE, GET_PARAMETER, OPTIONS, PAUSE, PLAY, SETUP, SET_PARAMETER, TEARDOWN < CSeq: 1 CSeq: 1 < Server: Google RTSP 1.0 Server: Google RTSP 1.0 < * Connection #0 to host v6.cache3.c.youtube.com left intact OPTIONS Response Code: 200 * Re-using existing connection! (#0) with host v6.cache3.c.youtube.com * Connected to v6.cache3.c.youtube.com (74.125.213.85) port 554 (#0) > DESCRIBE rtsp://v6.cache3.c.youtube.com/CiILENy73wIaGQnYDl7DtNwHkhMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp RTSP/1.0 CSeq: 2 If-Modified-Since: Thu, 01 Jan 1970 00:00:00 GMT Accept: application/x-rtsp-mh, application/rtsl, application/sdp < RTSP/1.0 200 OK RTSP/1.0 200 OK < Content-Type: application/sdp Content-Type: application/sdp Content-Base: rtsp://v6.cache3.c.youtube.com/CiILENy73wIaGQnYDl7DtNwHkhMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp/ ***** SDP ****** < v=0 o=GoogleStreamer 1207646401 1781229825 IN IP4 74.125.213.85 s=Video c=IN IP4 0.0.0.0 b=AS:61 t=0 0 a=control:* a=range:npt=0-1339.133000 m=video 0 RTP/AVP 98 b=AS:49 a=rtpmap:98 H263-2000/90000 a=control:trackID=0 a=cliprect:0,0,144,176 a=framesize:98 176-144 a=fmtp:98 profile=0;level=10 m=audio 0 RTP/AVP 99 b=AS:12 a=rtpmap:99 AMR/8000/1 a=control:trackID=1 a=fmtp:99 octet-align * Connection #0 to host v6.cache3.c.youtube.com left intact DESCRIBE Response Code: 200 --m=audio section mentions encoding details 12K bandwidth AMR/8000/1 on track 1 -- and RTP packet details type 99 from rfc2198
You need to login to post a comment.
