FAQ  •  Register  •  Login

RTMP/RTMPE Support

<<

CraigD

Serviio lover

Posts: 61

Joined: Tue Nov 08, 2011 2:05 pm

Post Tue Nov 08, 2011 2:15 pm

RTMP/RTMPE Support

This is more just a general query and not specific to plugins (though the answer will likely help in my plugin development):

Does serviio support RTMP/RTMPE streams? I know that ffmpeg has some sort of support for atleast RTMP but I haven't been able to do anything with it so far, and am not sure how serviio interfaces with ffmpeg so I don't know if it would make it work properly.

I am also wondering if anyone knows a good player to just test RTMP/RTMPE streams; VLC doesn't seem to work.

Thanks,
Craig
<<

moltra

DLNA master

Posts: 1871

Joined: Thu Mar 24, 2011 11:00 pm

Location: Ohio USA

Post Tue Nov 08, 2011 2:53 pm

Re: RTMP/RTMPE Support

zip wrote:yep, most likely librtmp. make sure you get the latest one (2.4). You can then check it's linked properly by executing

  Code:
ffmpeg -protocols


and it should include rtmp, rtmpe, etc


FFmpeg comes with a rtmp implementation built-in, that's what you're seeing in -protocols. rtmpLib will add more rtmpX based protocols so your FFmpeg is still not correctly built. Usually FFmpeg has to be built with --enable-librtmp
Mark
Beta Tester Group
http://www.serviidb.com Online media resource repository

Netgear EVA2000 | Samsung BD-D5300 | XBOX 360 | Windows 7 | Mint Debian 12 | Raxz Maxx
HowTo: Provide supported formats of a device HowTo: Record a new ticket on Bitbucket
HowTo: Provide details of a video file that doesn't play HowTo: Turn on detailed logging
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Tue Nov 08, 2011 2:55 pm

Re: RTMP/RTMPE Support

Yes, it does, with libRTMP (comes built into FFmpeg distributed with Win/OSX version of Serviio).

All libRTMP parameters are passed to FFmpeg as a part of the 'url' parameter, e.g.:

  Code:
ffmpeg -i "rtmp://stream.mp4 tcUrl=someurl app=some_app swfVfy=player_url"


List of all libRTMP params is here: http://rtmpdump.mplayerhq.hu/librtmp.3.html

VLC is a good player for rtmp streams, it works for most (if you can create the URL in one string, not using tcUrl, playpath, app parameters). Otherwise I just use FFmpeg -i to get the stream info or capture the stream. RTMPDump can also capture the stream, but should give the same results as FFmpeg, as it uses the same library.

Also, do not forget to update Serviio Wiki (http://wiki.serviio.org) with any info you find useful for others ;-)
<<

jhb50

DLNA master

Posts: 2843

Joined: Thu Jun 30, 2011 9:32 pm

Post Tue Nov 08, 2011 3:31 pm

Re: RTMP/RTMPE Support

I was just about to ask the same question!

Here's what I get when trying a link snooped from http://watch.discoverychannel.ca/#clip560780

  Code:
C:\Users\John>"C:\Programs\FFMPEG\ffmpeg.exe" -i "rtmpe://discovery.fcod.llnwd.n
et/a6290/d1/2011/11/02/DISC-AUC-EP-CIG-CLIP01.mp4"
ffmpeg version N-33591-gf884ef0, Copyright (c) 2000-2011 the FFmpeg developers
  built on Oct 13 2011 02:23:02 with gcc 4.6.1
  configuration: --enable-gpl --enable-version3 --enable-runtime-cpudetect --ena
ble-avisynth --enable-bzlib --enable-frei0r --enable-libopencore-amrnb --enable-
libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --ena
ble-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --en
able-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib

  libavutil    51. 21. 0 / 51. 21. 0
  libavcodec   53. 20. 1 / 53. 20. 1
  libavformat  53. 15. 0 / 53. 15. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 43. 6 /  2. 43. 6
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
HandShake: Type mismatch: client sent 6, server answered 9
Closing connection: NetStream.Failed
rtmpe://discovery.fcod.llnwd.net/a6290/d1/2011/11/02/DISC-AUC-EP-CIG-CLIP01.mp4:
 Operation not permitted


and if I include the link signature I get
  Code:
[NULL @ 01CF8740] Unable to find a suitable output format for 'rtmpe://discovery
.fcod.llnwd.net/a6290/d1/2011/11/02/DISC-AUC-EP-CIG-CLIP01.mp4?h=1f10eb325590d83
74e026c8bd5edf857'
rtmpe://discovery.fcod.llnwd.net/a6290/d1/2011/11/02/DISC-AUC-EP-CIG-CLIP01.mp4?
h=1f10eb325590d8374e026c8bd5edf857: Invalid argument


Any ideas?

EDIT: This same error happens using RTMPDUMP. It is apparently due to a new handshake being used with Flash 10 but it was reportedly fixed by RTMPDUMP 2.4, however I have tested with that and get the same failure.

I am using the latest version of FFMPEG 33591 but while it shows librtmp is enabled it does not list the librtmp version used like it does for the other libs...so how do I find out if 2.4 was used in that build?
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Tue Nov 08, 2011 4:20 pm

Re: RTMP/RTMPE Support

Yep, 2.4 would fix that. I've included in in the Win/OSX builds, not sure how you guys get it. One way would be to compile FFMpeg yourself with the latest libRTMP source. Patters' Synology guide might give some hints on how to do that.

I have the relevant sources on Serviio download page as well.
<<

jhb50

DLNA master

Posts: 2843

Joined: Thu Jun 30, 2011 9:32 pm

Post Tue Nov 08, 2011 5:57 pm

Re: RTMP/RTMPE Support

I got those errors using rtmpdump 2.4 so it did not fix it.

You said 2.4 was included in the windows build...is the ffmpeg you included in C:\Program Files (x86)\Serviio\lib\ffmpeg.exe also built with 2.4 ? If so why would we have to compile it ourselves?

Here is what I get using Serviio\lib\ffmpeg.exe

  Code:
C:\Users\John>"C:\Program Files (x86)\Serviio\lib\ffmpeg.exe" "rtmpe://discovery
.fcod.llnwd.net/a6290/d1/2011/11/02/DISC-AUC-EP-CIG-CLIP01.mp4"
ffmpeg version N-31480-g8bc3a48, Copyright (c) 2000-2011 the FFmpeg developers
  built on Jul 14 2011 23:37:53 with gcc 4.4.2
  configuration: --enable-static --disable-shared --disable-ffplay --disable-ffs
erver --enable-memalign-hack --enable-libmp3lame --enable-librtmp --extra-libs='
-lrtmp -lpolarssl -lws2_32 -lwinmm' --arch=x86 --enable-runtime-cpudetect --enab
le-pthreads --target-os=mingw32 --cross-prefix=i686-mingw32- --pkg-config=pkg-co
nfig
  libavutil    51. 11. 0 / 51. 11. 0
  libavcodec   53.  8. 0 / 53.  8. 0
  libavformat  53.  6. 0 / 53.  6. 0
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 25. 0 /  2. 25. 0
  libswscale    2.  0. 0 /  2.  0. 0
HandShake: Type mismatch: client sent 6, server answered 9
rtmp server sent error
rtmp server sent error
<<

CraigD

Serviio lover

Posts: 61

Joined: Tue Nov 08, 2011 2:05 pm

Post Tue Nov 08, 2011 6:32 pm

Re: RTMP/RTMPE Support

Very interesting that you guys are working on Discovery Channel as that was my motivation with my original questions. Seems that all the current tools for dealing with RTMP/RTMPE have issues with their streams due to handshake negotitation. I have been digging through the Discovery website code and it looks like they have some logic to fallback to some sort of Silverlight based player, which I'm assuming/hoping uses a different stream format than RTMP. I hope to investigate this in the next couple of days.

Just another general clarification: I'm running Ubuntu so I assume that serviio is using the system's ffmpeg; is this correct (which I'm pretty sure does not have RTMP support compiled in)? If this is the case, should I expect any problems with serviio if I go ahead and grab and compile the latest and greatest version of ffmpeg off the trunk?

Thanks,
Craig
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Tue Nov 08, 2011 6:53 pm

Re: RTMP/RTMPE Support

Sould be ok, get the latest, or get the source off Serviio's download page.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Tue Nov 08, 2011 9:51 pm

Re: RTMP/RTMPE Support

jhb50 wrote:I got those errors using rtmpdump 2.4 so it did not fix it.

You said 2.4 was included in the windows build...is the ffmpeg you included in C:\Program Files (x86)\Serviio\lib\ffmpeg.exe also built with 2.4 ? If so why would we have to compile it ourselves?

Here is what I get using Serviio\lib\ffmpeg.exe

  Code:
C:\Users\John>"C:\Program Files (x86)\Serviio\lib\ffmpeg.exe" "rtmpe://discovery
.fcod.llnwd.net/a6290/d1/2011/11/02/DISC-AUC-EP-CIG-CLIP01.mp4"
ffmpeg version N-31480-g8bc3a48, Copyright (c) 2000-2011 the FFmpeg developers
  built on Jul 14 2011 23:37:53 with gcc 4.4.2
  configuration: --enable-static --disable-shared --disable-ffplay --disable-ffs
erver --enable-memalign-hack --enable-libmp3lame --enable-librtmp --extra-libs='
-lrtmp -lpolarssl -lws2_32 -lwinmm' --arch=x86 --enable-runtime-cpudetect --enab
le-pthreads --target-os=mingw32 --cross-prefix=i686-mingw32- --pkg-config=pkg-co
nfig
  libavutil    51. 11. 0 / 51. 11. 0
  libavcodec   53.  8. 0 / 53.  8. 0
  libavformat  53.  6. 0 / 53.  6. 0
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 25. 0 /  2. 25. 0
  libswscale    2.  0. 0 /  2.  0. 0
HandShake: Type mismatch: client sent 6, server answered 9
rtmp server sent error
rtmp server sent error

Right, it's probably missing some additional parameters (swfUrl etc). You should try to do the rtmpserv trick linked in the plugin dev guide - basically pretending your PC is the rtmp server, the player will send rtmp request to it and you'll be able to see the parameters thay are using.
<<

jhb50

DLNA master

Posts: 2843

Joined: Thu Jun 30, 2011 9:32 pm

Post Tue Nov 08, 2011 10:39 pm

Re: RTMP/RTMPE Support

I will try that.

Also I have noted that the player tries to connect 3 times before it is successful per the below and that Akami is used.

I found this post refers to a similar interchange for Akami authentication and subsequent posts refer to rtmpdump patches to fix it...http://lists.mplayerhq.hu/pipermail/rtmpdump/2011-July/001488.html

Still does not explain why I get the "HandShake: Type mismatch: client sent 6, server answered 9" error that was supposedly fixed in 2.4.

I'm rapidly sinking over my head but perhaps others will undersatnd this better !!

  Code:
[FLASH] PlayVideo called, stream url is: rtmpe://discovery.fcod.llnwd.net/a6290/d1/2011/11/02/DISC-AUC-EP-CIG-CLIP01.mp4?h=1f10eb325590d8374e026c8bd5edf857
#clip560780
[FLASH] Video Player Controls have been ENABLED.
#clip560780
[FLASH] VideoPlayer::clearBug
#clip560780
[FLASH] getShowMetaData ran...
#clip560780
[FLASH] getShowMetaData > about to add metadata overlay
#clip560780
[FLASH] Attempting to connect to: discovery.fcod.llnwd.net/a6290
#clip560780
[FLASH] NET STATUS: NetConnection.Connect.Rejected
#clip560780
[FLASH] NET STATUS: NetConnection.Connect.Rejected
#clip560780
[FLASH] NET STATUS: NetConnection.Connect.Rejected
#clip560780
[FLASH] NET STATUS: NetConnection.Connect.Success
#clip560780
[FLASH] NetConnection connected
#clip560780
[FL1f10eb325590d8374e026c8bd5edf857)
#clip560780
[FLASH] NET STATUS: NetStream.Play.Reset
#clip560780
[FLASH] NET STATUS: NetStream.Play.Start
#clip560780
[FLASH] Video stream metadata has been received:<br/>Duration388.841<br/>Dimension: 640x360
#clip560780
[FLASH] Video AR: 1.7777777777777777<br/>Player AR: 1.7777777777777777ASH] Attach stream: [object AkamaiNetStream]
#clip560780
[FLASH] play call(mp4:d1/2011/11/02/DISC-AUC-EP-CIG-CLIP01.mp4?h=
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Wed Nov 09, 2011 12:08 am

Re: RTMP/RTMPE Support

This works for me:

  Code:
rtmpe://discovery.fcod.llnwd.net/a6290 playpath=mp4:d1/2011/11/02/DISC-AUC-EP-CIG-CLIP01.mp4?h=1f10eb325590d8374e026c8bd5edf857


It still shows the same error message but it gets the stream information - I think we can ignore the warning
<<

jhb50

DLNA master

Posts: 2843

Joined: Thu Jun 30, 2011 9:32 pm

Post Wed Nov 09, 2011 12:30 am

Re: RTMP/RTMPE Support

What did you use? I tried serviio/bin/ffmpeg and could only get it if I add -strict experimental for aac stream but then get a lot of error messages too.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Wed Nov 09, 2011 9:27 am

Re: RTMP/RTMPE Support

I just typed

  Code:
ffmpeg -i "rtmpe://discovery.fcod.llnwd.net/a6290 playpath=mp4:d1/2011/11/02/DISC-AUC-EP-CIG-CLIP01.mp4?h=1f10eb325590d8374e026c8bd5edf857"


I didn't try to download the stream. But you could transcode audio to ac3 to avoid the aac experimental stuff.
<<

jhb50

DLNA master

Posts: 2843

Joined: Thu Jun 30, 2011 9:32 pm

Post Wed Nov 09, 2011 3:11 pm

Re: RTMP/RTMPE Support

Forgot to ask... where did you find that url? Firebug gave me clues to it but I would not have known to append playpath=. I need to use the same tools as you. Thanks.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Wed Nov 09, 2011 3:25 pm

Re: RTMP/RTMPE Support

playpath is one of the libRTMP parameters, linked above. The value was taken from your log. You would probably see this param and it's value if you ran the rtmpserv/rtmpsuck trick according to the guide - I just tried it as I've seen similar before.
<<

CraigD

Serviio lover

Posts: 61

Joined: Tue Nov 08, 2011 2:05 pm

Post Thu Nov 10, 2011 12:59 am

Re: RTMP/RTMPE Support

I just compiled ffmpeg from source with librtmp support on Ubuntu:

  Code:
cdunford@dunford-linux-dev:~$ ffmpeg -protocols
ffmpeg version git-2011-11-09-dea8f6e, Copyright (c) 2000-2011 the FFmpeg developers
  built on Nov  9 2011 19:34:28 with gcc 4.6.1
  configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-librtmp --enable-libvpx
  libavutil    51. 24. 1 / 51. 24. 1
  libavcodec   53. 29. 0 / 53. 29. 0
  libavformat  53. 20. 0 / 53. 20. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 47. 0 /  2. 47. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
Supported file protocols:
I.. = Input  supported
.O. = Output supported
..S = Seek   supported
FLAGS NAME
-----
I..   applehttp
I.S   cache
I.S   concat
I..   crypto
IOS   file
IO.   gopher
IOS   http
I.S   mmsh
I..   mmst
.O.   md5
IO.   pipe
IO.   rtmp
IO.   rtmpt
IO.   rtmpe
IO.   rtmpte
IO.   rtmps
IO.   rtp
IO.   tcp
IO.   udp


When I try the URL above, I get an error not a warning:

  Code:
25590d8374e026c8bd5edf857"
ffmpeg version git-2011-11-09-dea8f6e, Copyright (c) 2000-2011 the FFmpeg developers
  built on Nov  9 2011 19:34:28 with gcc 4.6.1
  configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-librtmp --enable-libvpx
  libavutil    51. 24. 1 / 51. 24. 1
  libavcodec   53. 29. 0 / 53. 29. 0
  libavformat  53. 20. 0 / 53. 20. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 47. 0 /  2. 47. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
HandShake: Type mismatch: client sent 6, server answered 9
HandShake: Server not genuine Adobe!
RTMP_Connect1, handshake failed.
rtmpe://discovery.fcod.llnwd.net/a6290 playpath=mp4:d1/2011/11/02/DISC-AUC-EP-CIG-CLIP01.mp4?h=1f10eb325590d8374e026c8bd5edf857: Operation not permitted


Which is along the same lines as what I got with rtmpdump on Windows (the 6 - 9 mismatch).

What warning do you get when you ffmpeg this stream? Do you have an suggestions on how to capture this?
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Thu Nov 10, 2011 1:15 am

Re: RTMP/RTMPE Support

Did you get the latest libRTMP sources (2.4)?

This is what I get:

  Code:
d:\sample_media\video>ffmpeg -i "rtmpe://discovery.fcod.llnwd.net/a6290 playpath=mp4:d1/2011/11/02/D
ISC-AUC-EP-CIG-CLIP01.mp4?h=1f10eb325590d8374e026c8bd5edf857"
ffmpeg version N-31480-g8bc3a48, Copyright (c) 2000-2011 the FFmpeg developers
  built on Jul 14 2011 23:37:53 with gcc 4.4.2
  configuration: --enable-static --disable-shared --disable-ffplay --disable-ffserver --enable-memal
ign-hack --enable-libmp3lame --enable-librtmp --extra-libs='-lrtmp -lpolarssl -lws2_32 -lwinmm' --ar
ch=x86 --enable-runtime-cpudetect --enable-pthreads --target-os=mingw32 --cross-prefix=i686-mingw32-
 --pkg-config=pkg-config
  libavutil    51. 11. 0 / 51. 11. 0
  libavcodec   53.  8. 0 / 53.  8. 0
  libavformat  53.  6. 0 / 53.  6. 0
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 25. 0 /  2. 25. 0
  libswscale    2.  0. 0 /  2.  0. 0
HandShake: Type mismatch: client sent 6, server answered 9
Metadata:
  duration              388.84
  moovPosition          32.00
  width                 640.00
  height                360.00
  videocodecid          avc1
  audiocodecid          mp4a
  avcprofile            77.00
  avclevel              31.00
  aacaot                2.00
  videoframerate        29.97
  audiosamplerate       22050.00
  audiochannels         1.00
trackinfo:
  length                11650000.00
  timescale             29970.00
  language              eng
sampledescription:
  sampletype            avc1
  length                8573952.00
  timescale             22050.00
  language              eng
sampledescription:
  sampletype            mp4a
[flv @ 012294a0] Estimating duration from bitrate, this may be inaccurate

Seems stream 0 codec frame rate differs from container frame rate: 59.94 (54000000/900901) -> 29.97
(30000/1001)
Input #0, flv, from 'rtmpe://discovery.fcod.llnwd.net/a6290 playpath=mp4:d1/2011/11/02/DISC-AUC-EP-C
IG-CLIP01.mp4?h=1f10eb325590d8374e026c8bd5edf857':
  Metadata:
    duration        : 389
    moovPosition    : 32
    width           : 640
    height          : 360
    videocodecid    : avc1
    audiocodecid    : mp4a
    avcprofile      : 77
    avclevel        : 31
    aacaot          : 2
    videoframerate  : 30
    audiosamplerate : 22050
    audiochannels   : 1
  Duration: 00:06:28.84, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: h264 (Main), yuv420p, 640x360 [PAR 90:90 DAR 16:9], 29.97 tbr, 1k tbn, 59.94
 tbc
    Stream #0.1: Audio: aac, 44100 Hz, 2 channels (FC), s16
At least one output file must be specified
<<

CraigD

Serviio lover

Posts: 61

Joined: Tue Nov 08, 2011 2:05 pm

Post Thu Nov 10, 2011 1:24 am

Re: RTMP/RTMPE Support

Interesting.... I did

  Code:
git clone git://git.ffmpeg.org/rtmpdump


and built that with

  Code:
make SYS=posix


then I proceeded to build ffmpeg from the trunk with

  Code:
--enable-librtmp


What platform are you on? Do you see anything I have goofed?

EDIT:

I obviously didn't look close enough; looks like you are on Windows using mingw; is that correct? Not sure that the platform really has much to do with this, but I can't really tell where we are different here... Are you actually able to capture that stream with ffmpeg?
<<

CraigD

Serviio lover

Posts: 61

Joined: Tue Nov 08, 2011 2:05 pm

Post Thu Nov 10, 2011 1:35 am

Re: RTMP/RTMPE Support

I see your configure line has:

  Code:
--extra-libs='-lrtmp -lpolarssl -lws2_32 -lwinmm'


I'm not sure what this is, but it looks like a difference between us that could affect us on librtmp... do you know how/why/what these extra libs are?
<<

jhb50

DLNA master

Posts: 2843

Joined: Thu Jun 30, 2011 9:32 pm

Post Thu Nov 10, 2011 4:04 am

Re: RTMP/RTMPE Support

Zip only did an ffmpeg -i on the stream, but I was able to capture it.
It was your post that got me working on this and I need to do more work on it. I'll post when I get there.
Next

Return to Plugin development

Who is online

Users browsing this forum: No registered users and 17 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.