Wowza Community

Get video resolution (height & width) in the onPublish event

Hi

I’d like to send the video resolution to my webserver in the onpublish event. I already overwritten the method to send some other stuff (like clientId) everything works fine. But I really don’t find a solution with the resolution.

Anyone with the same issue or an idea?

Thank you very much

Take a look at IMediaStreamActionNotify3.onMetaData() and IMediaStreamActionNotify3.onCodecInfoVideo()

https://www.wowza.com/docs/how-to-use-imediastreamactionnotify3-interface-to-listen-for-rtmp-stream-events-includes-codec-info

Richard

You should be able to get frame size from IMediaStreamActionNotify3.onMetaData()

You can get a rolling average bit rate of a 5 second window of a live stream with IOPerformanceCounter.getMessagesOutBytesRate()

To do that you have to attach the counter and monitor using a timer. Take a look at this example:

https://www.wowza.com/docs/how-to-monitor-bandwidth-of-published-streams-modulelimitpublishedstreambandwidth

Richard

I don’t think there is equivalent for rtsp. There is the IMediaCasterNotify inteface, but it does not include similar codec methods.

https://www.wowza.com/docs/imediacasternotify2-example

Richard

Apparently it is not in the stream.

Richard

Richard, is it possible to also get the bit rates and frame sizes? Just being able to get the codec data that I can get through that example is a huge help, but being able to get the additional information would be a big help in the future.

I see lines in the debug log like:

INFO server comment - LiveStreamPacketizerCupertino.handlePacket[live/definst/test][avc1.66.30]: H.264 Video info: {H264CodecConfigInfo: codec:H264, profile:Bsaeline, level:3.0, frameSize:656x448, displaYSize:656x448, frameRate:30.0, PAR:1:1}

and

INFO server comment - LiveStreamPacketizerCupertino.handlePacket[live/definst/test][mp4a.40.2]: AAC Audio info: {AACFrame: codec:AAC, channels:2, frequency:48000, samplesPerFrame:1024, objectType:LC}

I know that if I really want the info I can always write a custom log appender for log4j and grab the info out of the logs but that’s a really tacky way to go about it. Is there any way that I could pull that out using the API?

How would I do the same thing for RTSP streams?

You should be able to get frame size from IMediaStreamActionNotify3.onMetaData()

You can get a rolling average bit rate of a 5 second window of a live stream with IOPerformanceCounter.getMessagesOutBytesRate()

To do that you have to attach the counter and monitor using a timer. Take a look at this example:

https://www.wowza.com/docs/how-to-monitor-bandwidth-of-published-streams-modulelimitpublishedstreambandwidth

Richard

I might be missing something, but I’m not seeing the frame size info there. The javadocs don’t seem to be helping either.

When I call the toString method of the AMFData argument I get back:

{AMFPacket: size: 514, type: 18, src: 0, seq: 0, absTimecode: 0, timecode: 0}

What am I missing?

catdude,

Some other info here, such getMessagesOutBytes() or iLogNotify. cs-bytes.

That looks like it could be exactly what I’m looking for! Thanks.

I assume that this does not require a patch with Wowza 3, is that correct?

The example shown is missing a couple lines; I believe you need to add “import com.wowza.wms.stream.IMediaStream;” since the third argument to onLog is of that type. I think it also needs “import org.apache.log4j.Level;” since the second argument’s type is defined there. But I’m now getting the info I need and sticking it into my database, so thanks again for the pointer. I’ve gone through the server-side API docs a bunch of times, but somehow managed to miss the info for the logging classes.

catdude,

Some other info here, such getMessagesOutBytes() or iLogNotify. cs-bytes.

Hi Daniel,

I am having the same issue. I am only getting this {AMFPacket: size: 514, type: 18, src: 0, seq: 0, absTimecode: 0, timecode: 0}. Can you please show your sample code?

Thanks in advance.