I have read that with an optimal configuration there can be a delay of 1-3 seconds. My app interacts with the stream so I need REAL live streaming. Is there a way to reduce this delay below 1 sec? I just need cupertino streaming.
Thanks.
I have read that with an optimal configuration there can be a delay of 1-3 seconds. My app interacts with the stream so I need REAL live streaming. Is there a way to reduce this delay below 1 sec? I just need cupertino streaming.
Thanks.
Hi there, 1-3 seconds would be about as good as it gets for iOS. As a rule 3 chunks are required by iOS devices for streaming to begin. Each chunk is set to 10 seconds by default.
If you use a keyframe interval of 1 frame per second you can lower the cupertinoChunkDurationTarget to 1 second(1000) and get the latency down to closer to 3 seconds.
Also, you might experiment with a setting of “1” for cupertinoPlaylistChunkCount but probably not a good idea for iOS.
This guide explains the configuration in more detail:
How to configure Apple HTTP Live Streaming packetization (cupertinostreaming)
Salvadore
The log output shows that your key frame interval is variable. Each chunk is about 10 seconds, but one has 3 key frames and two have 1 key frame. You have gop (-g) set to 60. Try setting it to 30 and adding -r (FPS) flag also set to 30. That should create 1 second key frame frequency, and with cupertinoChunkDurationTarget set to “1000” you should get chunks with approximately 1 second (1000 millisecond) duration, and 1 key frame (which is the last number in the a/v/k data)
Richad
So the answer is no.
Experimenting with the setting I got chunks of 1 second, but I couldn’t see the video, just audio.
Tried to stablish back to default settings with no luck, so I reinstall Wowza, but again no luck. So I think the problem is the encoder but I run the same command:
ffmpeg -re -i content/sample.mp4" -vcodec libx264 -vb 150000 -g 60 -profile baseline -level 2.1 -acodec aac -ab 64000 -ar 48000 -ac 2 -vbsf h264_mp4toannexb -strict experimental -f mpegts udp://127.0.0.1:10000?pkt_size=1316
And yes, I read https://www.wowza.com/docs/how-to-use-ffmpeg-with-wowza-media-server-mpeg-ts
I have my mpegts.stream:
udp://0.0.0.0:10000
and also tried:
udp://127.0.0.1:10000
My log looks like:
INFO server comment - Server runmode: standalone
INFO server comment - Server native.platform: linux
INFO server comment - Server threads[h/t]: 10/10
INFO server comment - CMDInterface now listening: [any]:8083
INFO vhost vhost-start _defaultVHost_ -
INFO server comment - _defaultVHost_ threads[h/t]:120/80 home:/usr/local/WowzaMediaServer
INFO vhost comment _defaultVHost_ Bind attempt ([any]:1935:4)
INFO vhost comment _defaultVHost_ Bind successful ([any]:1935)
INFO vhost comment _defaultVHost_ Bind attempt ([any]:8086:1)
INFO vhost comment _defaultVHost_ Bind successful ([any]:8086)
INFO application app-start _definst_ live/_definst_
INFO server comment - RTPMediaCaster.create[1672623886]
INFO server comment - RTPMediaCaster.init[1672623886]
INFO server comment - RTPMediaCaster.Reconnector[1672623886:live/_definst_:mpegts.stream]: start: 1
INFO server comment - VHost.startStartupStreams: Stream successfully started [live/_definst_]: flv:mpegts.stream
INFO server comment - Server.startShutdownHook: Start server shutdown hook
INFO server comment - Wowza Media Server is started!
INFO server comment - RTPSessionDescriptionDataProviderBasic.getStreamInfo[live/_definst_]: URI: udp://0.0.0.0:10000
INFO stream create - -
INFO server comment - RTPDePacketizerMPEGTS.init: Drop incomplete video frames
INFO server comment - RTPUDPTransport.bind[live/_definst_]: /0.0.0.0:10000
INFO stream publish mpegts.stream -
INFO server comment - RTPMediaCaster.Reconnector[1672623886:live/_definst_:mpegts.stream]: done: 1
INFO server comment - RTPMediaCaster.streamTimeout[1672623886:live/_definst_:mpegts.stream]: timeout:12000 diff:12011 reason:101
INFO server comment - RTPMediaCaster.resetConnection[1672623886:live/_definst_:mpegts.stream]:
INFO server comment - RTPMediaCaster.closeRTPSession[1672623886:live/_definst_:mpegts.stream]
INFO server comment - RTPUDPTransport.unbind[live/_definst_]: /0.0.0.0:10000 sent:0 recv:0
INFO stream unpublish mpegts.stream -
INFO stream destroy mpegts.stream -
INFO server comment - RTPMediaCaster.Reconnector[1672623886:live/_definst_:mpegts.stream]: start: 2
INFO server comment - RTPSessionDescriptionDataProviderBasic.getStreamInfo[live/_definst_]: URI: udp://0.0.0.0:10000
INFO stream create - -
INFO server comment - RTPDePacketizerMPEGTS.init: Drop incomplete video frames
INFO server comment - RTPUDPTransport.bind[live/_definst_]: /0.0.0.0:10000
INFO stream publish mpegts.stream -
INFO server comment - RTPMediaCaster.Reconnector[1672623886:live/_definst_:mpegts.stream]: done: 2
When run ffmpeg command:
INFO server comment - [live/_definst_/mpegts.stream]: handleTransportStreamBlock: new MPTS.
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2PATAssembler:MonitorStart
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2MPTS:StartStream: PID: 0x0
INFO server comment - [live/_definst_/mpegts.stream]: Received PAT
INFO server comment - [live/_definst_/mpegts.stream]: PAT Version 0
INFO server comment - [live/_definst_/mpegts.stream]: Program: 1 PMT PID: 0x1000
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2PMTAssembler:MonitorStart: PID: 4096 Program Number: 1
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2MPTS:StartStream: PID: 0x1000
INFO server comment - [live/_definst_/mpegts.stream]: Received new PMT
INFO server comment - [live/_definst_/mpegts.stream]: PMT: Version 0 PCR pid: 0x100
INFO server comment - [live/_definst_/mpegts.stream]: Stream: Type: 0x1B PID: 0x100 Video
INFO server comment - [live/_definst_/mpegts.stream]: Stream: Type: 0x0F PID: 0x101 Audio
INFO server comment - [live/_definst_/mpegts.stream]: RTPDePacketizerMPEGTS.pmtAvailable: IMPORT: videoPID[prg:0xffffffff,pid:0x100,filter:none]: streamType:H264:27
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2MPTS:StartStream: PID: 0x100
INFO server comment - [live/_definst_/mpegts.stream]: RTPDePacketizerMPEGTS.pmtAvailable: IMPORT: audioPID[prg:0x1,pid:0x101,filter:none]: streamType:AAC:15 audioLanguage:eng
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2MPTS:StartStream: PID: 0x101
INFO server comment - UDPTransport.firstPacket: bind:/0.0.0.0:10000 msg:/127.0.0.1:54651
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/mpegts.stream]: chunkDurationTarget: 10000
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/mpegts.stream]: chunkDurationTolerance: 500
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/mpegts.stream]: audioGroupCount: 3
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/mpegts.stream]: playlistChunkCount:3
INFO server comment - MediaStreamMap.getLiveStreamPacketizer[live/_definst_/mpegts.stream]: Create live stream packetizer: cupertinostreamingpacketizer:mpegts.stream
INFO server comment - CupertinoPacketHandler.startStream[live/_definst_/mpegts.stream]
INFO server comment - LiveStreamPacketizerCupertino.handlePacket[live/_definst_/mpegts.stream]: Video codec:H264 isCompatible:true
INFO server comment - LiveStreamPacketizerCupertino.handlePacket[live/_definst_/mpegts.stream]: Audio codec:AAC isCompatible:true
INFO server comment - LiveStreamPacketizerCupertino.handlePacket[live/_definst_/mpegts.stream][avc1.66.30]: H.264 Video info: {H264CodecConfigInfo: codec:H264, profile:Baseline, level:3.0, frameSize:424x240, displaySize:424x240, frameRate:24.0, crop: l:0 r:4 t:0 b:0}
INFO server comment - LiveStreamPacketizerCupertino.handlePacket[live/_definst_/mpegts.stream][mp4a.40.2]: AAC Audio info: {AACFrame: codec:AAC, channels:2, frequency:48000, samplesPerFrame:1024, objectType:LC}
INFO server comment - LiveStreamPacketizerCupertino.endChunkTS[live/_definst_/mpegts.stream]: Add chunk: id:1 mode:TS[H264,AAC] a/v/k:162/248/1 duration:10417
INFO server comment - LiveStreamPacketizerCupertino.endChunkTS[live/_definst_/mpegts.stream]: Add chunk: id:2 mode:TS[H264,AAC] a/v/k:198/285/3 duration:12625
INFO server comment - LiveStreamPacketizerCupertino.endChunkTS[live/_definst_/mpegts.stream]: Add chunk: id:3 mode:TS[H264,AAC] a/v/k:162/250/1 duration:10416
...
It looks good to me, as codecs are corrects and no timeouts are triggered
What am I doing wrong?
Hello,
I had already tried that, but I did it again. The output is:
INFO server comment - [live/_definst_/mpegts.stream]: handleTransportStreamBlock: new MPTS.
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2PATAssembler:MonitorStart
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2MPTS:StartStream: PID: 0x0
INFO server comment - [live/_definst_/mpegts.stream]: Received PAT
INFO server comment - [live/_definst_/mpegts.stream]: PAT Version 0
INFO server comment - [live/_definst_/mpegts.stream]: Program: 1 PMT PID: 0x1000
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2PMTAssembler:MonitorStart: PID: 4096 Program Number: 1
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2MPTS:StartStream: PID: 0x1000
INFO server comment - [live/_definst_/mpegts.stream]: Received new PMT
INFO server comment - [live/_definst_/mpegts.stream]: PMT: Version 0 PCR pid: 0x100
INFO server comment - [live/_definst_/mpegts.stream]: Stream: Type: 0x1B PID: 0x100 Video
INFO server comment - [live/_definst_/mpegts.stream]: Stream: Type: 0x0F PID: 0x101 Audio
INFO server comment - [live/_definst_/mpegts.stream]: RTPDePacketizerMPEGTS.pmtAvailable: IMPORT: videoPID[prg:0xffffffff,pid:0x100,filter:none]: streamType:H264:27
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2MPTS:StartStream: PID: 0x100
INFO server comment - [live/_definst_/mpegts.stream]: RTPDePacketizerMPEGTS.pmtAvailable: IMPORT: audioPID[prg:0x1,pid:0x101,filter:none]: streamType:AAC:15 audioLanguage:eng
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2MPTS:StartStream: PID: 0x101
INFO server comment - UDPTransport.firstPacket: bind:/127.0.0.1:10000 msg:/127.0.0.1:56529
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/mpegts.stream]: chunkDurationTarget: 1000
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/mpegts.stream]: chunkDurationTolerance: 500
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/mpegts.stream]: audioGroupCount: 3
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/mpegts.stream]: playlistChunkCount:2
INFO server comment - MediaStreamMap.getLiveStreamPacketizer[live/_definst_/mpegts.stream]: Create live stream packetizer: cupertinostreamingpacketizer:mpegts.stream
INFO server comment - CupertinoPacketHandler.startStream[live/_definst_/mpegts.stream]
INFO server comment - LiveStreamPacketizerCupertino.handlePacket[live/_definst_/mpegts.stream]: Video codec:H264 isCompatible:true
INFO server comment - LiveStreamPacketizerCupertino.handlePacket[live/_definst_/mpegts.stream]: Audio codec:AAC isCompatible:true
INFO server comment - LiveStreamPacketizerCupertino.handlePacket[live/_definst_/mpegts.stream][avc1.66.30]: H.264 Video info: {H264CodecConfigInfo: codec:H264, profile:Baseline, level:3.0, frameSize:424x240, displaySize:424x240, frameRate:30.0, crop: l:0 r:4 t:0 b:0}
INFO server comment - LiveStreamPacketizerCupertino.handlePacket[live/_definst_/mpegts.stream][mp4a.40.2]: AAC Audio info: {AACFrame: codec:AAC, channels:2, frequency:48000, samplesPerFrame:1024, objectType:LC}
INFO server comment - LiveStreamPacketizerCupertino.endChunkTS[live/_definst_/mpegts.stream]: Add chunk: id:1 mode:TS[H264,AAC] a/v/k:130/215/1 duration:8333
INFO server comment - LiveStreamPacketizerCupertino.endChunkTS[live/_definst_/mpegts.stream]: Add chunk: id:2 mode:TS[H264,AAC] a/v/k:54/90/1 duration:3500
INFO server comment - LiveStreamPacketizerCupertino.endChunkTS[live/_definst_/mpegts.stream]: Add chunk: id:3 mode:TS[H264,AAC] a/v/k:61/103/1 duration:3867
INFO server comment - LiveStreamPacketizerCupertino.endChunkTS[live/_definst_/mpegts.stream]: Add chunk: id:4 mode:TS[H264,AAC] a/v/k:113/164/1 duration:7267
INFO server comment - LiveStreamPacketizerCupertino.endChunkTS[live/_definst_/mpegts.stream]: Add chunk: id:5 mode:TS[H264,AAC] a/v/k:131/230/1 duration:8366
INFO server comment - LiveStreamPacketizerCupertino.endChunkTS[live/_definst_/mpegts.stream]: Add chunk: id:6 mode:TS[H264,AAC] a/v/k:130/201/1 duration:8334
Including
-x264opts level=3.0:keyint=1
the output is:
INFO server comment - [live/_definst_/mpegts.stream]: handleTransportStreamBlock: new MPTS.
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2PATAssembler:MonitorStart
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2MPTS:StartStream: PID: 0x0
INFO server comment - [live/_definst_/mpegts.stream]: Received PAT
INFO server comment - [live/_definst_/mpegts.stream]: PAT Version 0
INFO server comment - [live/_definst_/mpegts.stream]: Program: 1 PMT PID: 0x1000
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2PMTAssembler:MonitorStart: PID: 4096 Program Number: 1
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2MPTS:StartStream: PID: 0x1000
INFO server comment - [live/_definst_/mpegts.stream]: Received new PMT
INFO server comment - [live/_definst_/mpegts.stream]: PMT: Version 0 PCR pid: 0x100
INFO server comment - [live/_definst_/mpegts.stream]: Stream: Type: 0x1B PID: 0x100 Video
INFO server comment - [live/_definst_/mpegts.stream]: Stream: Type: 0x0F PID: 0x101 Audio
INFO server comment - [live/_definst_/mpegts.stream]: RTPDePacketizerMPEGTS.pmtAvailable: IMPORT: videoPID[prg:0xffffffff,pid:0x100,filter:none]: streamType:H264:27
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2MPTS:StartStream: PID: 0x100
INFO server comment - [live/_definst_/mpegts.stream]: RTPDePacketizerMPEGTS.pmtAvailable: IMPORT: audioPID[prg:0x1,pid:0x101,filter:none]: streamType:AAC:15 audioLanguage:eng
INFO server comment - [live/_definst_/mpegts.stream]: MPEG2MPTS:StartStream: PID: 0x101
INFO server comment - UDPTransport.firstPacket: bind:/127.0.0.1:10000 msg:/127.0.0.1:46400
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/mpegts.stream]: chunkDurationTarget: 1000
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/mpegts.stream]: chunkDurationTolerance: 500
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/mpegts.stream]: audioGroupCount: 3
INFO server comment - LiveStreamPacketizerCupertino.init[live/_definst_/mpegts.stream]: playlistChunkCount:2
INFO server comment - MediaStreamMap.getLiveStreamPacketizer[live/_definst_/mpegts.stream]: Create live stream packetizer: cupertinostreamingpacketizer:mpegts.stream
INFO server comment - CupertinoPacketHandler.startStream[live/_definst_/mpegts.stream]
INFO server comment - LiveStreamPacketizerCupertino.handlePacket[live/_definst_/mpegts.stream]: Video codec:H264 isCompatible:true
INFO server comment - LiveStreamPacketizerCupertino.handlePacket[live/_definst_/mpegts.stream]: Audio codec:AAC isCompatible:true
INFO server comment - LiveStreamPacketizerCupertino.handlePacket[live/_definst_/mpegts.stream][avc1.66.30]: H.264 Video info: {H264CodecConfigInfo: codec:H264, profile:Baseline, level:3.0, frameSize:424x240, displaySize:424x240, frameRate:30.0, crop: l:0 r:4 t:0 b:0}
INFO server comment - LiveStreamPacketizerCupertino.handlePacket[live/_definst_/mpegts.stream][mp4a.40.2]: AAC Audio info: {AACFrame: codec:AAC, channels:2, frequency:48000, samplesPerFrame:1024, objectType:LC}
INFO server comment - LiveStreamPacketizerCupertino.endChunkTS[live/_definst_/mpegts.stream]: Add chunk: id:1 mode:TS[H264,AAC] a/v/k:7/18/18 duration:600
INFO server comment - LiveStreamPacketizerCupertino.endChunkTS[live/_definst_/mpegts.stream]: Add chunk: id:2 mode:TS[H264,AAC] a/v/k:17/30/30 duration:1000
INFO server comment - LiveStreamPacketizerCupertino.endChunkTS[live/_definst_/mpegts.stream]: Add chunk: id:3 mode:TS[H264,AAC] a/v/k:16/30/30 duration:1000
INFO server comment - LiveStreamPacketizerCupertino.endChunkTS[live/_definst_/mpegts.stream]: Add chunk: id:4 mode:TS[H264,AAC] a/v/k:15/30/30 duration:1000
INFO server comment - LiveStreamPacketizerCupertino.endChunkTS[live/_definst_/mpegts.stream]: Add chunk: id:5 mode:TS[H264,AAC] a/v/k:14/30/30 duration:1000
INFO server comment - LiveStreamPacketizerCupertino.endChunkTS[live/_definst_/mpegts.stream]: Add chunk: id:6 mode:TS[H264,AAC] a/v/k:18/30/30 duration:1000
INFO server comment - LiveStreamPacketizerCupertino.endChunkTS[live/_definst_/mpegts.stream]: Add chunk: id:7 mode:TS[H264,AAC] a/v/k:15/30/30 duration:1000
But it freezes almost every chunk, for example,I can see 1 sec and freezes 1 sec more. My properties in Application.xml are:
<Properties>
<Property>
<Name>maxChunkLogCount</Name>
<Value>0</Value>
<Type>Integer</Type>
</Property>
<Property>
<Name>cupertinoChunkDurationTarget</Name>
<Value>1000</Value>
<Type>Integer</Type>
</Property>
<Property>
<Name>cupertinoMaxChunkCount</Name>
<Value>3</Value>
<Type>Integer</Type>
</Property>
<Property>
<Name>cupertinoPlaylistChunkCount</Name>
<Value>2</Value>
<Type>Integer</Type>
</Property>
<Property>
<Name>cupertinoRepeaterChunkCount</Name>
<Value>2</Value>
<Type>Integer</Type>
</Property>
</Properties>
May I modify theese?
Thanks