RTSP protocol options

Hi,

I’m developing an ip camera application.

All rtsp streams are started and stopped with the mediacaster.startStream and mediacaster.stopStream functions.

Files are being saved on disk with the startRecordingSegmentBySchedule example i’ve found in the tutorial.

However im stuck with 3 questions:

  1. Is it possible to stop and start the audio and/or video of the incoming rtsp stream (to save bandwith when they are not needed)

I’ve tried with stream.setReceiveAudio(false) and stream.setReceiveVideo(false) but nothing happens.

  1. Is it possible to send an audio stream back over the same rtsp stream.

I know most ip cameras support some type of audio return channel, however I’m not sure if this is part of the rtsp standard.

  1. Is there an easy way (or example/tutorial) of joining all the split files, that have been created by the startRecordingSegmentBySchedule function?

Or do i manually have to create a playlist of some sort?

My goal is to make a seekable stream, that will be served to a flash client, based on all the individual files on the server.

Any help with these questions will be highly appreciated.

Kind regards,

Jim

I’ve looked at the specification document of our cameras:

http://www.onvif.org/specs/stream/ONVIF-Streaming-Spec-v221.pdf

section: 5.3 Back Channel Connection

Is it possible i can use wowza with this rtsp extension?

You should be able to re-stream the RTSP output. Take a look at this guide:

https://www.wowza.com/docs/how-to-re-stream-video-from-an-ip-camera-rtsp-rtp-re-streaming

Richard

Jim,

  1. For vod playback you can join using this method, but it only works for Flash RTMP clients:

https://www.wowza.com/docs/how-to-insert-a-pre-roll-or-mid-roll-for-video-on-demand-playback-in-flash-rtmp-client

For live, you can join with Stream class streams, and this works across client types, and as input to the Wowza Transcoder and PushPublish. The scheduler is one example:

https://www.wowza.com/docs/how-to-schedule-streaming-with-wowza-streaming-engine-streampublisher

  1. This is not supported using Wowza as far as I know.

  2. I have used IMediaStream.setReceiveVideo(false) in IMediaStreamActionNotify3.onPlay() to control this in rtsp playback in VLC. I did not test on any mobile clients:

package test;
import com.wowza.util.IOPerformanceCounter;
import com.wowza.wms.amf.*;
import com.wowza.wms.application.*;
import com.wowza.wms.client.IClient;
import com.wowza.wms.module.*;
import com.wowza.wms.request.RequestFunction;
import com.wowza.wms.stream.*;
import com.wowza.wms.media.model.*;
public class ModuleSoundOnly extends ModuleBase
{
	class StreamListener implements IMediaStreamActionNotify3
	{
		public void onMetaData(IMediaStream stream, AMFPacket metaDataPacket)
		{
			System.out.println("onMetaData[" + stream.getContextStr() + "]: " + metaDataPacket.toString());
		}
		public void onPauseRaw(IMediaStream stream, boolean isPause, double location)
		{
			System.out.println("onPauseRaw[" + stream.getContextStr() + "]: isPause:" + isPause + " location:" + location);
		}
		public void onPause(IMediaStream stream, boolean isPause, double location)
		{
			System.out.println("onPause[" + stream.getContextStr() + "]: isPause:" + isPause + " location:" + location);
		}
public void onPlay(IMediaStream stream, String streamName, double playStart, double playLen, int playReset)
{
	stream.setReceiveVideo(false);
}
		public void onPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend)
		{
			System.out.println("onPublish[" + stream.getContextStr() + "]: isRecord:" + isRecord + " isAppend:" + isAppend);
		}
		public void onSeek(IMediaStream stream, double location)
		{
			System.out.println("onSeek[" + stream.getContextStr() + "]: location:" + location);
		}
		public void onStop(IMediaStream stream)
		{			
			IOPerformanceCounter perf = stream.getMediaIOPerformance();
			getLogger().info("OutBytesRate for " + stream.getName() + ": " + perf.getMessagesOutBytes());
		}
		public void onUnPublish(IMediaStream stream, String streamName, boolean isRecord, boolean isAppend)
		{
			System.out.println("onUnPublish[" + stream.getContextStr() + "]: streamName:" + streamName + " isRecord:" + isRecord + " isAppend:" + isAppend);
		}
		public void onCodecInfoAudio(IMediaStream stream,
				MediaCodecInfoAudio codecInfoAudio) {
			System.out.println("onCodecInfoAudio[" + stream.getContextStr() + " Audio Codec" + codecInfoAudio.toCodecsStr() + "]: ");
		}
		public void onCodecInfoVideo(IMediaStream stream,
				MediaCodecInfoVideo codecInfoVideo) {
			System.out.println("onCodecInfoVideo[" + stream.getContextStr() + " Video Codec" + codecInfoVideo.toCodecsStr() + "]: ");
		}
	}
	public void play(IClient client, RequestFunction function,
	        AMFDataList params) {
		IMediaStream stream = getStream(client, function);
		
		String[] querystring = stream.getQueryStr().split("&");
		String qs1 = querystring[0];
				
		//stream.setReceiveVideo(false);
		
	}
	public void onStreamCreate(IMediaStream stream)
	{
		getLogger().info("onStreamCreate["+stream+"]: clientId:" + stream.getClientId());
		IMediaStreamActionNotify2 actionNotify = new StreamListener();
		WMSProperties props = stream.getProperties();
		synchronized (props)
		{
			props.put("streamActionNotifier", actionNotify);
		}
		stream.addClientListener(actionNotify);
	}
	public void onStreamDestroy(IMediaStream stream)
	{
		getLogger().info("onStreamDestroy["+stream+"]: clientId:" + stream.getClientId());
		IMediaStreamActionNotify2 actionNotify = null;
		WMSProperties props = stream.getProperties();
		synchronized (props)
		{
			actionNotify = (IMediaStreamActionNotify2) stream.getProperties().get("streamActionNotifier");
		}
		if (actionNotify != null)
		{
			stream.removeClientListener(actionNotify);
			getLogger().info("removeClientListener: " + stream.getSrc());
		}
	}
}

Richard

No, I don’t think that can work. Only on the play streams

Richard

Sounds like you recorded a .flv file but are playing it back with mp4: prefix. If so, remove the mp4: prefix from the stream name.

Otherwise, the recording may be corrupt. If there is .tmp file next to it with the same name, that indicates the recording did complete successfully. There is nothing you can do with such a file.

Richard

.flv files are not supported for rtsp clients, they will only work in Flash rtmp clients. You have to record to .mp4 container to playback over rtsp.

Richard

I think you can put g711 in a quicktime container, according to: http://wiki.multimedia.cx/index.php?title=QuickTime_container

But I am not sure if Wowza will do it. You can test and see what you get, and I will see what I can find out. I don’t have a camera with g711 to test myself.

If Wowza does record the g711 it should playback in VLC and Flash but not sure about other clients.

Richard

Jim,

In our test it didn’t work. You could use the Wowza Transcoder, which supports G.711 (µ-law and A-law) for decode.

https://www.wowza.com/docs/how-to-set-up-and-run-wowza-transcoder-for-live-streaming

Richard

I’ve read that thread extensively, but it doesn’t answer my questions:

  1. can i selectively disable the audio or video track? (the rtspStreamAudioTrack and rtspStreamVideoTrack Booleans, in the application.xml disable it for all streams.

  2. does wowza support bi-directional audio, over one rtsp connection?

  3. see first post.

I’m trying to do the same on the published stream, so in the onPublish() method. But this doesn’t seem to have any effect.

It would be great if i could selectively stop the audio from the incoming stream to save bandwidth between “broadcaster” and server.

Kind regards, Jim

  1. For vod playback you can join using this method, but it only works for Flash RTMP clients:

Wowza Streaming Engine Java API documentation

For live, you can join with Stream class streams, and this works across client types, and as input to the Wowza Transcoder and PushPublish. The scheduler is one example:

Schedule streaming

Can you help me a bit more with this?

I’ve tried playing the recorded .flv files that were created with the LiveStreamRecorderFLV class. (just by putting them in /content folder, and calling the /vod url)

However i get the famous “File is missing ‘moov’ atom” error. (i am not trying to play a file that is not closed properly)

Kind regards, Jim

Sounds like you recorded a .flv file but are playing it back with mp4: prefix. If so, remove the mp4: prefix from the stream name.

Otherwise, the recording may be corrupt. If there is .tmp file next to it with the same name, that indicates the recording did complete successfully. There is nothing you can do with such a file.

Richard

Yes im recording .flv, but im playing it back with the folowing url: rtsp://192.168.1.153:1935/vod/1.flv

The files are split every x minutes (startRecordingSegmentBySchedule), so the moment a new file is created, i should be able to use the old one right?

ok, but the flv container is the only one that can hold my G711 audio codec.

The only workaround would be transcoding audio to aac or mp3, and saving in mp4 container?