Audio/video stream recording forums

Attention Visitor:
You may have to register or log in before you can post:
  • Click the register link to sign up.
  • Registered members please fill in the form below and click the "Log in" button.
To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Audio/video stream recording forums > Streaming media recording forum > Video stream recording
Register FAQ Members List Calendar Mark Forums Read

Reply Post New Thread
 
Thread Tools Display Modes
  #1  
Old 05-04-2009, 12:50 PM
jace89 jace89 is offline
Junior Member
 
Join Date: Sep 2008
Posts: 9
jace89 is on a distinguished road
Default

Flazr - open source RTMP stream saver


i found a new program called flazr
I don't know how to use that. maybe you can help.

it is not a user-friendly software. flazr is more for programmers than for regular users.

Quote:
Flazr is a Java implementation of the RTMP protocol using the excellent Apache Mina project. I think I was able to come up with a far more concise and readable implementation than what the Red5 project uses - which is not that surprising - because the scope of Red5 is much bigger and Flazr focuses only on the client side. I do feel that Flazr will be useful as an additional reference for those interested in understanding the details of the RTMP protocol.

One of the highlights of Flazr (especially from a Java perspective) is the usage of Groovy for scripting. Groovy allows the end-user to script things such as scraping the HTML from a given URL, parsing it and then invoking the RTMP client routine with the right parameters. All this in a platform-independent manner, without the need to compile anything and using a normal text-editor. I expect Flazr’s Groovy approach to be much easier to use (and arguably more powerful) than the PERL-driven approach that projects like “get_iplayer” and “rtmpdump” use.

Flazr has been designed so that end-users can extend the capabilities far beyond what the core supports - using just some plain-text Groovy scripts. This means that end-users won’t need to depend on the project team (*ahem* just me for now to pitch in and make changes. I’m quite interested to see how this turns out in practice.
flazr v.0.5 doesn't support RTMP h.264 streams.
Reply With Quote
  #2  
Old 06-17-2009, 04:24 AM
Stream Recorder
 
Posts: n/a
Default

Re: Flazr - open source RTMP stream saver


Script for downloading videos from Yahoo ! Music with flazr
This is an example of how you can easily write a script to request an HTML page (or XML data in this case), parse the contents and extract the values needed to invoke the main RTMP client / download routine

Code:
import com.flazr.*

def videoId = "201620741"

def url = "http://video.music.yahoo.com/ver/268.0/process/getPlaylistFOP.php?node_id=v" \
        + videoId + "&tech=flash&bitrate=5000&eventid=1301797";             

def xml = Utils.getOverHttp(url)

println xml

def data = new XmlSlurper().parseText(xml)
def stream = data.'SEQUENCE-ITEM'[1].STREAM

def tcUrl = stream.@APP.text()
def host = stream.@SERVER.text()
def queryString = stream.@QUERYSTRING.text()
def path = stream.@PATH.text().substring(1)

def app = tcUrl.substring(tcUrl.lastIndexOf('/') + 1)
def playParam = path.substring(0, path.lastIndexOf('.')) + '?' + queryString

println 'queryString: ' + queryString + '\n'
println 'path: ' + path + '\n'
println 'playParam: ' + playParam + '\n'
println 'app: ' + app + '\n'

def session = new RtmpSession(host, 1935, app, playParam, 'test.flv')

RtmpClient.connect session
Reply With Quote
  #3  
Old 06-17-2009, 04:26 AM
Stream Recorder
 
Posts: n/a
Default

Re: Flazr - open source RTMP stream saver


Script for downloading videos from Yahoo ! Music with flazr
this is an example of how you can customize the low-level details of things like the handshake and pass values that the server is expecting
Code:
import com.flazr.*


def videoId = "201620741"

def url = "http://video.music.yahoo.com/ver/268.0/process/getPlaylistFOP.php?node_id=v" \
        + videoId + "&tech=flash&bitrate=58&mode=&lg=Lox6nE093DOEBHJ_XTuPaP&vidH=326&vidW=576&rd=new.music.yahoo.com&lang=us&tf=controls&eventid=1301797&tk=";

def xml = Utils.getOverHttp(url)

println xml

def data = new XmlSlurper().parseText(xml)
def stream = data.'SEQUENCE-ITEM'[1].STREAM

def tcUrl = stream.@APP.text()
def host = stream.@SERVER.text()
def queryString = stream.@QUERYSTRING.text()
def path = stream.@PATH.text().substring(1)

def app = tcUrl.substring(tcUrl.lastIndexOf('/') + 1)
def playParam = path.substring(0, path.lastIndexOf('.')) + '?' + queryString

println 'tcUrl: ' + tcUrl       
println 'queryString: ' + queryString
println 'path: ' + path
println 'playParam: ' + playParam
println 'app: ' + app

def mysession = new RtmpSession(host, 1935, app, playParam, 'test.flv')

params = mysession.connectParams

params.flashVer = 'WIN 10,0,12,36'
params.swfUrl = 'http://d.yimg.com/cosmos.bcst.yahoo.com/ver/268.0/embedflv/swf/fop.swf'
params.tcUrl = tcUrl
params.pageUrl = 'http://new.music.yahoo.com/videos/Beyonc/Single-Ladies-(Put-A-Ring-On-It)--201620741'
params.audioCodecs = 3191
params.remove 'objectEncoding'

println params

def handler = { Object[] args -> invoke = args[0]; session = args[1]; 
    resultFor = session.resultFor(invoke)       
    switch (resultFor) {
        case "connect": 
            packet = Packet.serverBw(0x2625A0)
            packet.header.time = 2436539
            session.send packet
            session.send new Invoke("createStream", 3)          
            break
        case "createStream":            
            streamId = invoke.lastArgAsInt
            println 'using streamId: ' + streamId
            session.send Packet.ping(3, 1, 0)
            play = new Invoke(streamId, "play", 8, null, playParam)
            play.time = 2335
            session.send play   
            break
        default: 
            println "not handling result for: " + resultFor
    }   
} as InvokeResultHandler

mysession.invokeResultHandler = handler

RtmpClient.connect mysession
Reply With Quote
  #4  
Old 06-17-2009, 04:28 AM
Stream Recorder
 
Posts: n/a
Default

Re: Flazr - open source RTMP stream saver


Script for downloading from oxy.videolectures.net with flazr
this is the simplest example, if you know the host and the values for the "app" and "play" params you can use this
Code:
import com.flazr.*

def host = 'oxy.videolectures.net'
def app = 'video'
def playParam = '2008/active/iswc08_karlsruhe/swcbtc/iswc08_swcbtc_01'
def saveAs = 'test.flv'

def session = new RtmpSession(host, 1935, app, playParam, saveAs)

RtmpClient.connect session
Reply With Quote
  #5  
Old 06-23-2009, 03:15 PM
matt7277 matt7277 is offline
Junior Member
 
Join Date: Jun 2009
Posts: 3
matt7277 is on a distinguished road
Default

Re: Flazr - open source RTMP stream saver


Were the def url and other variables taken from within a Wireshark capture as I have seen the basic scripts do? Would you be able to give any advice on making this reusable? Could an html page hypothetically be created to pass the url through and have the script auto generated?

Thanks in advance!
Matt

Quote:
Originally Posted by Stream Recorder View Post
Script for downloading from Yahoo Video with flazr
This is an example of how you can easily write a script to request an HTML page (or XML data in this case), parse the contents and extract the values needed to invoke the main RTMP client / download routine

Code:
import com.flazr.*

def videoId = "201620741"

def url = "http://video.music.yahoo.com/ver/268.0/process/getPlaylistFOP.php?node_id=v" \
        + videoId + "&tech=flash&bitrate=5000&eventid=1301797";             

def xml = Utils.getOverHttp(url)

println xml

def data = new XmlSlurper().parseText(xml)
def stream = data.'SEQUENCE-ITEM'[1].STREAM

def tcUrl = stream.@APP.text()
def host = stream.@SERVER.text()
def queryString = stream.@QUERYSTRING.text()
def path = stream.@PATH.text().substring(1)

def app = tcUrl.substring(tcUrl.lastIndexOf('/') + 1)
def playParam = path.substring(0, path.lastIndexOf('.')) + '?' + queryString

println 'queryString: ' + queryString + '\n'
println 'path: ' + path + '\n'
println 'playParam: ' + playParam + '\n'
println 'app: ' + app + '\n'

def session = new RtmpSession(host, 1935, app, playParam, 'test.flv')

RtmpClient.connect session
Reply With Quote
  #6  
Old 06-23-2009, 10:42 PM
Stream Recorder
 
Posts: n/a
Default

Re: Flazr - open source RTMP stream saver


Quote:
Originally Posted by matt7277 View Post
Were the def url and other variables taken from within a Wireshark capture as I have seen the basic scripts do? Would you be able to give any advice on making this reusable? Could an html page hypothetically be created to pass the url through and have the script auto generated?
These scripts come with Flazr. I don't think this can be automated, because web-sites use differenet XML files or don't use them at all.

These groovy scripts are reusable, but they hardly can be created without some programming skills.

IMHO the approach should be different. It should be similar to Replay Media Catcher. The RTMP URL should be sniffed first and then the RTMP downloader should start downloading the RTMP stream automatically.
Reply With Quote
  #7  
Old 06-24-2009, 07:58 AM
matt7277 matt7277 is offline
Junior Member
 
Join Date: Jun 2009
Posts: 3
matt7277 is on a distinguished road
Default

Re: Flazr - open source RTMP stream saver


Thanks for your response, I agree that the Replay Media Catcher is great at sniffing the RTMP URL. One item that got me pondering was the included groovy script for yahoo. Was this video RTMP or RTMPE? I ask because I saw no traffic through Wireshark when filtering RTMPT and also didnt notice any RTMPE url within the pages source. Does the swf verification pass the connection through regular HTTP protocol?


Quote:
Originally Posted by Stream Recorder View Post
These scripts come with Flazr. I don't think this can be automated, because web-sites use differenet XML files or don't use them at all.

These groovy scripts are reusable, but they hardly can be created without some programming skills.

IMHO the approach should be different. It should be similar to Replay Media Catcher. The RTMP URL should be sniffed first and then the RTMP downloader should start downloading the RTMP stream automatically.
Reply With Quote
  #8  
Old 06-24-2009, 08:18 PM
matt7277 matt7277 is offline
Junior Member
 
Join Date: Jun 2009
Posts: 3
matt7277 is on a distinguished road
Default

Re: Flazr - open source RTMP stream saver


I've downloaded the trunk of the latest version with RTMPE support but I'm getting hung up on operating as I did with the .5 release (i.e can you still call the batch file and use the same groovy scripts?) Ive attempted passing along a RTMPE url and save location but failed to actually download. I know there are different ways to call the command:

Code:
(String host, int port, String app, String playName, String saveAsFileName) 

(String host, int port, String app, String playName, String saveAsFileName, boolean encrypted)

(String url, String saveAsFileName)
how are these used?
Reply With Quote
  #9  
Old 06-24-2009, 11:24 PM
Stream Recorder
 
Posts: n/a
Default

Re: Flazr - open source RTMP stream saver


Quote:
Originally Posted by matt7277 View Post
One item that got me pondering was the included groovy script for yahoo. Was this video RTMP or RTMPE? I ask because I saw no traffic through Wireshark when filtering RTMPT and also didnt notice any RTMPE url within the pages source.
In RTMP Tunneled (RTMPT), RTMP data is encapsulated and exchanged via HTTP, and messages from the client (the media player, in this case) are addressed to port 80 (the default for HTTP) on the server.

Yahoo ! Music uses RTMP protocol, so you should filter for RTMP, not for RTMPT or RTMPE.

Quote:
Originally Posted by matt7277 View Post
Does the swf verification pass the connection through regular HTTP protocol?
Most probably yes, but Yahoo ! Music doesn't use SWF verification.
Reply With Quote
Reply Post New Thread
Tags: , , , , , , , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -6. The time now is 08:18 PM.


Powered by All-streaming-media.com; 2006-2011
vB forum hacked with Zoints add-ons