Wowza Community

How to read metadata of a recorded stream from server side

Dear All,

We have a daily live stream which is recorded with the “Record all incoming streams” setting of our application.

We would like to give the opportunity to my publisher to give some additionnal information about the stream so we implement an HTTPprovider2Base with the following code :

public void onHTTPRequest(IVHost invhost, IHTTPRequest req, IHTTPResponse resp) {
		
		String titleToSet ;
		
		Map<String, List<String>> params = req.getParameterMap();
		
		if( params.containsKey("setTitle") ) {
			
			String title =  params.get("setTitle").get(0);
			
			IMediaStream stream = VHostSingleton.getInstance("_defaultVHost_").getApplication("live").getAppInstance("_definst_").getStreams().getStream("afopi");
			
			if (stream != null)
			{
				AMFDataMixedArray data = new AMFDataMixedArray();
				data.put("title", new AMFDataItem(title));
				stream.sendDirect("onTextData", data);
				
				WMSLoggerFactory.getLogger(null).info("SetTitle : " + title);		
			}	
		}

So normally the metadata title is added to the stream and then to the recorded stream.

I now need to read this metadata from a server side module? is there some kind of MP4 utils to read these information?

Best regards

Richard

Hi Richard, take a look at this forum thread. It may be helpful for what you need:

server side code get metadata of a live stream

Salvadore

Richard,

Note that your code is inserting a cuepoint (timed text) not metadata. Take a look at this article which shows how to do both.

Also, in my recent test the metadata injected with this method into a live stream is not recorded in the file. I am looking into that. The method you are using the inject a cuepoint should work in the live stream and recording.

Richard

Richard,

Metadata is associated with the file, but not a timecode. The cuepoints are associated with a timecode. The data from a cuepoint is streamed to the client in a recording at that time code, or in a live stream as you are doing it immediately

Richard

Do you mean without playing it? I think there are 3rd party programs that read and set cuepoints, like captionate.

To listen for a cuepoint during playback in RTMP client you have to do something like this:

nsPlay.client = nsPlayClientObj;
			
nsPlayClientObj.onTextData = function(obj:Object):void
{
	captionOutput.text = obj.text;
}

This is what you would need client-side for the example shown in the cuepoint/metadata article for the cuepoint named “onTextData”, which includes Object (AMFDataMixedArray on the Wowza side) with a .text field.

Richard

We’re taking a look at this, will update you when I learn more.

Richard

Ok i have read the thread and there is two things i don’t understand.

I understand that metadata trigger the “onMetaData” function when the stream is played.

  1. Does it mean that metadata are allways link to a TimeCode? In fact i just need to be able to add a general title to a stream like the title of mp3 in ID3 tag.

Does my previous code define a general metadata or is the title link to a TC? Is there a way to define this kind of general title?

  1. The problem is that my server-side module doesn’t play the VOD file it just check loop through the files in content directory and delete files on different criterion (oldest files and anormaly short file). So i need to read metadata without playing the file. Is there a way to do that?

Best regards

Richard

Ok thank you for your explanation.

So if i need to embed some information in my live stream and make them survive the recording process, i need to use cuepoints.

Is there a way to retrieve cuepoint from a video file without reading it?

Thanks

Richard

Thank you for all your explanations. I will have to find another way to store metadata.

Do you think having metadata (not the kind which is associated with TC) store into the recorder file will be on Wowza Road Map?