Skip to main content
December 4, 2014
Question

how to play h.264 stream immediately

  • December 4, 2014
  • 1 reply
  • 693 views

There's a server, which sends an AVCDecoderConfigurationRecord tag and continuous H264 video tags. In the client, I use NetStream and appendBytes (Data Generation Mode) to display the video. The code likes that

video = new Video

addChild(vdieo)

socket = new Socket

socket.connect(server)

socket.addEventListener(SOCEKT_DATA, onRecv)

nc = new NetConnection

nc.connect(null)

ns = new NetStream(nc)

ns.client = this

ns.play(null)

videon.attachNetStream(ns)


function onRecv(e) : void {

     data = new ByteArray

     socket.readBytes(data)

     if (data-is-AVCDecoderConfigurationRecord-tag) {

          ns.appendBytesAction(RESET_BEGIN)

     }

     ns.appendBytes(data)

}


The client works, howerver, the NetStream does not start palying the video until it caches about 20 tags into the buffer (about 2 seconds, because the fps is 10). It does not satisfy my requirement that I need to play the stream immediately while the client receives a tag.  I set the bufferTime = 0 or other small number, there's no effect, waiting about 20 tags as usual. While I set the bufferTime bigger such as 5, it works that NetStream waiting more tags.

In Adobe document, I find this information and I try to use the END_SEQUENCE several ways, but all of them do not work.

Is there a way to play the H264 tag immediately without buffer?

This topic has been closed for replies.

1 reply

Known Participant
December 5, 2014

Check Application.xml and look for MinQueuedVid.

Play with different settings and see if you can find a decent setup.

You may want to disable AggregateMessaging and Queueing for that particular app (if you want lower latency).

You may also want to make sure the Application is set to use the same process to make sure all users connected to the instance can communicate.

  <Client>

  <MsgQueue>

  <Server>

  <!-- The minimum number of video messages to queue at the start -->

  <!-- of a stream.  When an H264 stream or other pipelined codec -->

  <!-- stream begins it needs some number of messages, at most 64 -->

  <!-- to begin playback and this setting ensures that regardless -->

  <!-- of the buffer set there are enough messages at the start   -->

  <!-- to begin playback quickly.  Making this less than 64, down -->

  <!-- to 0 won't queue up extra messages but may cause H264      -->

  <!-- content with a low FramesPerSecond to delay before start   -->

  <MinQueuedVideo>64</MinQueuedVideo>

</Server>

</MsgQueue>

</Client>

December 8, 2014

The stream is not from a FMS, it is sent to the .swf application by a C++ application with socket. Can I set an application.xml?