Page 2 of 3

Re: RTMP/RTMPE Support

PostPosted: Thu Nov 10, 2011 9:15 am
by zip
CraigD wrote: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?

No, those are libs needed for the Windows build, especially the SSL library. I assume your build links to OpenSSL instead.

I'm just wondering if there is another version of libRTMP on your system that is linked to FFmpeg instead. Try to use lld command (or whatever it is on your Linux) to check FFmpeg dependencies.

Re: RTMP/RTMPE Support

PostPosted: Fri Nov 11, 2011 1:57 am
by CraigD
Ok turns out somehow I had an older librtmp hanging around that ffmpeg was using (no idea how it happened; wish I did). I replaced it and rebuilt ffmpeg and I was able to capture the stream:

  Code:
cdunford@dunford-linux-dev:/usr/lib/x86_64-linux-gnu$ ffmpeg -i "rtmpe://discovery.fcod.llnwd.net/a6290 playpath=mp4:d1/2011/11/02/DISC-AUC-EP-CIG-CLIP01.mp4?h=1f10eb325590d8374e026c8bd5edf857" -acodec copy -vcodec libx264  ~/test.m2ts
ffmpeg version git-2011-11-09-dea8f6e, Copyright (c) 2000-2011 the FFmpeg developers
  built on Nov 10 2011 20:29:54 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-libvpx --enable-librtmp
  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
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

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-CIG-CLIP01.mp4?h=1f10eb325590d8374e026c8bd5edf857':
  Metadata:
    moovPosition    : 32
    avcprofile      : 77
    avclevel        : 31
    aacaot          : 2
    videoframerate  : 30
    audiochannels   : 1
  Duration: 00:06:28.84, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p, 640x360 [SAR 90:90 DAR 16:9], 29.97 tbr, 1k tbn, 59.94 tbc
    Stream #0:1: Audio: aac, 44100 Hz, 2 channels (FC), s16
File '/home/cdunford/test.m2ts' already exists. Overwrite ? [y/N] y
w:640 h:360 pixfmt:yuv420p tb:1/1000000 sar:90/90 sws_param:
[libx264 @ 0x2be6860] using SAR=1/1
[libx264 @ 0x2be6860] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle Cache64
[libx264 @ 0x2be6860] profile High, level 3.0
[mpegts @ 0x2be6300] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, mpegts, to '/home/cdunford/test.m2ts':
  Metadata:
    moovPosition    : 32
    avcprofile      : 77
    avclevel        : 31
    aacaot          : 2
    videoframerate  : 30
    audiochannels   : 1
    encoder         : Lavf53.20.0
    Stream #0:0: Video: h264, yuv420p, 640x360 [SAR 90:90 DAR 16:9], q=-1--1, 90k tbn, 29.97 tbc
    Stream #0:1: Audio: aac, 44100 Hz, 2 channels (FC)
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=11652 fps= 33 q=-1.0 Lsize=   37417kB time=00:06:28.72 bitrate= 788.5kbits/s dup=2 drop=0   
video:30235kB audio:2222kB global headers:0kB muxing overhead 15.282050%
[libx264 @ 0x2be6860] frame I:217   Avg QP:20.80  size: 20310
[libx264 @ 0x2be6860] frame P:4639  Avg QP:24.34  size:  4686
[libx264 @ 0x2be6860] frame B:6796  Avg QP:27.93  size:   709
[libx264 @ 0x2be6860] consecutive B-frames: 12.5% 23.8% 15.8% 47.8%
[libx264 @ 0x2be6860] mb I  I16..4: 17.5% 38.0% 44.6%
[libx264 @ 0x2be6860] mb P  I16..4:  5.5%  8.2%  2.6%  P16..4: 37.3% 14.5%  6.3%  0.0%  0.0%    skip:25.5%
[libx264 @ 0x2be6860] mb B  I16..4:  0.3%  0.3%  0.1%  B16..8: 33.1%  2.5%  0.3%  direct: 0.9%  skip:62.5%  L0:40.6% L1:53.0% BI: 6.4%
[libx264 @ 0x2be6860] 8x8 transform intra:47.3% inter:63.0%
[libx264 @ 0x2be6860] coded y,uvDC,uvAC intra: 50.9% 65.0% 24.2% inter: 10.5% 12.2% 0.9%
[libx264 @ 0x2be6860] i16 v,h,dc,p: 33% 26% 11% 31%
[libx264 @ 0x2be6860] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 24% 19%  4%  4%  5%  5%  5%  6%
[libx264 @ 0x2be6860] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 23% 12%  5%  6%  6%  7%  5%  5%
[libx264 @ 0x2be6860] i8c dc,h,v,p: 43% 25% 23%  9%
[libx264 @ 0x2be6860] Weighted P-Frames: Y:4.2% UV:2.7%
[libx264 @ 0x2be6860] ref P L0: 66.9% 14.6% 13.2%  5.2%  0.1%
[libx264 @ 0x2be6860] ref B L0: 90.4%  8.3%  1.3%
[libx264 @ 0x2be6860] ref B L1: 96.2%  3.8%
[libx264 @ 0x2be6860] kb/s:637.06


This is very exciting. Any chance you can give some hints on what the new plugin interface will look like so I can get started?

Also wonder if you have considered exposing a way to group "clips" together in a single title, as for example on Discovery a single episode is usually composed of 5 or 6 clips.

Re: RTMP/RTMPE Support

PostPosted: Fri Nov 11, 2011 9:29 am
by zip
Interface for feed plugins won't change, only the returned object may have more properties now (e.g. cache key, live flag, etc). There will be another interface to get items from any resource, other than feed, e.g. a web site. Haven't started on that yet, but that one will return a set of items found on the website, now just one feed item.

Btw, if you have time it'd be great if you can write a little howto for building FFmpeg with libRTMP on Linux at the Wiki (wiki.serviio.org)

Re: RTMP/RTMPE Support

PostPosted: Fri Nov 11, 2011 1:25 pm
by CraigD
Sure I can do that!

I think since you haven't started on the new plugin interface, it might be worthwhile to design in the ability to group clips at different levels, for example Show, Season, Episode. A lot of websites (here atleast) provide old seasons of their series online and it would be nice to be able to expose them grouped together so they are easy to sort through.

Re: RTMP/RTMPE Support

PostPosted: Fri Nov 11, 2011 1:32 pm
by zip
I can do that - although at least at the beginning the hierarchy will most likely be ignored and presented as a flat list. Also it's important to remember that if a plugin returns hundreds of entries it will be very slow to go through and to be kept up-to-date. Also need to wire in the max. number of 'feed items' setting - if it's a hierarchy it won't make much sense, unless it's up to the plugin developer.

Re: RTMP/RTMPE Support

PostPosted: Fri Nov 11, 2011 1:55 pm
by CraigD
Good point. If I read the plugin specs correctly, it seems that plugins are asked to refresh at a specified interval. Potentially you could build something in so that the plugin can provide suggested times for refresh, or have it configurable by stream in the console. For example I would have discovery update at 2am every other day or something like, and have NHL gamecenter update at noon each day to get todays games. A lot of the sites I'm after, there isn't much point in trying to refresh them more than once a day.

Re: RTMP/RTMPE Support

PostPosted: Fri Nov 11, 2011 3:14 pm
by zip
feeds are checked accordong to the setting in the console. Some feed items can expire earlier though, e.g. iPlayer URL's will expire within 2 hours, Hulu just after the duration of the video, etc - so a plugin can specify expiry date for the entry. Serviio then expires the whole feed if any single entry expires - so that it can get a new shapshot of the feed.

It'll probably work similarly in the 'any resource' kind of plugins.

Re: RTMP/RTMPE Support

PostPosted: Fri Nov 11, 2011 3:16 pm
by jhb50
I agree and have added that to my 423 request along with the include and a refresh on demand button https://bitbucket.org/xnejp03/serviio/issue/423/console-online-sources-enhancement#comment-778457

Re: RTMP/RTMPE Support

PostPosted: Sun Nov 13, 2011 5:17 am
by CraigD

Re: RTMP/RTMPE Support

PostPosted: Sun Nov 13, 2011 11:24 am
by zip
CraigD wrote:Guide for building ffmpeg: http://wiki.serviio.org/doku.php?id=build_ffmpeg_linux

great. Maybe you could update it to get the sources from Serviio download page as it might include patches. Also x264 is not used by Serviio, so it should be marked as an optional step.

Re: RTMP/RTMPE Support

PostPosted: Sun Nov 13, 2011 3:23 pm
by CraigD
Sure I will update it with that info. Are there any plans to support x264 or to expose more ffmpeg options through transcoding profiles or any other means?

Re: RTMP/RTMPE Support

PostPosted: Sun Nov 13, 2011 5:27 pm
by zip
not atm

Re: RTMP/RTMPE Support

PostPosted: Fri Dec 16, 2011 8:40 am
by will
A little bit of info for debian 6 incase anyone else has a problem.

I had to install librtmp0 via apt, then download and build it from source and install it, then download and build ffmpeg from source. If I didn't have some of the files which the repository provided, ffmpeg wouldn't find the .so.0 file at the end of it all. I could probably edit the pkconfig myself, but this was the easiest solution as I was in a rush. I'll compare what gets installed via both methods at some point.

Re: RTMP/RTMPE Support

PostPosted: Fri Dec 30, 2011 1:22 pm
by patters
Here's how I compiled FFmpeg 0.9 with libRTMP for the Synology packages. It won't be identical but it should be enough to guide you to a workable solution:
http://pcloadletter.co.uk/2011/12/30/co ... h-librtmp/

Re: RTMP/RTMPE Support

PostPosted: Mon Jan 16, 2012 11:25 am
by Illico
I create a plugin for TF1.fr RSS video feed, but I still have problem with rtmp/rtmpe protocol.
I have handshack error:
HandShake: Type mismatch: client sent 6, server answered 9
RTMP_ReadPacket, failed to read RTMP packet header


I though that with latest librtmp 2.4, that will be solved:
v2.4: Aside from various minor bugfixes since 2.3, RTMPE type 9 handshakes are now supported.

But with Windows 0.6.2RC version, I still have the problem.
Any Ideas?

Re: RTMP/RTMPE Support

PostPosted: Mon Jan 16, 2012 1:08 pm
by zip
You could ask at rtmpdump mailing list. Also try rtmpdump.exe first (2.4).

Re: RTMP/RTMPE Support

PostPosted: Mon Jan 16, 2012 1:13 pm
by Illico
zip wrote:You could ask at rtmpdump mailing list. Also try rtmpdump.exe first (2.4).

Yes thanks, yesterday, I have done some test with rtmpdump2.4, but I had strange logs and "bip" on my windows machine...I'll retry.

Re: RTMP/RTMPE Support

PostPosted: Tue May 15, 2012 2:04 pm
by insane822
Hello,

Does the current version of serviio support Handshake 10 for rtmp streams? I'm finishing up a plugin but it appears they updated their streams in the past few weeks with the new handshake, so if there's a newer version I'd like to test it out.

I get this error using ffmpeg that comes with serviio:
  Code:
HandShake: Type mismatch: client sent 6, server answered 9
rtmp server sent error
rtmp server requested close


RTMPDump 2.5 works:
  Code:
RTMPDump v2.5 GIT-2012-03-31 (Handshake 10 support by Xeebo)
(c) 2010 Andrej Stepanchuk, Howard Chu, The Flvstreamer Team; license: GPL
Connecting ...
WARNING: HandShake: Type mismatch: client sent 6, server answered 10
INFO: Connected...
ERROR: HandleCtrl: SWFVerification Type 2 request not supported, attempting to use SWFVerification Type 1! Patches welcome...
Starting download at: 0.000 kB
...
3869.504 kB / 9.22 sec (0.2%)



Thanks! :)

Re: RTMP/RTMPE Support

PostPosted: Tue May 15, 2012 2:50 pm
by will
Serviio 0.6.2 includes ffmpeg 0.9/libRTMP 2.4. Handshake 10 was only added in the unofficial libRTMP 2.5 builds so no, the current version of ffmpeg bundled with serviio doesn't support it, but there is no reason you cannot note in your post with your plugin that users need to download a newer version and include links to the binary builds and source code that you used (which would proabably just be the latest).

I guess once 1.0 is ready, zip will update them, but I think the eta is around 2 months max at the moment.

Re: RTMP/RTMPE Support

PostPosted: Tue May 15, 2012 3:11 pm
by zip
any idea if the patch has been made in the official rtmpdump repository? if yes I'll use that for the 1.0 FFmpeg build.