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 > rtmpdump
Register FAQ Members List Calendar Mark Forums Read

Reply Post New Thread
 
Thread Tools Display Modes
  #1  
Old 06-23-2012, 04:11 AM
pythoneer pythoneer is offline
Junior Member
 
Join Date: Jun 2012
Posts: 3
pythoneer is on a distinguished road
Default

librtmp url parsing


Hi, i'm totally new to rtmpdump/librtmp and rtmp also. And it seams that this is my first post so i want to greet everybody

I'm trying to build a program for dumping rtmp streamed videos.

The url for such a stream is something like this:
Code:
rtmp://cp125301.edgefcs.net/ondemand/mp4:zdf/12/06/120621_1808_hko_vh.mp4
if i am trying to dump this with rtmpdump all seams to be fine
Code:
./rtmpdump.linux -r rtmp://cp125301.edgefcs.net/ondemand/mp4:zdf/12/06/120621_1808_hko_vh.mp4 -V -o zdf2.mp4
and in verbose mode its showing me the following extra infos:
Code:
DEBUG: Hostname : cp125301.edgefcs.net
DEBUG: Port     : 1935
DEBUG: Playpath : mp4:zdf/12/06/120621_1808_hko_vh.mp4
DEBUG: tcUrl    : rtmp://cp125301.edgefcs.net:1935/ondemand
DEBUG: app      : ondemand

but if i'm using librtmp its seams that the parser is doing some thing different here:

Code:
#include "rtmp.h"

#include <stdio.h>

int main()
{
  int retVal = 0;

  RTMP* r = RTMP_Alloc();

   retVal = RTMP_SetupURL(r, "rtmp://cp125301.edgefcs.net/ondemand/mp4:zdf/12/06/120621_1808_hko_vh.mp4");
  printf("\n\nhost: %s  \nplaypath: %s \ntcUrl: %s \napp: %s\n\n", r->Link.hostname.av_val, r->Link.playpath.av_val,r->Link.tcUrl.av_val, r->Link.app.av_val);

  retVal = RTMP_Connect(r, NULL);
  printf("connect r: %i\n", retVal);

  return 0;
}
output is :
Code:
host: cp125301.edgefcs.net/ondemand/mp4:zdf/12/06/120621_1808_hko_vh.mp4  
playpath: mp4:zdf/12/06/120621_1808_hko_vh.mp4 
tcUrl: rtmp://cp125301.edgefcs.net/ondemand/mp4:zdf/12/06/120621_1808_hko_vh.mp4 
app: ondemand/mp4:zdf/12/06/120621_1808_hko_vh.mp4

ERROR: WriteN, RTMP send error 104 (1 bytes)
connect r: 0
ERROR: RTMP_Connect1, handshake failed.
which differs from the values from rtmpdump and might be wrong?

i was trying to correct this by manually set the values in the RTMP record by hand as they appear in rtmpdump.. but maybe i missed something

Code:
  //manual set hostname
  AVal hostname;
  hostname.av_val = "cp125301.edgefcs.net";
  hostname.av_len = sizeof("cp125301.edgefcs.net");
  r->Link.hostname = hostname;

  //manual set playpath
  AVal playpath;
  playpath.av_val = "mp4:zdf/12/06/120621_1808_hko_vh.mp4";
  playpath.av_len = sizeof("mp4:zdf/12/06/120621_1808_hko_vh.mp4");
  r->Link.playpath = playpath;
//  r->Link.playpath0 = playpath;
//
  //manual tcUrl
  AVal tcUrl;
  tcUrl.av_val = "rtmp://cp125301.edgefcs.net:1935/ondemand";
  tcUrl.av_len = sizeof("rtmp://cp125301.edgefcs.net:1935/ondemand");
  r->Link.tcUrl = tcUrl;

  //manuel app
  AVal app;
  app.av_val = "ondemand";
  app.av_len = sizeof("ondemand");
  r->Link.app = app;
after all this seams to be not working and i get an error messages:
Code:
ERROR: WriteN, RTMP send error 104 (1 bytes)
ERROR: RTMP_Connect1, handshake failed.
someone any suggestions?

regards pythonner
Reply With Quote
  #2  
Old 06-23-2012, 12:14 PM
KSV KSV is offline
Senior Member
 
Join Date: Apr 2011
Posts: 853
KSV is on a distinguished road
Cool

Re: librtmp url parsing


have you even read the librtmp help. you need to pass the url in proper format.

Code:
"rtmp://cp125301.edgefcs.net/ondemand app=ondemand playpath=mp4:zdf/12/06/120621_1808_hko_vh.mp4"
also you are missing RTMP_Init(). you also need to initialize Winsock.
Reply With Quote
  #3  
Old 06-23-2012, 01:28 PM
pythoneer pythoneer is offline
Junior Member
 
Join Date: Jun 2012
Posts: 3
pythoneer is on a distinguished road
Default

Re: librtmp url parsing


Thx,

Yes i read it, but im not fully into this weird rtmp uri thing. i missed the RTMP_Init() when i pasted my messy code, but its existing.

regarding winsocks - im developing under linux and also aiming for android. where is the point the sockets come in to play?

after modifying the url as u suggested the program stucks at RTMP_SetupURL with debugger :
Code:
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Single stepping until exit from function RTMP_SetupURL,
which has no line number information.
Quit
Reply With Quote
  #4  
Old 06-23-2012, 02:15 PM
KSV KSV is offline
Senior Member
 
Join Date: Apr 2011
Posts: 853
KSV is on a distinguished road
Cool

Re: librtmp url parsing


Quote:
Originally Posted by pythoneer View Post
regarding winsocks - im developing under linux and also aiming for android. where is the point the sockets come in to play?
Winsock initialization is only required for windows. are you sure you are using latest version of librtmp because it seems that server is dropping the connection after handshake failure which shouldn't be the case if you are using latest librtmp. Error 104 occurs when connection is closed by remote end.
Reply With Quote
  #5  
Old 06-23-2012, 03:27 PM
pythoneer pythoneer is offline
Junior Member
 
Join Date: Jun 2012
Posts: 3
pythoneer is on a distinguished road
Default

Re: librtmp url parsing


Quote:
Originally Posted by KSV View Post
Winsock initialization is only required for windows.
ok thx
Quote:
Originally Posted by KSV View Post
are you sure you are using latest version of librtmp
yes i cloned it from here git://git.ffmpeg.org/rtmpdump

but after i used the correct version of the url from you i get a segmentation fault
Code:
#0  0x00007f55fa627071 in RTMP_SetupURL () from /usr/lib/x86_64-linux-gnu/librtmp.so.0
am i messed something up with the 32/64 bit stuff?
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 03:54 PM.


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