Question

I'm looking at the netstream documentation. but can't really glean if appendBytes() can really take arbitrary data. Could I really just take arbitrary bitmap data (as a byte array) and append the frame to stream (presumably before sending it to a FMS to save a file)? I think I am wrong: it's only useful for dynamic streaming. I know that it is possible to grab a webcam feed and directly encode video via FMS. But say I wanted to add some overlays before encoding, is that even possible in Flash? I.e. Can you dynamically generate netStream objects in Flash, or is the only thing you can do is draw bitmap data from a netStream and not vice-versa?

Basically the goal is to manipulate video and audio much like Movie Masher and save out actual video files directly. Movie Masher actually saves out single frames to the server for later conversion.

I've heard that FP11 has native H264 Encoding-- so the'spec' question: Could the final netStream be encoded in-browser then uploaded to the server over HTTP, or is FMS still a requirement? I'm looking at this realtime encoder demo, but I'm not sure if they're just using FMS as a filedump, or if it's part of the process.

There's an open source project for encoding FLV, it uses ByteArrayFlvEncoder which allows you to encode raw ByteArrays. Is there an equivalent for H264?

Était-ce utile?

La solution

According to the documentation, it does not seem possible to use the native encoder because you cannot leverage both NetStream.publish() and NetStream.appendBytes() at the same time :

A NetStream can either publish a stream or play a stream, it cannot do both. To publish a stream and view the playback from the server, create two NetStream objects.

In other words, it seems like there is no way to send custom data to FMS over a NetStream object.

So, you could :

  1. Attach the camera to a Video object
  2. Apply a series of effects to it w/ pixel manipulation
  3. Send the pixel data for later encoding to a server over a socket, or use the AS3 encoder you mentioned to save a baked FLV as a file (on the user's computer or on the server)

Autres conseils

appendBytes on the NetStream class used in conjunction with the NetStreamAppendBytesAction class.

Sample code : Ref demo : http://www.bytearray.org/?p=1689

// retrieve the FLV stream
var bytes:ByteArray = event.currentTarget.data;
// put the NetStream class into Data Generation mode
netstream.play(null);
// before appending new bytes, reset the position to the beginning
netstream.appendBytesAction(NetStreamAppendBytesAction.RESET_BEGIN);
// append the FLV video bytes
netstream.appendBytes(bytes);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top