Wowza Community

Generating thumbnails programmatically

Hello everyone.

I am having a strange problem with the server-side code posted on this link:How to get thumbnail images from Wowza Transcoder with an HTTP Provider .

I have a Transcoder Add-on license, and a commercial license for wowza running on an EC2 on Amazon, and implemented the server-side sample on my application, the only difference is that grabFrame is being called on server-side, and not client-side. Everything seems to work fine, but after sourceVideo.grabFrame(new GrabResult(),426,240);, nothing else happens. I have placed several logs on the onGrabFrame method of my GrabResult class, but nothing ever happens. Is there some configuration that I am missing?

I am running Wowza Streaming Engine 4.1.1 Build 13180 on a Amazon Linux AMI release 2014.09.

Thank you.

salvadore? Anyone?

Hi there.

It sounds like you are trying to compile your own HTTPProvider? How are you building it? Did you download the Wowzw IDE plugin for Eclipse?

Wowza IDE Plugin

In step 5 of the directions for installing the IDE, you will need to make sure the “location” is “wowza.com/wowzaide2” and not “wowza.com/wowzaide2#sthash.fzhGSVhM.dpuf” (which is produced from copying and pasting the location from the Wowza site)

Beyond that, are you sure you are actively Transcoding a live stream at the time of generating a thumbnail?

Can you use the built in HTTPProvider to test to make sure everything is set up correctly, and isolate the issue down to the implementation of the custom HTTPPRovider?

Please let us know if this helps or if you are still unsuccessful.

Kind regards,

Salvadore

Hello there.

Thank you for updating this post, this info will surely help someone in the future. I am glad the support team was able to get to the bottom of this.

Kind regards,

Salvadore

Thanks for the response salvadore.

I’m not trying to compile an HTTPProvider, but a Module. I am building using the Plugin for Eclipse, and believe it is properly installed, as I have been using it for building Modules and HTTPProviders for a couple of months without any problems.

I know the stream is being properly transcoded, because the transcoded stream is being recorded.

I have tried using the built-in HTTPProvider, if I pass the wrong parameter to it, I see a log on the console warning me of the mistake, but when all the parameters are correct, it does not log anything.

This is what I have done on my code:

Created a new IMediaStreamActionNotify3 and registered it to the correct stream, and on the onPublish method of it, I set an interval of 5 seconds, that will call the grabFrame method after the interval is done.

The method is like this:

public void grabFrame(String streamName)
{
	while(true)
	{
		IMediaStream stream = appInstance.getStreams().getStream(streamName);
		if (stream == null)
		{
			global.log("No stream");
			break;
		}
		
		LiveStreamTranscoder liveStreamTranscoder = (LiveStreamTranscoder)stream.getLiveStreamTranscoder("transcoder");
		if (liveStreamTranscoder == null)
		{
			global.log("No liveStreamTranscoder");
			break;
		}
		
		TranscoderStream transcodingStream = liveStreamTranscoder.getTranscodingStream();
		if (transcodingStream == null)
		{
			global.log("No transcodingStream");
			break;
		}
		
		TranscoderStreamSourceVideo sourceVideo = transcodingStream.getSource().getVideo();
		if (sourceVideo == null)
		{
			global.log("No sourceVideo");
			break;
		}
		
		global.log("Call grabFrame");
		
		try
		{
			sourceVideo.grabFrame(new GrabResult(), 426, 240);
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		
		break;
	}
}

While the class is created just like the article posted:

class GrabResult implements ITranscoderFrameGrabResult
{
	public void onGrabFrame(TranscoderNativeVideoFrame videoFrame)
	{
		System.out.println("onGrabFrame");
		global.log();
		
		BufferedImage image = TranscoderStreamUtils.nativeImageToBufferedImage(videoFrame);
		if (image != null)
		{
			global.log("dimensions: " + image.getWidth() + "x" + image.getHeight());
			
			String storageDir = appInstance.getStreamStoragePath();
			
			File pngFile = new File(storageDir+"/thumbnail.png");
			File jpgFile = new File(storageDir+"/thumbnail.jpg");
			
			try
			{
				if (pngFile.exists())
					pngFile.delete();
				ImageIO.write(image, "png", pngFile);
				global.log("Save image: "+pngFile);
			}
			catch(Exception e)
			{
				global.log("File write error: "+pngFile);
			}
			
			try
			{
				if (jpgFile.exists())
					jpgFile.delete();
				ImageIO.write(image, "jpg", jpgFile);
				global.log("Save image: "+jpgFile);
			}
			catch(Exception e)
			{
				global.log("File write error: "+jpgFile);
			}
		}
	}
}

Is there any other info needed?

Thanks,

Diogo.

Just to give a heads up, support helped me figure out my problem.

It was on my transcoder template, I was using it only to fix the Audio, changing SPEEX to AAC, so video was using PassTrough. Changing it to actually transcode to H264(Even though it was already with this codec) did the trick"

Thanks everybody.

Hi,

This issue is now currently open as a ticket with Wowza Media Systems Support. Please refer to your ticket for resolution on this issue. Thank you.

Michelle