Results 1 to 7 of 7

Thread: get live stream duration

  1. #1

    Default get live stream duration

    Hello,

    I have two streaming plans one: users can stream for 2 hours and 100 viewing hours (VOD), the second users can stream for 6 hours and 500 viewing hours. I don't want users to pass their limits

    I want to calculate the stream duration to charge my clients, and VOD time too.
    Another thing: is it possible to set the limit for each plan on Wowza from the beginning ?

    Thanks
    Last edited by elshorbagy76; 03-16-2012 at 07:27 AM.

  2. #2
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    There is nothing built-in for this. To limit users in real-time will take some work, but I will show you one approach. First though, the easier approach is to look back at logs. If some accounts are over, have a plan to bill for that. To add user info to logs follow this guide:

    http://www.wowza.com/forums/content....aming-by-users

    Then you could aggregate x-duration values per user from rows with x-event "destroy" and x-category "stream". There can be exceptions however, and it is actually best to get x-duration from rows with max(time). Parsing logs into db table(s) would probably be necessary for you. There is a way to log directly to a database, but I won't even show it to you because it is too fragile for business use.

    You might be able to start use Sawmill for this

    The way to limit for a real-time Pay Per Minute (PPM) type system for Flash RTMP clients is using IMediaStreamActionNotify3:

    http://www.wowza.com/forums/content....-of-codec-info

    This system is probably going to want to interface with other systems. Direct JDBC calls to a db are better than HTTP calls to, for example, a web service, but both are going to impact the system.

    For HTTP clients, with large chunk size in device cache, real-time PPM is harder to implement as precisely as for Flash RTMP clients. The way to involve HTTP and RTSP clients in a real-time PPM system is get data from the session objects and IOPerformanceCounter in these events:
    	public void onRTPSessionDestroy(RTPSession rtpSession) {
    		
    		IOPerformanceCounter perf = rtpSession.getIOPerformanceCounter();	
        }
    	
    	public void onHTTPSessionDestroy(IHTTPStreamerSession httpSession) {
    		
    		IOPerformanceCounter perf = httpSession.getIOPerformanceCounter();	
        }
    To monitor HTTPSession and kill it if it goes over, would be much more involved and be initiated in onHTTPSessionCreate and onRTPSessionCreate.

    Again, be aware that interacting with backend systems is going to have an impact. Avoid HTTP calls. Use JDBC, but as minimally as possible. Looking back at logs has no impact.

    Richard

  3. #3

    Default

    Thanks a lot.

    "x-duration" is it in milliseconds?
    And why logging to database is too fragile for business use?

  4. #4
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    x-duration is in seconds.

    With Log4j JDBC appender, we have noticed that when connection is lost for any reason it is not re-established.

    http://www.wowza.com/forums/content....-to-a-Database

    Richard

  5. #5

    Default

    I understand, so what I should do u is reading "wowzamediaserver_access.log" log file and save it to a database instead?

  6. #6
    Join Date
    Dec 2007
    Posts
    21,962

    Default

    Yes, that is my advice. There are inexpensive conversion applications, or you can write something yourself.

    Richard

  7. #7
    Join Date
    Jan 2009
    Posts
    4

    Default

    I have been trying Sawmill, and can not seem to figure out how that calculate play duration, it certainly does not match with the log files. What are other people using to get data?

Similar Threads

  1. Duration of live stream!
    By Atmapuri in forum Wowza Streaming Server Java API
    Replies: 3
    Last Post: 03-18-2014, 02:12 AM
  2. Live stream HLS repeat stream in a duration (not live)
    By lee2510 in forum Live Streaming and Encoder Discussion
    Replies: 2
    Last Post: 07-16-2013, 06:12 AM
  3. Mp4 stream recorded with live-record has wrong duration
    By tigicongress in forum General Forum
    Replies: 8
    Last Post: 10-30-2012, 05:21 AM
  4. Simple way to limit live stream duration
    By iCatcherCCTV in forum Live Streaming and Encoder Discussion
    Replies: 3
    Last Post: 11-10-2011, 06:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •