Audio/video stream recording forums (http://stream-recorder.com/forum/index.php)
-   rtmpdump (http://stream-recorder.com/forum/forumdisplay.php?f=54)
-   -  

Customized rtmpdump binaries with patch file

(http://stream-recorder.com/forum/showthread.php?t=16103)

RedPenguin 04-17-2013 01:35 PM

Re: Customized rtmpdump binaries with patch file


 
Yes that's why I edited my post before to mean rtmpdump.

But yes I do mean the older rtmpdump usually downloads it with very little issue. Sometimes it does it on first try othertimes you gotta restart the stream maybe 3 times but it always downloads.

KSV 04-17-2013 01:45 PM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by RedPenguin (Post 61655)
Yes that's why I edited my post before to mean rtmpdump.

replied before your edit.

Quote:

Originally Posted by RedPenguin (Post 61655)
But yes I do mean the older rtmpdump usually downloads it with very little issue. Sometimes it does it on first try othertimes you gotta restart the stream maybe 3 times but it always downloads.

still you need to post the log for any further progress.

RedPenguin 04-17-2013 01:56 PM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by KSV (Post 61657)
replied before your edit.



still you need to post the log for any further progress.

np there, but what's the method to get rtmpdump to run -z when rtmpsrv is caling it without it?

I know you can run rtmpdump manually but they change token each time.

EDIT: Wait I think you can easily do it with RTMPExplorerX if you tell it run CMD instead of rtmpsrv, then you can manually run rtmpdump.

RedPenguin 04-17-2013 02:38 PM

Re: Customized rtmpdump binaries with patch file


 
https://dl.dropboxusercontent.com/u/.../older-log.txt

https://dl.dropboxusercontent.com/u/.../newer-log.txt

Ctrl-C was pressed after the first one downloaded for a few seconds and while the newer was hanging for about 15-20 or more seconds.

Not sure if there was an easier way or not but I found if you quickly kill rtmpsrv from RTMPExplorer and run the command yourself you can easily add -z.

KSV 04-18-2013 02:34 AM

Re: Customized rtmpdump binaries with patch file


 
only odd thing i can find in your logs is that in case of newer rtmpdump server is sending onBWCheck twice. probably it didn't like our BWResponse. there is one commit made on 02/08/2011 which is just after the working rtmpdump date 11/7/2011. you can try after reverting the changes made by this commit.

Code:

commit 8880d1456b282ee79979adbe7b6a6eb8ad371081
Author: Chris Larsen <clarsen@euphoriaaudio.com>
Date:  Tue Aug 2 12:33:44 2011 -0400

    Unexpected BW Response Fix

    Bug: SendCheckBWResult sends an invalid bw response due to casting issues
    from a double to an int.

diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c
index df2cb27..5311a8a 100644
--- a/librtmp/rtmp.c
+++ b/librtmp/rtmp.c
@@ -2339,7 +2339,7 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
 {
  AMFObject obj;
  AVal method;
-  int txn;
+  double txn;
  int ret = 0, nRes;
  if (body[0] != 0x02)        /* make sure it is a string method name we start with */
    {
@@ -2357,7 +2357,7 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)

  AMF_Dump(&obj);
  AMFProp_GetString(AMF_GetProp(&obj, NULL, 0), &method);
-  txn = (int)AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 1));
+  txn = AMFProp_GetNumber(AMF_GetProp(&obj, NULL, 1));
  RTMP_Log(RTMP_LOGDEBUG, "%s, server invoking <%s>", __FUNCTION__, method.av_val);

  if (AVMATCH(&method, &av__result))
@@ -2366,7 +2366,7 @@ HandleInvoke(RTMP *r, const char *body, unsigned int nBodySize)
      int i;

      for (i=0; i<r->m_numCalls; i++) {
-      if (r->m_methodCalls[i].num == txn) {
+      if (r->m_methodCalls[i].num == (int)txn) {
          methodInvoked = r->m_methodCalls[i].name;
          AV_erase(r->m_methodCalls, &r->m_numCalls, i, FALSE);
          break;


RedPenguin 04-18-2013 04:33 AM

Re: Customized rtmpdump binaries with patch file


 
Reverted commit (then verified) and then compiled but still no go.

But yes I looked at both logs and they look nearly identical except of course the older one working.

EDIT: Though I did see what happens if I revert the BW commit, put in only your AMF fixes and skip rest of patch, but then it just immediately goes to ERROR: Closing connection: NetStream.Play.StreamNotFound

Debug Log for one without rest of patch https://dl.dropboxusercontent.com/u/5544258/test.log

KSV 04-18-2013 06:00 AM

Re: Customized rtmpdump binaries with patch file


 
your log shows NetStream.Failed not NetStream.Play.StreamNotFound error which generally means that auth token has expired. it would be easy to get the offending commit if you know how to use git bisect.

RedPenguin 04-18-2013 06:15 AM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by KSV (Post 61683)
your log shows NetStream.Failed not NetStream.Play.StreamNotFound error which generally means that auth token has expired. it would be easy to get the offending commit if you know how to use git bisect.

Well I should say the rtmpsrv ran rtmpdump said StreamNotFound but when I tried running rtmpdump manually after it said NetStream.Failed but you are prob right it probably disabled the token after I tried killing rtmpsrv really fast.

But I will try and see what hapens with git bisect.

EDIT: Looks like I found the issue. I didn't have extreme luck with git bisect but I did have luck checking out older versions of the code using git chekcout.

It seems if I checkout anything older then Nov 9th it works perfectly but the minute I put on 19d36368f6c1ec6fa55df319173ca93048309f9a which is for PolarSSL 1.2.x compat, it breaks.

Yet now, if I apply your latest patch file, it breaks again, it only works if I revert said commit and leave your patch off, yet obviously your patches are wanted.

For some reason it only wants to work with PolarSSL 1.0.0 not 1.2.7 because obviously this revert causes it not to compile. I'm gonna see maybe I can use OpenSSL or something.

KSV 04-18-2013 07:39 AM

Re: Customized rtmpdump binaries with patch file


 
so you are saying commit just before 19d36368f6c1ec6fa55df319173ca93048309f9a works while it doesn't work after you apply this specific commit. leave my patches out for the moment. that's pretty weird behaviour. that offending commit has only changes related to SSL which isn't even being used in this case.

RedPenguin 04-18-2013 07:42 AM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by KSV (Post 61687)
so you are saying commit just before 19d36368f6c1ec6fa55df319173ca93048309f9a works while it doesn't work after you apply this specific commit. leave my patches out for the moment. that's pretty weird behaviour. that offending commit has only changes related to SSL which isn't even being used in this case.

Yes every time I revert that commit and leave your patches out, it works.

I created a new dir, did a "git clone git://git.ffmpeg.org/rtmpdump" then inside the rtmpdump dir did "git revert 19d36368f6c1ec6fa55df319173ca93048309f9a" then compiled and it works.

KSV 04-18-2013 07:50 AM

Re: Customized rtmpdump binaries with patch file


 
for the time being try with openssl and fresh copy of repo without any modifications.

mkucharski 04-18-2013 12:28 PM

Re: Customized rtmpdump binaries with patch file


 
KSV, would you consider forking rtmpdump on github (or any other source code hosting service) and integrate your patches there? Or have you considered to push your changes upstream?

RedPenguin 04-18-2013 12:58 PM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by KSV (Post 61689)
for the time being try with openssl and fresh copy of repo without any modifications.

Doing this produces a rtmpdump that works also.

KSV 04-18-2013 01:09 PM

Re: Customized rtmpdump binaries with patch file


 
can you add my latest patch file to the openssl mix and try. also try with fresh repo + polarssl only.

RedPenguin 04-18-2013 02:26 PM

Re: Customized rtmpdump binaries with patch file


 
Adding your patch to openssl blend breaks and so does with polarssl no other changes.

EDIT: As a test I upgraded to PolarSSL 1.2.7 from 1.0.0 and with fresh code that actually does download but again the minute your patch is added, broken again :(.

KSV 04-19-2013 11:12 AM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by RedPenguin (Post 61697)
Adding your patch to openssl blend breaks and so does with polarssl no other changes.

EDIT: As a test I upgraded to PolarSSL 1.2.7 from 1.0.0 and with fresh code that actually does download but again the minute your patch is added, broken again :(.

hmmm so then something in patch is causing this particular problem. in absence of test case you have to debug it yourself. i can only suggest how to do that if you are interested.

1. first create two fresh repos and apply patch to only one of them.

2. copy rtmp.c, rtmp.h and rtmp_sys.h from patched repo to non-patched one.

3. compile it and check if problem reoccurs. if yes then we can leave out changes in other files as possible culprit.

4. now the hard part, if the problem is with changes of rtmp.c then you have to remove the code added by patch, block by block and figure out the offending code.

RedPenguin 04-19-2013 06:38 PM

Re: Customized rtmpdump binaries with patch file


 
Well so far it appears it's definitely those files but to even get rtmpdump to compile I had to copy over the patched rtmpdump.c but it still fails on rtmpgw but that's not needed right now.

I also tried with only rtmp_sys.h only so that looks like it's not the problem.

Will update once I get further.

RedPenguin 04-19-2013 10:13 PM

Re: Customized rtmpdump binaries with patch file


 
I have found almost the exact problem, it is definitely changes to the rtmp.c that break it.

The code you place in at the very bottom is doing it:

I can't seem to pinpoint the exact part of the code but once I removed all of this said code plus some small pieces above referencing it, it immediately worked.

Code:

+static int
+ConnectSocket(RTMP *r)
+{
+  int on = 1;
+  struct sockaddr_in service;
+  if (!r->Link.hostname.av_len)
+    return FALSE;
+
+  memset(&service, 0, sizeof (struct sockaddr_in));
+  service.sin_family = AF_INET;
+
+  if (r->Link.socksport)
+    {
+      /* Connect via SOCKS */
+      if (!add_addr_info(&service, &r->Link.sockshost, r->Link.socksport))
+        return FALSE;
+    }
+  else
+    {
+      /* Connect directly */
+      if (!add_addr_info(&service, &r->Link.hostname, r->Link.port))
+        return FALSE;
+    }
+
+  r->m_sb.sb_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+  if (r->m_sb.sb_socket != -1)
+    {
+      if (connect(r->m_sb.sb_socket, (struct sockaddr *) &service, sizeof (struct sockaddr)) < 0)
+        {
+          int err = GetSockError();
+          RTMP_Log(RTMP_LOGERROR, "%s, failed to connect socket. %d (%s)",
+                  __FUNCTION__, err, strerror(err));
+          RTMP_Close(r);
+          return FALSE;
+        }
+
+      if (r->Link.socksport)
+        {
+          RTMP_Log(RTMP_LOGDEBUG, "%s ... SOCKS negotiation", __FUNCTION__);
+          if (!SocksNegotiate(r))
+            {
+              RTMP_Log(RTMP_LOGERROR, "%s, SOCKS negotiation failed.", __FUNCTION__);
+              RTMP_Close(r);
+              return FALSE;
+            }
+        }
+    }
+  else
+    {
+      RTMP_Log(RTMP_LOGERROR, "%s, failed to create socket. Error: %d",
+              __FUNCTION__, GetSockError());
+      return FALSE;
+    }
+
+  /* set timeout */
+  SET_RCVTIMEO(tv, r->Link.timeout);
+  if (setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (char *) &tv, sizeof (tv)))
+    {
+      RTMP_Log(RTMP_LOGERROR, "%s, Setting socket timeout to %d failed!",
+              __FUNCTION__, r->Link.timeout);
+    }
+
+  setsockopt(r->m_sb.sb_socket, IPPROTO_TCP, TCP_NODELAY, (char *) &on, sizeof (on));
+  if (r->Link.protocol & RTMP_FEATURE_HTTP)
+    setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_KEEPALIVE, (char *) &on, sizeof (on));
+
+  return TRUE;
+}
+
+static int
+SendCommand(RTMP *r, char *method, int queue)
+{
+  char pbuf[256], *pend = pbuf + sizeof (pbuf), *enc;
+  AVal av_command, methodName;
+
+  enc = pbuf;
+  methodName.av_val = method;
+  methodName.av_len = strlen(method);
+  enc = AMF_EncodeString(enc, pend, &methodName);
+  enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
+  *enc++ = AMF_NULL;
+  av_command.av_val = pbuf;
+  av_command.av_len = enc - pbuf;
+
+  return SendInvoke(r, &av_command, queue);
+}
+
+static int
+SendGetStreamLength(RTMP *r)
+{
+  char pbuf[256], *pend = pbuf + sizeof (pbuf), *enc;
+  AVal av_Command;
+
+  enc = pbuf;
+  enc = AMF_EncodeString(enc, pend, &av_getStreamLength);
+  enc = AMF_EncodeNumber(enc, pend, ++r->m_numInvokes);
+  *enc++ = AMF_NULL;
+  enc = AMF_EncodeString(enc, pend, &r->Link.playpath);
+  av_Command.av_val = pbuf;
+  av_Command.av_len = enc - pbuf;
+
+  return SendInvoke(r, &av_Command, TRUE);
+}
+
+static int
+SendInvoke(RTMP *r, AVal *command, int queue)
+{
+  RTMPPacket packet;
+  char pbuf[512], *enc;
+
+  packet.m_nChannel = 0x03; /* control channel (invoke) */
+  packet.m_headerType = RTMP_PACKET_SIZE_MEDIUM;
+  packet.m_packetType = RTMP_PACKET_TYPE_INVOKE;
+  packet.m_nTimeStamp = 0;
+  packet.m_nInfoField2 = 0;
+  packet.m_hasAbsTimestamp = 0;
+  packet.m_body = pbuf + RTMP_MAX_HEADER_SIZE;
+
+  enc = packet.m_body;
+  if (command->av_len)
+    {
+      memcpy(enc, command->av_val, command->av_len);
+      enc += command->av_len;
+    }
+  else
+    return FALSE;
+  packet.m_nBodySize = enc - packet.m_body;
+
+  return RTMP_SendPacket(r, &packet, queue);
+}
+
+static int
+strsplit(char *src, int srclen, char delim, char ***params)
+{
+  char *sptr, *srcbeg, *srcend, *dstr;
+  int count = 1, i = 0, len = 0;
+
+  if (src == NULL)
+    return 0;
+  if (!srclen)
+    srclen = strlen(src);
+  srcbeg = src;
+  srcend = srcbeg + srclen;
+  sptr = srcbeg;
+
+  /* count the delimiters */
+  while (sptr < srcend)
+    {
+      if (*sptr++ == delim)
+        count++;
+    }
+  sptr = srcbeg;
+  *params = calloc(count, sizeof (size_t));
+  char **param = *params;
+
+  for (i = 0; i < (count - 1); i++)
+    {
+      dstr = strchr(sptr, delim);
+      len = dstr - sptr;
+      param[i] = calloc(len + 1, sizeof (char));
+      strncpy(param[i], sptr, len);
+      sptr += len + 1;
+    }
+
+  /* copy the last string */
+  if (sptr <= srcend)
+    {
+      len = srclen - (sptr - srcbeg);
+      param[i] = calloc(len + 1, sizeof (char));
+      strncpy(param[i], sptr, len);
+    }
+  return count;
+}


KSV 04-20-2013 01:04 AM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by RedPenguin (Post 61731)
I can't seem to pinpoint the exact part of the code but once I removed all of this said code plus some small pieces above referencing it, it immediately worked.

Those functions can't be the real culprit. they aren't even being used as per your log file. keep all the patch except following change. revert
Code:

  else if (AVMATCH(&method, &av__onbwcheck) || AVMATCH(&method, &av_onBWCheck))
to original
Code:

  else if (AVMATCH(&method, &av__onbwcheck))

RedPenguin 04-20-2013 01:07 AM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by KSV (Post 61732)
Those functions can't be the real culprit. they aren't even being used as per your log file. keep all the patch except following change. revert
Code:

  else if (AVMATCH(&method, &av__onbwcheck) || AVMATCH(&method, &av_onBWCheck))
to original
Code:

  else if (AVMATCH(&method, &av__onbwcheck))

Yea that's what I figured, because I swear I made those changes, compiled and it worked, but when I tried to reproduce it, it failed.

EDIT: Damn KSV are you good! I made this single change only and it worked immediately! Also just to double verify, I deleted the dir and reused git, made same change, and works again. :)

Though as far as you know, this should not break anything else in the patch?

KSV 04-20-2013 01:32 AM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by RedPenguin (Post 61733)
Damn KSV are you good! I made this single change only and it worked immediately! Also just to double verify, I deleted the dir and reused git, made same change, and works again. :)

Though as far as you know, this should not break anything else in the patch?

so my initial guess was correct. old version doesn't sends back any BWcheck response. my version is sending this but default response function in official rtmpdump doesn't seems correct. i have added a similar function to rtmpsrv long ago. i will copy that one instead. try with following patch on fresh repo.

Code:

http://pastebin.com/nsrK1uXH

RedPenguin 04-20-2013 01:44 AM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by KSV (Post 61734)
so my initial guess was correct. old version doesn't sends back any BWcheck response. my version is sending this but default response function in official rtmpdump doesn't seems correct. i have added a similar function to rtmpsrv long ago. i will copy that one instead. try with following patch on fresh repo.

Code:

http://pastebin.com/nsrK1uXH

That patch breaks it again, but as a note, not sure if this was intended or not but when applying the patch:

"patch unexpectedly ends in middle of line"

but seemed to apply otherwise.

KSV 04-20-2013 02:08 AM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by RedPenguin (Post 61735)
That patch breaks it again, but as a note, not sure if this was intended or not but when applying the patch:

"patch unexpectedly ends in middle of line"

but seemed to apply otherwise.

try with following and also post the debug log of this one.

Code:

http://pastebin.com/Bgznqcrc

RedPenguin 04-20-2013 02:47 AM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by KSV (Post 61736)
try with following and also post the debug log of this one.

Code:

http://pastebin.com/Bgznqcrc

This patch seems to work every time.

I tried getting a debug log but for some reason my method using rtmpexplorer to stop rtmpsrv real quick and run rtmpdump manually fails as it runs rtmpdump too fast thus invalidating said token.

Is there some way to code rtmpsrv to always do -z or something to rtmpdump?

I know rtmpsrv sometimes has a -i option but I can't seem to get RTMPExplorer(X) nor RTMPDumpHelper to pass said option to rtmpsrv though it appears your patch must not have -i anyway.

Every now and then it will not start recording, but I noticed that before on the your 2011-07-11 version. It's like sometimes you had to restart the stream about 3 times before it starts recording, but most times it works on first try.

KSV 04-20-2013 04:04 AM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by RedPenguin (Post 61738)
I know rtmpsrv sometimes has a -i option but I can't seem to get RTMPExplorer(X) nor RTMPDumpHelper to pass said option to rtmpsrv though it appears your patch must not have -i anyway.

:confused: rtmpsrv doesn't have any i switch.

try the following one. it automatically adds -z switch to rtmpdump command. if stream doesn't work with this one i will remove the BWrespose. it's not worth spending any more time. it doesn't affect downloading anyway.
Code:

http://pastebin.com/7va19cpt
Code:

rtmpsrv 2>Debug.txt
http://pastebin.com/7va19cpt

RedPenguin 04-20-2013 04:38 AM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by KSV (Post 61739)
:confused: rtmpsrv doesn't have any i switch.
l[/url]

Well I meant the one svnpenn worked on a little while back:
http://lists.mplayerhq.hu/pipermail/...ber/002183.htm

Quote:

Originally Posted by KSV (Post 61739)
try the following one. it automatically adds -z switch to rtmpdump command. if stream doesn't work with this one i will remove the BWrespose. it's not worth spending any more time. it doesn't affect downloading anyway.
Code:

http://pastebin.com/7va19cpt
Code:

rtmpsrv 2>Debug.txt
http://pastebin.com/7va19cpt

Played the stream 3 times and each time it worked, seems flawless now :).

flocked 04-21-2013 03:29 PM

Re: Customized rtmpdump binaries with patch file


 
Could anyone please compile it for mac? thanks!!

RedPenguin 04-21-2013 03:32 PM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by flocked (Post 61767)
Could anyone please compile it for mac? thanks!!

Actually very funny you would ask, being I am basically working on it at this very moment.

Some folks over at XBMC seem to want librtmp for Apple TV 1 which is simply MacOS anyway.

I am currently working on getting a cross-compiler going for MacOS and will just make the exectuables and librtmp for anybody who wants them.

alexanderd 04-22-2013 01:21 AM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by KSV (Post 61390)
1. add timestamp to detected filename (rtmpsrv and rtmpsuck) to avoid overwriting the streams

Thank you so much for that, KSV!

After some testing.
Unfortunately,latest release still overwrites live stream :(
Every time it's saved with the same filename.
I use RTMPDumpHelper+RTMPSuck

Code:

WARNING: Trying different position for client digest!
Processing connect
      app : live?ovpfv=2.1.4
  flashVer : WIN 11,6,602,180
    swfUrl : http://www.c-span.org/cspanVideoHD.swf?src=cspan1
    tcUrl : rtmp://cp82346.live.edgefcs.net:1935/live?ovpfv=2.1.4
  pageUrl : http://www.c-span.org/Live-Video/C-SPAN/
      live : yes
  Playpath : CSPAN1@14845
 Saving as : CSPAN1@14845.flv
INFO: Metadata:
INFO:  presetname              Custom
INFO:  creationdate            Sun Mar 10 09:55:08 2013
INFO:  videodevice            Osprey-230 Video Device 1
INFO:  framerate              30.00
INFO:  width                  320.00
INFO:  height                  240.00
INFO:  videocodecid            VP62
INFO:  videodatarate          300.00
INFO:  videokeyframe_frequency 5.00
INFO:  audiodevice            Osprey-230 Audio Device 1
INFO:  audiosamplerate        22050.00
INFO:  audiochannels          2.00
INFO:  audioinputvolume        75.00
INFO:  audiocodecid            .mp3
INFO:  audiodatarate          40.00
WARNING: ignoring too small audio packet: size: 0
ERROR: Request timeout/select failed, ignoring request
Closing connection... done!

WARNING: ignoring too small audio packet: size: 0
ERROR: RTMP_ReadPacket, failed to read RTMP packet header
Closing connection... done!

WARNING: Trying different position for client digest!
Processing connect
      app : live?ovpfv=2.1.4
  flashVer : WIN 11,6,602,180
    swfUrl : http://www.c-span.org/cspanVideoHD.swf?src=cspan1
    tcUrl : rtmp://cp82346.live.edgefcs.net:1935/live?ovpfv=2.1.4
  pageUrl : http://www.c-span.org/Live-Video/C-SPAN/
      live : yes
  Playpath : CSPAN1@14845
 Saving as : CSPAN1@14845.flv
INFO: Metadata:
INFO:  presetname              Custom
INFO:  creationdate            Sun Mar 10 09:55:08 2013
INFO:  videodevice            Osprey-230 Video Device 1
INFO:  framerate              30.00
INFO:  width                  320.00
INFO:  height                  240.00
INFO:  videocodecid            VP62
INFO:  videodatarate          300.00
INFO:  videokeyframe_frequency 5.00
INFO:  audiodevice            Osprey-230 Audio Device 1
INFO:  audiosamplerate        22050.00
INFO:  audiochannels          2.00
INFO:  audioinputvolume        75.00
INFO:  audiocodecid            .mp3
INFO:  audiodatarate          40.00
WARNING: ignoring too small audio packet: size: 0
WARNING: ignoring too small audio packet: size: 0
WARNING: Trying different position for client digest!
Processing connect
      app : samaalive
  flashVer : WIN 11,6,602,180
    swfUrl : http://beta.cdn.livestation.com/play...ion-player.swf
    tcUrl : rtmp://38.96.148.99:1935/samaalive
  pageUrl : http://www.livestation.com/
      live : yes
  Playpath : samaalive
 Saving as : samaalive.flv
INFO: Metadata:
INFO:  width                  480.00
INFO:  height                  270.00
INFO:  framerate              25.00
INFO:  videodatarate          200.00
INFO:  videocodecid            avc1
INFO:  audiodatarate          40.00
INFO:  audiocodecid            mp4a
WARNING: ignoring too small audio packet: size: 0
      live : yes
  Playpath : samaalive
 Saving as : samaalive.flv
INFO: Metadata:
INFO:  width                  480.00
INFO:  height                  270.00
INFO:  framerate              25.00
INFO:  videodatarate          200.00
INFO:  videocodecid            avc1
INFO:  audiodatarate          40.00
INFO:  audiocodecid            mp4a
WARNING: ignoring too small audio packet: size: 0
ERROR: Request timeout/select failed, ignoring request
Closing connection... done!


KSV 04-22-2013 11:58 AM

Re: Customized rtmpdump binaries with patch file


 
i have fixed another rtmpdump bug in which flv header was set with wrong data type (audio/video marker) which is yet another regression due to those array types. though file may play normally in most players rtmpdump was looking for the wrong type of keyframes while resuming.

another enhancement included is that upon resuming it was looking for keyframes with timestamp 0 only but now it searches other non zero timestamps too (timestamps are adjusted accordingly for this resume drift). so it's able to resume in those cases also where our required keyframe has nonzero timestamp.

Test case for both bugs:
Code:

rtmpdump -r "rtmpt://h2a.rtp.pt/vodrtp" -y "nas2.share/videos/auto/planetamusica/planetamusica_1_20120317" -o planetamusica_1_201203171.flv
@RedPenguin
your problem seems more like server configuration issue because the same response is accepted by other servers without any problem. anyway i have disabled it in my patches for compatibility reasons.

@alexanderd
it seems like you are using old binaries not the updated ones posted in first post.

alexanderd 04-22-2013 02:38 PM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by KSV (Post 61778)
@alexanderd
it seems like you are using old binaries not the updated ones posted in first post.

I've just downloaded the newest ones. And got the same result. http://pastebin.com/ry1hdqsy

KSV 04-22-2013 11:29 PM

Re: Customized rtmpdump binaries with patch file


 
Code:

RTMP Proxy Server v2.4 GIT-2012-12-30 (Compiled by KSV)
(c) 2010 Andrej Stepanchuk, Howard Chu; license: GPL

Streaming on rtmp://0.0.0.0:1935
WARNING: Trying different position for client digest!
Processing connect
      app : samaalive
  flashVer : WIN 11,6,602,180
    swfUrl : http://live.samaa.tv/player.swf
    tcUrl : rtmp://38.96.148.99:1935/samaalive
  pageUrl : http://live.samaa.tv/
      live : yes
  Playpath : samaalive
 Saving as : 2013-04-23_10-58-02_samaalive.flv
INFO: Metadata:
INFO:  width                  480.00
INFO:  height                  270.00
INFO:  framerate              25.00
INFO:  videodatarate          200.00
INFO:  videocodecid            avc1
INFO:  audiodatarate          40.00
INFO:  audiocodecid            mp4a


alexanderd 04-23-2013 02:12 AM

Re: Customized rtmpdump binaries with patch file


 
Great, that's just what needed!
Did you use the same binaries that have been uploaded to mediafire? (http://www.mediafire.com/file/5eep3w...mpdump-2.4.zip)
I used them with rtmpdumphelper. Maybe that's the cause of the problem?

KSV 04-23-2013 02:38 AM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by alexanderd (Post 61789)
Great, that's just what needed!
Did you use the same binaries that have been uploaded to mediafire

yeah those are the latest binaries.

Code:

rtmpsuck MD5: 6A42BD5F06958EAE05BC7480BDD06199
Quote:

Originally Posted by alexanderd (Post 61789)
I used them with rtmpdumphelper. Maybe that's the cause of the problem?

no, it has nothing to do with RTMPDump Helper. make sure new binaries are in the same folder as RTMPDump Helper.

alexanderd 04-23-2013 03:34 AM

Re: Customized rtmpdump binaries with patch file


 
I've just downloaded both zips (rtmpdump-2.4.zip from mediafire, from first post and RTMPDumpHelper from Nir Sofer's site). Extracted them in new folder (both in one). BTW, rtmpsuck's MD5 equals to yours.
Then I start rtmpdumphelper from that folder (it starts the rtmpsuck) and open the same test page (http://live.samaa.tv/). RTMPSuck starts capturing the stream, but saves it as samaalive.flv, without timestamp :(
I cannot understand it.
Everybody, please, test that issue too. It can't be that i'm the only lucky who experiences the overwriting problem.

gorilla.maguila 04-23-2013 11:28 AM

Re: Customized rtmpdump binaries with patch file


 
@KSV

Hi KSV, first thank you for your work.

I was testing your patches and I think I found a bug:

Steps to reproduce:

- Try to dump one of the streams of Icasthd. Take into account that Icasthd works per sessions so you will need to get a valid one.

icasthd.tv/?p=channeldetails&id=skysports1

For Example:

http://pastebin.com/qEi703wk

When dumping this kind of streams, from time to time I get a segfault.

One of the times I was running with gdb and I got a backtrace:

Code:

DEBUG: Parsed protocol: 0
DEBUG: Parsed host    : edge.icasthd.com
DEBUG: Parsed app    : live?f=skysports1&t=1366736989&/
INFO: rtmp server sent redirect

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6cff3c8 in _int_free () from /usr/lib/libc.so.6
(gdb) backtrace
#0  0x00007ffff6cff3c8 in _int_free () from /usr/lib/libc.so.6
#1  0x00007ffff7bcff2c in AMF_Reset () from /usr/lib/librtmp.so.0
#2  0x00007ffff7bcff81 in AMFProp_Reset () from /usr/lib/librtmp.so.0
#3  0x00007ffff7bcff1c in AMF_Reset () from /usr/lib/librtmp.so.0
#4  0x00007ffff7bcff81 in AMFProp_Reset () from /usr/lib/librtmp.so.0
#5  0x00007ffff7bcff1c in AMF_Reset () from /usr/lib/librtmp.so.0
#6  0x00007ffff7bc9e6a in ?? () from /usr/lib/librtmp.so.0
#7  0x00007ffff7bcd38c in RTMP_ClientPacket () from /usr/lib/librtmp.so.0
#8  0x00007ffff7bcd9bd in RTMP_ConnectStream () from /usr/lib/librtmp.so.0
#9  0x0000000000402554 in ?? ()
#10 0x00007ffff6ca7a15 in __libc_start_main () from /usr/lib/libc.so.6
#11 0x0000000000402ab5 in ?? ()


Also happened with a compiled version in android with ffmpeg based player, backtrace in android shows:

Code:

#00  pc 00018630  /system/lib/libc.so (memcpy+48)
#01  pc 00035d7b  /data/app-lib/com.android-1/librtmp.so (AMF_EncodeString+70)
#02  pc 00035fb1  /data/app-lib/com.android-1/librtmp.so (AMF_EncodeNamedString+48)
#03  pc 00031255  /data/app-lib/com.android-1/librtmp.so (RTMP_Connect1+2236)
#04  pc 00031593  /data/app-lib/com.android-1/librtmp.so (RTMP_Connect+98)
#05  pc 000330cf  /data/app-lib/com.android-1/librtmp.so
#06  pc 00033cbb  /data/app-lib/com.android-1/librtmp.so (RTMP_ClientPacket+818)
#07  pc 000345f5  /data/app-lib/com.android-1/librtmp.so (RTMP_ConnectStream+96)
#08  pc 002c514c  /data/app-lib/com.android-1/libffmpeg-neon.so

The same crash in x86_64:

http://pastebin.com/EKxJvh23

It seems it's some problem handling redirects as sometimes ffmpeg outputs:

Code:

04-23 18:55:33.949: A/ffmpeg(7739): Problem accessing the DNS. (addr: @4.102.63.22)
04-23 18:55:33.949: E/player.c(7739): player_set_data_source Could not open video file: rtmp://edge.icasthd.com:1935/redirect3 swfUrl=http://www.icasthd.tv://player/player.swf swfVfy=1 pageUrl=http://www.icasthd.tv playpath=skysports2 app=redirect3?f=skysports2&t=1366736137& live=1  (-1313558101: Unknown error occurred)


What do you think?

Regards

chap 04-23-2013 11:45 AM

Re: Customized rtmpdump binaries with patch file


 
example
Code:

>rtmpdump -r "rtmp://178.18.23.112:1935/live" -a "live?f=skysports1&t=1366738882
&" -f "WIN 11,6,602,180" -W "http://www.icasth
d.tv//player/player.swf" -p "http://www.icasthd.tv/embed.php?v=skysports1&vw=735
&vh=450&domain=icasthd.tv" --live -y "skysports1" -o "2013-04-23_08-41-26_skyspo
rts1.flv"
RTMPDump v2.4 GIT-2012-12-30 (Compiled by KSV)
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
Connecting ...
INFO: Connected...
Starting Live Stream
INFO: Metadata:
INFO:  duration                0.00
INFO:  width                  640.00
INFO:  height                  480.00
INFO:  videodatarate          341.80
INFO:  framerate              30.00
INFO:  videocodecid            7.00
INFO:  audiodatarate          31.25
INFO:  audiosamplerate        48000.00
INFO:  audiosamplesize        16.00
INFO:  stereo                  TRUE
INFO:  audiocodecid            10.00
INFO:  encoder                Lavf54.6.100
INFO:  filesize                0.00
1720.728 kB / 47.79 sec


gorilla.maguila 04-23-2013 11:48 AM

Re: Customized rtmpdump binaries with patch file


 
Quote:

Originally Posted by chap (Post 61810)
example
Code:

>rtmpdump -r "rtmp://178.18.23.112:1935/live" -a "live?f=skysports1&t=1366738882
&" -f "WIN 11,6,602,180" -W "http://www.icasth
d.tv//player/player.swf" -p "http://www.icasthd.tv/embed.php?v=skysports1&vw=735
&vh=450&domain=icasthd.tv" --live -y "skysports1" -o "2013-04-23_08-41-26_skyspo
rts1.flv"
RTMPDump v2.4 GIT-2012-12-30 (Compiled by KSV)
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
Connecting ...
INFO: Connected...
Starting Live Stream
INFO: Metadata:
INFO:  duration                0.00
INFO:  width                  640.00
INFO:  height                  480.00
INFO:  videodatarate          341.80
INFO:  framerate              30.00
INFO:  videocodecid            7.00
INFO:  audiodatarate          31.25
INFO:  audiosamplerate        48000.00
INFO:  audiosamplesize        16.00
INFO:  stereo                  TRUE
INFO:  audiocodecid            10.00
INFO:  encoder                Lavf54.6.100
INFO:  filesize                0.00
1720.728 kB / 47.79 sec



It doesn't crash every time. For me it crashes from time to time. Maybe once every 5 intents. Also don't use rtmp://edge.icasthd.com:1935/live instead force a redirect response rtmp://edge.icasthd.com:1935/redirect3

Example:

http://pastebin.com/qEi703wk

gorilla.maguila 04-23-2013 12:21 PM

Re: Customized rtmpdump binaries with patch file


 
Checking if null pointer seems to solve the crash.


Code:

void
AMF_Reset(AMFObject *obj)
{
  int n;
  for (n = 0; n < obj->o_num; n++)
    {
      AMFProp_Reset(&obj->o_props[n]);
    }
+  //check if null pointer
+  if(obj->o_props)
    free(obj->o_props);
  obj->o_props = NULL;
  obj->o_num = 0;
}


EDITED:

Doesn't Solve it. The culprit seems to be somewhere else

RedPenguin 04-23-2013 06:56 PM

Re: Customized rtmpdump binaries with patch file


 
I made some MacOS executables and librtmp test files using the x86 darwin compiler on Ubuntu 10.04 (older OS due to older code :))

I need ATV1 and MacOS users to try:

http://forum.xbmc.org/showthread.php...592#pid1404592


All times are GMT -6. The time now is 02:04 PM.