More about FLV Encoder SDK
FLV Encoder SDK Help

How to use

Prepare a FTFLVSTREAMINFO structure (see Structures):

void CALLBACK WriteCallback(LPVOID lpParam, LPCVOID lpData, DWORD nLen)
	WriteFile((HANDLE)lpParam, lpData, nLen, NULL);


FTVIDEOINFO video_info;

video_info.dwWidth = 0x100;
video_info.dwHeight = 0x100;

FTAUDIOINFO audio_info;

audio_info.dwRate = FT_SOUNDRATE_44KHZ;
audio_info.dwSize = FT_SOUNDSIZE_16BIT;
audio_info.dwType = FT_SOUNDTYPE_STEREO;


// if you don't want to place any video into a flv, you can pass NULL
info.lpVideoInfo = &video_info;
// if you don't want to place any audio into a flv, you can pass NULL
info.lpAudioInfo = &audio_info;

info.lpWriteDataCallback = &WriteCallback;

HANDLE hFLVFile = CreateFile( ... );

info.lpParam = hFLVFile;

HFTFLVSTREAM hFlvStream = ftFlvStreamCreate(&info);

Prepare Screen Video Encoder:

HFTSCREENVIDEOENCODER hScreenVideoEncoder = ftScreenVideoEncoderCreate(0x100, 0x100, 16);

Write raw audio data:

ftFlvStreamPutAudioData(hFlvStream, lpAudioData, nLen, nTimeStamp);

Compress (encode) and write video data:

// OnVideoData(const char* data, unsigned int size, unsigned int timestamp)

LPCVOID lpData = 0;
DWORD cbBytes = 0;

ftScreenVideoEncodeFrame(hScreenVideoEncoder, data, size);
ftScreenVideoGetEncodedFrame(hScreenVideoEncoder, &lpData, &cbBytes);
ftFlvStreamPutVideoData(hFlvStream, lpData, cbBytes, timestamp);

Destroy the video encoder and flv stream:


More about FLV Encoder SDK
Copyright © 2004 - 2007 Softanics. All rights reserved.
Macromedia and Shockwave Flash are trademarks of Adobe, Inc.