Results 1 to 2 of 2

Thread: How to grab image from a stream using UTC

  1. #1
    Join Date
    Jul 2013

    Default How to grab image from a stream using UTC


    I have a a stream that can request a start and end using DVRPlayRequestDelegate. The start can be UTC time.

    I would like to use the stream to grab images every other frame. My issue is how do you use UTC to grab an image to match the DVR play request.

    Here is a snippet of the code which I have:

      IMediaStream stream = appInstance.getStreams().getStream(streamName);
                WMSLoggerFactory.getLogger(CLASS).info(String.format("%s.%s: %s", CLASSNAME, "start", streamName));
                Date startDate = (Date)formatter.parse(startPlay);
                Date currentDate = new Date();
                int startTime = (int)startDate.getTime();
                //Negating the time to go backwards in time for the seek to work
                long differenceInMillis = - (currentDate.getTime() - startDate.getTime());
                int startFrame = (int)differenceInMillis;
                int endPlay = startFrame + duration;
                frame = startFrame;
                List<Map<String, String>> listOfImages = new ArrayList<Map<String, String>>();
                while (frame < endPlay)
                	Map<String,String> myImageMap = new HashMap<String, String>();
                	LiveStreamTranscoder liveStreamTranscoder = (LiveStreamTranscoder)stream.getLiveStreamTranscoder("transcoder");
        			if (liveStreamTranscoder == null)
        				WMSLoggerFactory.getLogger(CLASS).warn("No liveStreamTranscoder");
        			TranscoderStream transcodingStream = liveStreamTranscoder.getTranscodingStream();
        			if (transcodingStream == null)
        				WMSLoggerFactory.getLogger(CLASS).warn("No transcodingStream");
        			TranscoderStreamSourceVideo sourceVideo = transcodingStream.getSource().getVideo();
        			if (sourceVideo == null)
        				WMSLoggerFactory.getLogger(CLASS).warn("No sourceVideo");
        			WMSLoggerFactory.getLogger(CLASS).info("Call grabFrame");
        			sourceVideo.grabFrame(new GrabResult(), videoWidth, videoHeight);
    	    		myImageMap.put("imageURL", tivvyServer+streamName+frame+".png");
    	    		myImageMap.put("pos", Integer.toString(startTime));
        			frame += snapPic;
        			startTime += snapPic;
                WMSLoggerFactory.getLogger(CLASS).info("finished with the while loop");
                String json = new Gson().toJson(listOfImages);
                report = json;
                WMSLoggerFactory.getLogger(CLASS).info("finished with json format");

  2. #2
    Join Date
    Nov 2013


    Hi there
    The code is so difficult for me .I usually do the imaging issues using an imaging program.It offers all kinds of image processing include grabing the image.
    Maybe you can have a try.But i also want to know that whether there is an image program which supports to work offline.Thanks for any suggestion

Similar Threads

  1. Replies: 5
    Last Post: 09-13-2016, 07:38 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