Results 1 to 5 of 5

Thread: How to determine if a recording has completed processing with the rest api

  1. #1
    Join Date
    Sep 2014
    Posts
    4

    Default How to determine if a recording has completed processing with the rest api

    Good morning,

    I am a developer and part of the website I am working on involves using wowza to record live streams. I have been communicating the basic api requests to start and stop the recordings with the REST API and this part has been going well. Part of the requirement of the website involves moving the files from their location on the disk to another location once the recording is completed. My issue is determining when the processing and writing of the file is completed by wowza. In the first iteration I have written the filesystem is checked for the existence of the file ('.mp4' instead of the '.tmp' file) and once it is found then it is read and moved to the new location. This usually did not work, and the output files at the end of the process would be corrupt and not playable. As a simple test to see what the problem was, I just had my program wait for a minute after the 'stopRecording' message was sent to the API, and then proceed. So far this has passed all tests leading me to believe this is the issue.

    So then my question becomes: is there a call on the API which can be performed which queries if the file is finished being written to disk yet? Otherwise I will have to do something more low level to determine this.

    Thank you for reading.

  2. #2

    Default

    Hello there,

    There was a similar question answered in this post:
    How to get the recording status of a stream when using liveStreamRecord

    see if that is what you are looking for.

    Kind regards,

    Salvadore

  3. #3
    Join Date
    Sep 2014
    Posts
    4

    Default

    Good Afternoon, salvadore, and thanks for the reply.

    I did actually take notice of the thread you pointed out when I first came to this forum looking for an answer. There are however, a few differences.

    The main difference is that I can get a confirmation reply that the recording has stopped by using the GET method REST API, but this does not seem to correlate directly with when the file has actually finished being processed.

    Secondly, I have been using the URL GET REST API and not the direct Java API, which works best with the current configuration of my servers and setup. I would prefer to have a method which uses only this "WEB" api to accomplish this task.

    Thank you.

  4. #4

    Default

    I am sorry, I do not have much experience working with this API at the moment.

    Have you seen this module, it may have the functionality you are looking for:
    How to move recordings from live streams (ModuleMediaWriterFileMover)

    And you may have already seen this guide, but just in case:
    How to access documentation for Wowza Streaming Engine REST APIs

    I will try to forward this question on to someone on the support team and see what they come back with.

    Kind regards,

    Salvadore

  5. #5
    Join Date
    Sep 2014
    Posts
    4

    Default

    Well, I am still curious is an official solution is available, but for now, these couple of checks seem to work well and have not failed for my application yet. The code is python but the same type of solution should work for other languages. (wait for tempfile to vanish and then wait for writes to stop on the output file) Feel free to use this code if it helps you.

            filename = os.path.join(path)+'.mp4'
            tmpname = os.path.join(path)+'.mp4.tmp'
    
            while os.path.isfile(tmpname) == True:
                print 'tmp still exists'
                time.sleep(1)
    
            waitAfter = datetime.timedelta(seconds=5)
            waitUntil = datetime.datetime.now() + waitAfter
            newtime = None
            while (waitUntil > datetime.datetime.now()):
    
                prevtime = os.stat(filename).st_mtime 
                time.sleep(1)
                newtime = os.stat(filename).st_mtime
                if newtime != prevtime:
                    print "The file is still being written to, waiting..."
                    waitUntil = datetime.datetime.now() + waitAfter
    Have a good night!

Similar Threads

  1. Rest API available?
    By simone.andrioletti in forum Wowza Streaming Engine REST API
    Replies: 1
    Last Post: 09-24-2014, 03:07 PM
  2. Rest api >> wowza 4
    By angelfilm in forum Wowza Streaming Server Java API
    Replies: 4
    Last Post: 07-24-2014, 11:26 AM
  3. Wowza Streaming Engine Manager & REst API
    By gary4gar in forum Wowza Streaming Engine REST API
    Replies: 3
    Last Post: 03-05-2014, 02:52 PM
  4. REST API for interrogating settings like transcoder formats/endpoints
    By piers7 in forum Server Administration Discussion
    Replies: 2
    Last Post: 08-16-2012, 06:58 PM

Posting Permissions

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