https://github.com/sile/flv_codec
FLV encoder/decoder based on bytecodec crate
https://github.com/sile/flv_codec
flv rust
Last synced: about 1 year ago
JSON representation
FLV encoder/decoder based on bytecodec crate
- Host: GitHub
- URL: https://github.com/sile/flv_codec
- Owner: sile
- License: mit
- Created: 2018-04-25T05:14:03.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-15T00:59:55.000Z (almost 8 years ago)
- Last Synced: 2025-03-25T07:12:55.518Z (about 1 year ago)
- Topics: flv, rust
- Language: Rust
- Size: 48.8 KB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
flv_codec
=========
[](https://crates.io/crates/flv_codec)
[](https://docs.rs/flv_codec)
[](https://travis-ci.org/sile/flv_codec)
[](https://codecov.io/gh/sile/flv_codec/branch/master)
[](LICENSE)
Decoders and encoders for [FLV] file format.
[Documentation](https://docs.rs/flv_codec)
Examples
--------
```rust
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.
References
-----------
- [Video File Format Specification][FLV]
[FLV]: https://wwwimages2.adobe.com/content/dam/acom/en/devnet/flv/video_file_format_spec_v10.pdf
[examples/]: https://github.com/sile/flv_codec/tree/master/examples