ConnectPacket

Some servers were causing RtmpDump to stop at this step

  DEBUG: Invoking connect
  INFO: Connected...
  ERROR: RTMP_ReadPacket, failed to read RTMP packet header
  DEBUG: Closing connection.

Ref
http://github.com/downloads/K-S-V/Scripts/rtmpdump-2.4.zip
http://lists.mplayerhq.hu/pipermail/rtmpdump/2011-December/001756.html
Problem server
http://tvpublica.com.ar/vivo
Other tested servers
http://canaldosconcursos.com.br/video_demo.php?id_cursos=3130
http://tape.tv
http://viki.com/channels/5453-killer-k/videos/51483
http://zonytvcom.info/colorstv.php
StripParams

The querystring for the "-a" parameter was also being used with the "-r"
parameter. This is not necessary. Cannot use with "-W" as some servers require
the querystring. Function was moved to librtmp to allow use across the project.

Taken from KSV patch file
http://github.com/downloads/K-S-V/Scripts/rtmpdump-2.4.zip
Tested with
http://history.com/shows/the-universe/videos#the-universe-spaceship-earth
http://myspace.com/music/player?sid=87831010
http://teledunet.com
RtmpSrv command line options

-c, --cert cert
-h, --help
-i, --printonly
-k, --key key
-p, --port port
-v, --version
-z, --debug

I chose to reuse the internal global variable "RTMP_ctrlC" for "--printonly" to
avoid rewriting several function calls.
Better URL decoding support

Currently RtmpDump has limited URL decoding support. If you use Bastien’s patch
as shown here
http://lists.mplayerhq.hu/pipermail/rtmpdump/2012-September/002093.html
You can pass encoded characters like this

  rtmpdump -o a.flv -i "rtmp://server.com/app playpath=foobar\0a"

Where "\0a" will be decoded as a newline.

Also the Playpath can be decoded using an unpatched RtmpDump, as long as it is
part of the "-r" parameter and properly parsed. Example

  rtmpdump -o a.flv -r rtmp://server.com/app/foobar%0a

Where "%0a" will be decoded as a newline. This presents two problems. One, many
times RtmpDump is unable to correctly parse the Playpath, mixing it with the
"app". Two, if you explicitly state the Playpath with "-y", you lose the URL
decoding support. I have simply moved the URL decoding function that Howard
wrote to parseurl.c and declared it in rtmp.h, so that it can be used across the
project. This patch also address concerns here
http://lists.mplayerhq.hu/pipermail/rtmpdump/2012-October/002112.html
RtmpSuck print UsherToken

RtmpSuck already supports streams with UsherToken. This patch merely prints the
UsherToken if found, for those who might want to invoke RtmpDump.

Taken from KSV patch file
http://github.com/downloads/K-S-V/Scripts/rtmpdump-2.4.zip
Tested with
http://de.twitch.tv
Fix Handle AMF_ECMA_ARRAY and AMF_STRICT_ARRAY objects

This fixes metadata and percent logging.

http://lists.mplayerhq.hu/pipermail/rtmpdump/2012-November/002189.html

Bad example
  INFO: Metadata:
  2256.298 kB / 174.99 sec
  Download complete

Good example
  INFO: Metadata:
  INFO:   duration              175.01
  INFO:   moovPosition          2182010.00
  INFO:   audiocodecid          mp4a
  INFO:   aacaot                2.00
  INFO:   audiosamplerate       44100.00
  INFO:   audiochannels         2.00
  INFO: tags:
  INFO:   -¬too                 FAAC 1.28
  INFO: trackinfo:
  INFO:   length                7717888.00
  INFO:   timescale             44100.00
  INFO: sampledescription:
  INFO:   sampletype            mp4a
  2256.298 kB / 174.99 sec (99.9%)
  Download complete
Fix rtmpdump.c compiler warning

rtmpdump.c: In function `GetLastKeyframe':
rtmpdump.c:297:7: warning: unknown conversion type character `l' in format
rtmpdump.c:297:7: warning: too many arguments for format

http://stackoverflow.com/q/586928/how-should-i-print-types-like-off-t-and-size-t
Fix thread.c compiler warning

thread.c: In function `ThreadCreate':
thread.c:35:11: warning: comparison between pointer and integer

http://stackoverflow.com/q/3905538/testing-for-an-invalid-windows-handle-should