Documentation
¶
Index ¶
- Constants
- Variables
- func AudioMetaData(data []byte) (format int, sampleRate int, size int, stereo bool)
- func VideoMetaData(data []byte) (frameType int, codec int)
- type File
- func (flvFile *File) Close()
- func (flvFile *File) FilePath() string
- func (flvFile *File) IsFinished() bool
- func (flvFile *File) LoopBack()
- func (flvFile *File) ReadTag() (header *TagHeader, data []byte, err error)
- func (flvFile *File) SetDuration(duration float64)
- func (flvFile *File) Size() (size int64)
- func (flvFile *File) Sync() (err error)
- func (flvFile *File) WriteAudioTag(data []byte, timestamp uint32) (err error)
- func (flvFile *File) WriteTag(data []byte, tagType byte, timestamp uint32) (err error)
- func (flvFile *File) WriteVideoTag(data []byte, timestamp uint32) (err error)
- type TagHeader
Constants ¶
const ( AUDIO_TAG = byte(0x08) VIDEO_TAG = byte(0x09) SCRIPT_DATA_TAG = byte(0x12) DURATION_OFFSET = 53 HEADER_LEN = 13 )
Variables ¶
var (
HEADER_BYTES = []byte{
'F', 'L', 'V',
0x01,
0x05,
0x00, 0x00, 0x00, 0x09,
0x00, 0x00, 0x00, 0x00,
0x12, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x0a, 0x6f, 0x6e, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61,
0x08, 0x00, 0x00, 0x00, 0x01,
0x00, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x09,
0x00, 0x00, 0x00, 0x33}
)
Functions ¶
func AudioMetaData ¶
extracts meta data for an audio tag
Format: 0 = Linear PCM, platform endian 1 = ADPCM 2 = MP3 3 = Linear PCM, little endian 4 = Nellymoser 16 kHz mono 5 = Nellymoser 8 kHz mono 6 = Nellymoser 7 = G.711 A-law logarithmic PCM 8 = G.711 mu-law logarithmic PCM 9 = reserved 10 = AAC 11 = Speex 14 = MP3 8 kHz 15 = Device-specific sound
Rate: 0 = 5.5 kHz 1 = 11 kHz 2 = 22 kHz 3 = 44 kHz
Sample size: 0 = 8-bit samples 1 = 16-bit samples
func VideoMetaData ¶
extracts meta data for an video tag
Frame type: 1 = key frame (for AVC, a seekable frame) 2 = inter frame (for AVC, a non-seekable frame) 3 = disposable inter frame (H.263 only) 4 = generated key frame (reserved for server use only) 5 = video info/command frame
Codec: 2 = Sorenson H.263 3 = Screen video 4 = On2 VP6 5 = On2 VP6 with alpha channel 6 = Screen video version 2 7 = AVC
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
func CreateFile ¶
func (*File) IsFinished ¶
func (*File) SetDuration ¶
func (*File) WriteAudioTag ¶
Data with audio header