Wowza Community

Setting Up Transcoding of a Live Stream

This is a real long shot, but I figure it can’t hurt to throw this out here:

I have an IP camera that has an RTSP stream with h.264 video and G.711 audio. I setup a Wowza application (myapp) to use the rtp-live StreamType and then got Flowplayer with the RTMP plugin correctly playing the video. However, I believe the audio isn’t being transcoded (it sounds horrible and I don’t have transcoding on).

My Streams/StreamType in conf/myapp/Application.xml is rtp-live. I have the RTSP stream specified in content/camera.stream. That’s really it, and it works, putting out a standard RTMP stream at rtmp://myserver/myapp with stream camera.stream.

So, I’ve been trying to enable transcoding of the audio while passing through the video, but everything I find (the Transcoding Guide1 and others) just confuses me more and all my attempts don’t work, often with errors about missing SMIL files (I tried to follow a guide2 but I might have missed something). I found one guide that specifically outlines audio-only transcoding3, but of course I had no luck.

Is this the correct way to approach things? I thought it was and then tried to follow the Flowplayer example for dynamic streaming with Wowza4 using the F4M and HTTP Streaming plugins, but no joy.

I think a lot of my problem is it’s unclear to me what URL format I should use to reference my streams

http://myserver:1935/myapp/smil:camera.stream.smil/manifest.f4m

or maybe

http://myserver:1935/myapp/_definst_/ngrp:camera.stream_all/manifest.f4m

?

Any suggestions of where to start? What should my Application.xml and my transcoding template look like? Thanks.

Take a look at the audio.xml Transcoder template in this example as a starting place:

https://www.wowza.com/docs/how-to-convert-flash-player-11-output-from-h-264-speex-audio-to-h-264-aac-audio-using-wowza-transcoder

Richard

You have to use files with a .stream extension. Change camera.stream_aac to something like camera_aac.stream

And use StreamType “live”, then use StreamManager to start the stream for sanjosestreaming playback.

There is a guide for this here:

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

Richard

Do a fresh test. First re-starting Wowza, then run through starting the camera.stream in StreamManager, then trying to playback one of the encoded streams.

Then zip up conf, logs and the transcoder template and send to support@wowza.com.

Include camera.stream file

Include a link to this thread.

Richard

The fix for Main Concept on Linux described in thispost is included in 3.1.1. It is important that your server is properly tuned. 1200MB is all right for development, but needs to be tuned for a production environment. Take a look at the Tuning Guide.

Do you see any messages like this? It indicates that the server is overworked and CPU is maxed out. These types of INFO messages would be in the [install-dir]/logs/wowzamediaserver_access.log, not the wowzamediaserver_error.log.

Video behind filter state change. New state: SKIP1FRAME

-Lisa

Hi Richard, like I said, I’ve done that.

I just setup a clean install on a new server so be clear what I’ve done. I’ve setup the rtp-live stream using the sample rtp-live Application.xml, and then followed the instructions in the audio-only guide. The only exemption is that I’ve left the StreamType as rtp-live. Is that a problem? As I understand it rtp-live is more appropriate for what I want to do (only transcode the RTSP stream and broadcast it as RTMP when a viewer connects to Wowza).

So, now that I have setup the transcoding template I try to open the stream in one of the example players I get the following server log output:

INFO server comment - MediaStreamMediaCasterPlay: startPlay
INFO server comment - RTPMediaCaster.create[1309289016]
INFO server comment - RTPMediaCaster.init[1309289016]
INFO server comment - RTPMediaCaster.Reconnector[1309289016:myapp/_definst_:camera.stream_aac]: start: 1
INFO server comment - RTPSessionDescriptionDataProviderBasic.getStreamInfo[myapp/_definst_]: /Library/WowzaMediaServer/content/camera.stream_aac
WARN server comment - RTPSessionDescriptionDataProviderBasic.getStreamInfo: SDP file missing: /Library/WowzaMediaServer/content/camera.stream_aac
INFO server comment - RTPMediaCaster.Reconnector[1399877303:myapp/_definst_:camera.stream_aac]: done: 1

Using the example player at examples/LiveVideoStreaming/client/live.html, I’ve set the server at rtmp://localhost/myapp. For the stream I’ve tried both mp4:camera.stream_aac and camera.stream_aac. In both cases I get the SDP file missing error in the logs. camera.stream still works as the untranscoded stream.

I’ve also tried with the LiveOSMFPlayer from examples/LiveVideoStreaming/clientOSMF/bin-release/LiveOSMFPlayer.html. I’ve tried the following URLs:

Hi Richard,

I went ahead and setup a second application (live) on my machine. I have it also use camera.stream, like my other, rtp-live app, myapp.

When I go to the Stream Manager and add camera.stream as a stream under the live application, it says it it setup correctly and I see in access.log that it connects and starts the transcoder with the correct settings. However, neither the new transcoded stream nor the streams on my other app are available, and I cannot access the Stream Manager page. There are no entries in error.log and restarting Wowza is the only solution.

This is the end of my log file before I restarted it:

2012-05-06	04:27:14	CDT	comment	server	INFO	200	-	RTPSessionDescriptionDataProviderBasicRTSPWorker.processResponse: command:PLAY response:RTSP/1.0 200 OK status:200 handled:false	-	-	-	239.388	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	comment	server	INFO	200	-	senderReport[RTP-Info]: track1	-	-	-	239.388	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	comment	server	INFO	200	-	senderReport[RTP-Info]: track2	-	-	-	239.389	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	comment	server	INFO	200	-	firstPacket: TCP:$2	-	-	-	239.404	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	comment	server	INFO	200	-	TranscoderSessionNative.loadLibrary: Load transcoder list: /usr/local/WowzaMediaServer/lib-native/linux64/transcoder.list	-	-	-	239.413	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	comment	server	INFO	200	-	LiveStreamTranscoder.init[live/_definst_/camera.stream]: Load transcoder template: file:///usr/local/WowzaMediaServer/transcoder/templates/audioonly.xml	-	-	-	239.426	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	comment	server	INFO	200	-	JNI:TranscoderSession.isCUDAAvailable[_defaultVHost_:live/_definst_/camera.stream]: NVidia CUDA hardware acceleration is NOT available on Linux	-	-	-	239.444	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	comment	server	INFO	200	-	JNI:TranscoderSession.isQuickSyncAvailable[_defaultVHost_:live/_definst_/camera.stream]: Intel Quick Sync hardware acceleration is NOT available on Linux	-	-	-	239.445	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	comment	server	INFO	200	-	firstPacket: TCP:$0	-	-	-	239.461	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	create	stream	INFO	200	-	-	-	-	-	0.001	-	-	-	-	-	-	-	-	-	-	2	0	0	0	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	publish	stream	INFO	200	camera.stream_aac	-	-	-	-	0.001	-	-	-	-	-	-	-	-	-	-	2	0	0	0	camera.stream_aac	-	-	-	-	-	/camera.stream_aac	/camera.stream_aac	-	-	-
2012-05-06	04:27:14	CDT	comment	server	INFO	200	-	JNI:TranscoderSession.audioDecoderCreate[_defaultVHost_:live/_definst_/camera.stream]: Create audio decoder: G711 MULAW: default	-	-	-	239.467	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	decoder-audio-start	transcoder	INFO	200	camera.stream	{codec:G711_MULAW, objectType:0, sampleRate:16000, channels:1}	-	-	-	239.468	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	comment	server	INFO	200	-	LiveStreamPacketizerSanJose.init[live/_definst_/camera.stream]: chunkDurationTarget: 10000	-	-	-	239.469	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	comment	server	INFO	200	-	JNI:TranscoderSession.audioEncoderAdd[_defaultVHost_:live/_definst_/camera.stream:aac]: Create audio encoder: AAC: default	-	-	-	239.469	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	comment	server	INFO	200	-	LiveStreamPacketizerSanJose.init[live/_definst_/camera.stream]: chunkDurationTolerance: 500	-	-	-	239.469	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	comment	server	INFO	200	-	LiveStreamPacketizerSanJose.init[live/_definst_/camera.stream]: playlistChunkCount:4	-	-	-	239.47	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	comment	server	INFO	200	-	JNI:AudioEncoderAAC.initialize[_defaultVHost_:live/_definst_/camera.stream:aac]: channels:1 sampleRate:8000 bitRate:48000	-	-	-	239.472	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	comment	server	INFO	200	-	MediaStreamMap.getLiveStreamPacketizer: Create live stream packetizer: sanjosestreamingpacketizer:camera.stream	-	-	-	239.472	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2012-05-06	04:27:14	CDT	comment	server	INFO	200	-	ModuleMediaCasterStreamMonitorAdvanced.getMonitor[live/_definst_] create:camera.stream	-	-	-	239.482	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-

Ok, it is crashing. A selection from the crash log:

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  java.util.zip.Inflater.inflateBytes(J[BII)I+0
j  java.util.zip.Inflater.inflate([BII)I+59
j  java.util.zip.InflaterInputStream.read([BII)I+53
j  sun.misc.Resource.getBytes()[B+115
j  java.net.URLClassLoader.defineClass(Ljava/lang/String;Lsun/misc/Resource;)Ljava/lang/Class;+219
j  java.net.URLClassLoader.access$000(Ljava/net/URLClassLoader;Ljava/lang/String;Lsun/misc/Resource;)Ljava/lang/Class;+3
j  java.net.URLClassLoader$1.run()Ljava/lang/Object;+43
v  ~StubRoutines::call_stub
j  java.security.AccessController.doPrivileged(Ljava/security/PrivilegedExceptionAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;+0
j  java.net.URLClassLoader.findClass(Ljava/lang/String;)Ljava/lang/Class;+13
j  java.lang.ClassLoader.loadClass(Ljava/lang/String;Z)Ljava/lang/Class;+43
j  java.lang.ClassLoader.loadClass(Ljava/lang/String;)Ljava/lang/Class;+3
v  ~StubRoutines::call_stub
j  com.wowza.wms.media.aac.AACUtils.decodeFrame([BJ)Lcom/wowza/wms/media/aac/AACFrame;+194
j  com.wowza.wms.transcoder.model.TranscoderWorkerAudioEncoder.sendAACCodecConfig(Lcom/wowza/wms/transcoder/model/TranscoderPacket;)Z+261
j  com.wowza.wms.transcoder.model.TranscoderWorkerAudioEncoder.run()V+306
J  java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V
j  java.util.concurrent.ThreadPoolExecutor$Worker.run()V+5
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub
---------------  P R O C E S S  ---------------
Java Threads: ( => current thread )
  0x00000000026f6000 JavaThread "LiveStreamTranscoderSorter-live/_definst_/camera.stream" daemon [_thread_blocked, id=5604, stack(0x00007f7e21c9d000,0x00007f7e21d9e000)]
  0x0000000002c15800 JavaThread "SocketAcceptorIoProcessor-2.0" [_thread_in_native, id=5603, stack(0x00007f7e1ba3b000,0x00007f7e1bb3c000)]
  0x00007f7e280cf800 JavaThread "VHostTransport._defaultVHost_.80" daemon [_thread_blocked, id=32433, stack(0x00007f7e1bb3c000,0x00007f7e1bc3d000)]
  0x00007f7e280cd800 JavaThread "VHostTransport._defaultVHost_.79" [_thread_blocked, id=32432, stack(0x00007f7e1bc3d000,0x00007f7e1bd3e000)]
  0x0000000002480000 JavaThread "VHostTransport._defaultVHost_.78" [_thread_blocked, id=32431, stack(0x00007f7e1bd3e000,0x00007f7e1be3f000)]

Could the fact that I’m using OpenJDK be a problem?

Or perhaps I’m out of memory? Wowza is given the default 1200M and this is what the heap info says in the crash log:

Heap
 PSYoungGen      total 404032K, used 164945K [0x00000000e7000000, 0x0000000100000000, 0x0000000100000000)
  eden space 398976K, 40% used [0x00000000e7000000,0x00000000f0cc7168,0x00000000ff5a0000)
  from space 5056K, 87% used [0x00000000ffb10000,0x00000000fff5d3c0,0x0000000100000000)
  to   space 5312K, 0% used [0x00000000ff5a0000,0x00000000ff5a0000,0x00000000ffad0000)
 PSOldGen        total 36096K, used 8380K [0x00000000b5000000, 0x00000000b7340000, 0x00000000e7000000)
  object space 36096K, 23% used [0x00000000b5000000,0x00000000b582f1e8,0x00000000b7340000)
 PSPermGen       total 25216K, used 25049K [0x00000000aaa00000, 0x00000000ac2a0000, 0x00000000b5000000)
  object space 25216K, 99% used [0x00000000aaa00000,0x00000000ac276788,0x00000000ac2a0000)

It looks like I’m running into the same issue as another thread: http://www.wowza.com/forums/showthread.php?16636-Transcoder-Crashes-Server Should I try downgrading to the 3.0.3-patch14 update mentioned in the thread? I’m running 3.1.1 build1479, so I assume the fix is included.

Sorry for all the posts…

Thanks Lisa, but what’s the difference between a development environment and a production one? 2 streams? 3?

I grep-ed the logs and I found two, but only two, mentions of skipping. Since it was only during one of my attempts, I don’t think it’s the (main) cause of my problems:

2012-05-07      09:02:54        CDT     comment server  INFO    200     -       TranscodingSession.updateBehindFilter[live/_definst_/camera.stream]: Video behind filter state change. New state: SKIP2FRAME  -       -       -       102836.064      -       -
       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -
2012-05-07      09:02:55        CDT     comment server  INFO    200     -       TranscodingSession.updateBehindFilter[live/_definst_/camera.stream]: Video behind filter state change. New state: SKIP4FRAME  -       -       -       102837.102      -       -

The machine is an “Intel Xeon-SandyBridge E3-1270-Quadcore [3.4GHz]”. That should be a decent CPU simply audio transcoding, no? Though of course the memory could be an issue…

Thanks, Richard, I’ll get on this today.

Peter