[Obsolete] MPWebStream: Stream TV over the internet (1 Viewer)

Oxan

Retired Team Member
  • Premium Supporter
  • August 29, 2009
    1,730
    1,124
    Home Country
    Netherlands Netherlands
    Re: [Beta] MPWebStream: Stream TV over the internet

    Mike, I've done the improvements you requested :) See attached DLL. Source is available here. Code example:
    Code:
    using MPWebStream.MediaTranscoding;
    
    class MPWebStreamExample {
       private void log(string message) {
          // do something with it
       }
    
       public void example(HttpContext context) {
          Log.RegisterWriter(new Log.LogWrite(MPWebStreamExample.log)); // you can leave this out but I need the log to debug if you've problems :)
    
          TranscoderProfile transcoder = new TranscoderProfile();
          transcoder.UseTranscoding = true; // or false for direct streaming, remove lines below
          transcoder.Transcoder = "<path to transcoder>";
          transcoder.Parameters = "<parameters for trasncoder>";
          transcoder.InputMethod = TransportMethod.Filename; 
          transcoder.OuputMethod = TransportMethod.NamedPipe;
    
          TranscodingStreamer streamer = new TranscodingStreamer("<path to source file>", transcoder);
          streamer.TranscodeToClient(context.Response); // returns after client disconnect or end of media
       }
    }
    Note that NamedPipe as an input method is a bit unstable for live TV. There are probably some bugs, but overall it's quite usable.

    Note to current MPWebStream users: you don't need this, this is just for application developers who want to integrate transcoding into their own application.
     

    Attachments

    • MPWebStream.MediaTranscoding.zip
      29.1 KB

    DieBagger

    Retired Team Member
  • Premium Supporter
  • September 11, 2007
    2,516
    1,276
    40
    Austria
    Home Country
    Austria Austria
    Re: [Beta] MPWebStream: Stream TV over the internet

    Mike, I've done the improvements you requested :) See attached DLL. Source is available here. Code example:
    Code:
    using MPWebStream.MediaTranscoding;
    
    class MPWebStreamExample {
       private void log(string message) {
          // do something with it
       }
    
       public void example(HttpContext context) {
          Log.RegisterWriter(new Log.LogWrite(MPWebStreamExample.log)); // you can leave this out but I need the log to debug if you've problems :)
    
          TranscoderProfile transcoder = new TranscoderProfile();
          transcoder.UseTranscoding = true; // or false for direct streaming, remove lines below
          transcoder.Transcoder = "<path to transcoder>";
          transcoder.Parameters = "<parameters for trasncoder>";
          transcoder.InputMethod = TransportMethod.Filename; 
          transcoder.OuputMethod = TransportMethod.NamedPipe;
    
          TranscodingStreamer streamer = new TranscodingStreamer("<path to source file>", transcoder);
          streamer.TranscodeToClient(context.Response); // returns after client disconnect or end of media
       }
    }
    Note that NamedPipe as an input method is a bit unstable for live TV. There are probably some bugs, but overall it's quite usable.

    Note to current MPWebStream users: you don't need this, this is just for application developers who want to integrate transcoding into their own application.

    Do you have sample parameters for e.g. streaming to android in different qualities? Would love to try this out...

    :D
     

    Oxan

    Retired Team Member
  • Premium Supporter
  • August 29, 2009
    1,730
    1,124
    Home Country
    Netherlands Netherlands
    Re: [Beta] MPWebStream: Stream TV over the internet

    I currently use ffmpeg.exe from here with parameters '-i "{0}" -b 512k -vcodec libx264 -flags +loop+mv4 -cmp 256 -partitions +parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -subq 7 -trellis 1 -refs 5 -bf 0 -flags2 +mixed_refs -coder 0 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -qmin 10 -qmax 51 -qdiff 4 -acodec aac -strict experimental -format mpegts -threads 4 "{1}"' and NamedPipe for both intput and output method. It works for my HTC Desire, but it's quite CPU-intensive for transcoding. Playing transport streams only works on Android 2.3+. Still no luck with finding a transcoder configuration that works with RockPlayer, VPlayer or yxPlayer.
     

    Mike Lowrey

    Portal Pro
    February 4, 2009
    638
    124
    Berlin
    Home Country
    Germany Germany
    Re: [Beta] MPWebStream: Stream TV over the internet

    Hi,

    is it right that there is no method to just get the url of the transcoded stream?
     

    Oxan

    Retired Team Member
  • Premium Supporter
  • August 29, 2009
    1,730
    1,124
    Home Country
    Netherlands Netherlands
    Re: [Beta] MPWebStream: Stream TV over the internet

    That is part of a much bigger problem, namely the hosting of the web services. Traditionally all services have included a webserver (mostly Cassini or aspNETserve) and a TvServerPlugin that starts and stops the webserver. I'm not sure about GMAWebService, but both the TV4Home WebService and MPWebStream also take this approach.

    I believe this is suboptimal: if you want to run multiple services you have to run multiple webservers, on different ports (which is a complication when you're behind NAT). These webservers are also more error-prone and with the old MPWebServices we have even had problems of it crashing the whole TvServer. Especially as IIS is free for almost all Windows 7 users, I think it would be the best if we eventually use that for hosting the webservices. As configuration is quite difficult, we'll probably need to write an installer that does the configuration, but I think there needs to be an easy installer for all the webservices and dependencies (TV4Home WebInterface, TV4Home CoreService, MPWebStream, GMAWebServices) anyway.

    To come back to this case: I don't think it makes sense to have to setup a whole MPWebStream setup just to use some transcoding. I've originally written MPWebStream to have some working streaming solution as MPWebServices was dead, but with the intention to integrate it into the other webservices (that do have a decent interface) later. Writing a handler that does the transcoding is actually quite simple with the DLL is posted. I believe providing that script in your service would be the easiest for the user (The DLL can also read the global MPWebStream config).

    But to answer your question: MPWebStream does provide a WCF service which has methods to retrieve an URL to the transcoded. The problem with this is that Cassini doesn't support hosting WCF services as Microsoft has limited that to self-hosting and IIS. So you need to setup MPWebStream under IIS if you want to use it. Anyway, it's name is MediaStream.svc, so you can try to use it.
     

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    AW: [Beta] MPWebStream: Stream TV over the internet

    I can suggest using IIS Express.

    • it runs on Windows XP and up
    • smaller footprint than full IIS and easy to install
    • can be installed side-by-side with the full IIS
    • can be integrated into our own setup as redist

    I have experiance enough with installers, so I could assist in building one, if I or you all get a clear understanding of what parts are to be included, integrated or merged. I don't have a clear vision which services belong together or not currently :)
     

    Mike Lowrey

    Portal Pro
    February 4, 2009
    638
    124
    Berlin
    Home Country
    Germany Germany
    Re: [Beta] MPWebStream: Stream TV over the internet

    I'm not sure about GMAWebService, but both the TV4Home WebService and MPWebStream also take this approach.
    Both the GMA and the TV4Home Core Service are using the self hosting feature... When using both in a webinterface(like i'm currently trying) i'm not accessing the services but use there dlls to have all functions without the hassle of connecting to the service...

    But to answer your question: MPWebStream does provide a WCF service which has methods to retrieve an URL to the transcoded. The problem with this is that Cassini doesn't support hosting WCF services as Microsoft has limited that to self-hosting and IIS. So you need to setup MPWebStream under IIS if you want to use it. Anyway, it's name is MediaStream.svc, so you can try to use it.
    I'm not using the full MPWebstream but your dll (MPWebStream.MediaTransconding) from git together with the code you posted above ;)

    The only problem is if i want to use the html5 video tag in my application i need an url like adress for the transcoded stream which isn't offered by the dll ;)
     

    Oxan

    Retired Team Member
  • Premium Supporter
  • August 29, 2009
    1,730
    1,124
    Home Country
    Netherlands Netherlands
    Re: [Beta] MPWebStream: Stream TV over the internet

    Well, then that's up to your code. You should put the code I've posted above in an ASP.NET Handler (implementation of IHttpHandler), and link to that page. The MPWebStream.MediaTranscoding namespace doesn't know about URLs, just about streams :)
     

    heerfordt

    Portal Pro
    February 19, 2007
    91
    8
    Re: [Beta] MPWebStream: Stream TV over the internet

    Hi Oxan,

    How about adding playlist support so all channels can easily be exported? I tried combining your plug with the enhancement made to the IPTV filter and it worked great. Without transcoding it requires some bandwidth dough, so it stream quality could be a parameter on the playlist.

    I have quick patch that should be able to generate the playlist.

    Br,
    H.
     

    Attachments

    • 0001-Added-playlist-support.patch
      5.4 KB

    Oxan

    Retired Team Member
  • Premium Supporter
  • August 29, 2009
    1,730
    1,124
    Home Country
    Netherlands Netherlands
    Re: [Beta] MPWebStream: Stream TV over the internet

    I have quick patch that should be able to generate the playlist.
    Thanks, I've merged your patch, with a little change to be able to generate per-transcoder playlists.
     

    Users who are viewing this thread

    Top Bottom