Crate flv_codec

Source
Expand description

Decoders and encoders for FLV file format.

§Examples

use bytecodec::io::IoDecodeExt;
use flv_codec::{FileDecoder, Header, Tag};

// Reads FLV file content
let mut flv = &include_bytes!("../black_silent.flv")[..];
let mut decoder = FileDecoder::new();

// Decodes the first FLV tag
let tag = decoder.decode_exact(&mut flv).unwrap();
let header = decoder.header().cloned().unwrap();
assert_eq!(header, Header { has_audio: true, has_video: true });
assert_eq!(tag.timestamp().value(), 0);
assert_eq!(tag.stream_id().value(), 0);
match tag {
    Tag::Audio(_) => println!("audio tag"),
    Tag::Video(_) => println!("video tag"),
    Tag::ScriptData(_) => println!("script data tag"),
}

// Decodes the second FLV tag
let tag = decoder.decode_exact(&mut flv).unwrap();

See examples/ directory for more examples.

§Reference

Structs§

AudioTag
Audio tag.
FileDecoder
FLV file decoder.
FileEncoder
FLV file encoder.
Header
FLV header.
ScriptDataTag
Script data tag.
StreamId
Stream identifier.
TagDecoder
FLV tag decoder.
TagEncoder
FLV tag encoder.
TimeOffset
24-bits signed timestamp offset in milliseconds.
Timestamp
32-bits signed timestamp in milliseconds.
VideoTag
Video tag.

Enums§

AacPacketType
AAC packet type.
AvcPacketType
AVC packet type.
CodecId
Video codec identifier.
FrameType
Video frame type.
SoundFormat
Audio format(codec) identifier.
SoundRate
Audio sampling rate.
SoundSize
Size of each audio sample.
SoundType
Mono or stereo sound.
Tag
FLV tag.
TagKind
Tag kind.