Admin관리자   |    Posting포스트   |    LogOut로그아웃
:+:하늘을닮은호수:+: | Trac | 블로그   |    위치로그   |    태그로그   |    방명록


하늘을 닮은 호수
http://sunsson.iptime.org
Category
전체 (966)
[Standard] (59)
[OS] (119)
[Develope] (77)
[IT Trend] (347)
[Music] (101)
[삶의 질] (262)
Tag List
trac   3GPP   IPTV   2MB   svn   mysql   RTP   VoIP   c99   PSS   손예진   FLV   ffmpeg   cdn   avc   awk   memory_leak   H.263   팔봉산   grep   BIFS   행복   네 멋대로 해라   IPv6   iso   OMA   ITU-T   양동근   hint track   SElinux  
FLV File Format
Category : [Standard]/etc
Date : 2007/11/07 18:05

FLV File Format

A Flash Video file (.FLV) consists of a short header, and then interleaved audio, video, and metadata packets. The audio and video packets are stored very similarly to those in SWF, and the metadata packets consist of AMF data.

FLV Header

Field Data Type Example Description
Signature byte[3] “FLV” Always “FLV”
Version uint8 “\x01” (1) Currently 1 for known FLV files
Flags uint8 bitmask “\x05” (5, audio+video) Bitmask: 4 is audio, 1 is video
Offset uint32_be “\x00\x00\x00\x09” (9) Total size of header (always 9 for known FLV files)

FLV Stream

Field Data Type Example Description
PreviousTagSize uint32_be “\x00\x00\x00\x00” (0) Always 0

Then a sequence of tags followed by their size until EOF.

FLV Tag

Field Data Type Example Description
Type uint8 “\x12” (0×12, META) Determines the layout of Body, see below for tag types
BodyLength uint24_be “\x00\x00\xe0” (224) Size of Body (total tag size - 11)
Timestamp uint24_be “\x00\x00\x00” (0) Timestamp of tag (in milliseconds)
TimestampExtended uint8 “\x00” (0) Timestamp extension to form a uint32_be. This field has the upper 8 bits.
StreamId uint24_be “\x00\x00\x00” (0) Always 0
Body byte[BodyLength] ... Dependent on the value of Type

Previous tag size

Field Data Type Example Description
PreviousTagSize uint32_be “\x00\x00\x00\x00” (0) Total size of previous tag, or 0 for first tag

FLV Tag Types

Tag code Name Description
0×08 AUDIO Contains an audio packet similar to a SWF SoundStreamBlock plus codec information
0×09 VIDEO Contains a video packet similar to a SWF VideoFrame plus codec information
0×12 META Contains two AMF packets, the name of the event and the data to go with it

FLV Tag 0x08: AUDIO

The first byte of an audio packet contains bitflags that describe the codec used, with the following layout:

Name Expression Description
soundType (byte & 0×01) » 0 0: mono, 1: stereo
soundSize (byte & 0×02) » 1 0: 8-bit, 1: 16-bit
soundRate (byte & 0x0C) » 2 0: 5.5 kHz, 1: 11 kHz, 2: 22 kHz, 3: 44 kHz
soundFormat (byte & 0xf0) » 4 0: Uncompressed, 1: ADPCM, 2: MP3, 5: Nellymoser 8kHz mono, 6: Nellymoser

The rest of the audio packet is simply the relevant data for that format, as per a SWF SoundStreamBlock.

FLV Tag 0x09: VIDEO

The first byte of a video packet describes contains bitflags that describe the codec used, and the type of frame

Name Expression Description
codecID (byte & 0x0f) » 0 2: Sorensen H.263, 3: Screen video, 4: On2 VP6, 5: On2 VP6 Alpha, 6: ScreenVideo 2
frameType (byte & 0xf0) » 4 1: keyframe, 2: inter frame, 3: disposable inter frame

In some cases it is also useful to decode some of the body of the video packet, such as to acquire its resolution (if the initial onMetaData META tag is missing, for example).

TODO: Describe the techniques for acquiring this information. Until then, you can consult the flashticle sources.

FLV Tag 0x12: META

The contents of a meta packet are two AMF packets. The first is almost always a short uint16_be length-prefixed UTF-8 string (AMF type 0×02), and the second is typically a mixed array (AMF type 0×08). However, the second chunk typically contains a variety of types, so a full AMF parser should be used.

HTTP Streaming

It is possible to semi-stream flv over http using a trick which sends the normal headers then skips forward to a desired point in the file and moves the timestamps forward accordingly.

The FLV Metadata injector is a free closed-source tool which can inject this information into a FLV file. A sample php script and fla is available at FlashComGuru

Another tool that you can use to stream flv files using http is using Flv4PHP this tool is both a FLV Metadata injector and a stream tool, using php 4.x. this Project is GPL.

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)
2007/11/07 18:05 2007/11/07 18:05
Top

블로그코리아에 블UP하기
FLV File Format
Category : [Standard]/ITU
Date : 2007/10/30 09:52
 
1. FLV File Format
 1.1. FLV : FLash Video file
 1.2. Consists of the short FLV Header & FLV File Body
 1.3. Metadata, Audio and Video packets are interleaved..
 1.4. Various Trasnsmision is useful
  1.4.1. SWF Embed
  1.4.2. Progressive Download
  1.4.3. RTMP Streaming
 
 1.2. FLV Headers
사용자 삽입 이미지
 1.3. FLV Bodys
사용자 삽입 이미지

 1.4. FLV Tag
사용자 삽입 이미지
 1.5. FLV Tags
사용자 삽입 이미지

§이 문서는 http://sunsson.iptime.org/projects/juliet/wiki/FLV%20File%20Format 에서 꾸준히 업데이트 됩니다.
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)
2007/10/30 09:52 2007/10/30 09:52
Top

블로그코리아에 블UP하기
FLV File Format
Date : 2007/02/14 13:32

FLV 는 AVI와 비슷하게 Audio, Video의 Tag들로 되어 있다.

이에 더해 컨트롤을 위한 Action Script를 포함하고 있다.

Tag의 기본 형식은 Size + Tag Data 이다.

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기
2007/02/14 13:32 2007/02/14 13:32
Tag
Top

블로그코리아에 블UP하기
Creative Commons License
블로그 내에 모든 저작물은 크리에이티브 커먼즈코리아 저작자표시 - 비영리 - 변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
최근 덧글
펼치기
최근 트랙백
펼치기
Today :
44
Yesterday :
207
Total :
78535
Powered by :
Textcube
ver :
1.7.5 : Risoluto
skin by :