-
반응형
What is the FLV file format?
Starting with SWF files published for Flash Player 6, Flash Player can exchange audio, video, and data over RTMP connections with the Adobe Flash Media Server... One way to feed data to Flash Media Server (and thus on to Flash Player clients) is from files in the FLV file format.
Starting with SWF files published for Flash Player 7, Flash Player can also play FLV files directly with MIME type video/x-flv.
An FLV file encodes synchronized audio and video streams. The audio and video data within FLV files are encoded in the same way as audio and video within SWF files.
What is the F4V file format?
Starting with SWF files published for Flash Player 9 Update 3 (9,0,115,0), Flash Player can play F4V files. The F4V format is based on the format specified by ISO/IEC 14496-12: ISO base media file format. A large part of the F4V format involves metadata. When Flash Player loads an F4V file, various stream properties are made available to a running ActionScript program via the NetStream.onMetaData property. The available properties differ depending on the software used. The F4V file format supports an assortment of optional tag boxes that can occur within a moov box.
For more information please check here:
http://www.adobe.com/devnet/flv/pdf/video_file_format_spec_v9.pdf
What is H.264?
H.264 is the next-generation video compression technology in the MPEG-4 standard, also known as MPEG-4 Part 10. H.264 can match the best possible MPEG-2 quality at up to half the data rate. H.264 also delivers excellent video quality across the entire bandwidth spectrum — from 3G to HD and everything in between (from 40 Kbps to upwards of 10 Mbps).
More relevant instruction for FLV, f4v and H.264:
Flash Video is the name of a file format used to deliver video over the Internet using Adobe Flash Player version 6 or newer. Flash Video content may also be embedded within SWF files. Until version 9 update 3 of the Flash Player, Flash Video referred to a proprietary file format, having the extension .FLV, but Adobe introduced new file extensions and MIME types and suggests using those instead of the old FLV:
File Extension
Description
.f4v
‘F4V ’
video/mp4
Video for Adobe Flash Player
.f4p
‘F4P ’
video/mp4
Protected Media for Adobe Flash Player
.f4a
‘F4A ’
video/mp4
Audio for Adobe Flash Player
.f4b
‘F4B ’
video/mp4
Audio Book for Adobe Flash Player
.flv
video/x-flv
It is possible to place H.264 and AAC streams into the traditional FLV file, but Adobe strongly encourages everyone to embrace the new standard file format. There are functional limits with the FLV structure when streaming H.264 which couldn’t be overcome without a redesign of the file format. This is one of the reasons Adobe is moving away from the traditional FLV file structure. Specifically dealing with sequence headers and enders is tricky with FLV streams. Adobe is still working out if it’s possible to place On2 VP6 streams into the new file format.
Tips:
F4v files are MPEG4 containers with h.264 video and MP3 audio. JW player doesn't have the f4v file type defined properly, but if you are streaming from FMS3, you can easily edit RTMPModel. as so that it recognizes f4v files as MP4.
For example, modify the section that deals with the RTMP url to something like this:
private function getID(url:String):String {
if(url.substr(-4) == '.mp3') {
url = 'mp3:'+url.substr(0,url.length-4);
} else if(url.substr(-4) == '.mp4' || url.substr(-4) == '.mov' ||
url.substr(-4) == '.aac' || url.substr(-4) == '.m4a' || url.substr(-4) == '.f4v') {
url = 'mp4:'+url.substr(0,url.length-4);
} else if (url.substr(-4) == '.flv'){
url = url.substr(0,url.length-4);
}
return url;
};
What’s new in Video File Format 10?
The following features are new in the Flash video file format specifications (both FLV and F4V) corresponding to Flash Player 10.
(1) Speex
Flash Player 10 supports the open source Speex audio codec. Speex data can serve as the audio stream in an FLV file.
(2) XMP Metadata
The F4V file format supports a box type called 'uuid' which can store data formatted in Adobe’s Extensible Metadata Platform (XMP.) and present it to a SWF file via ActionScript…
For more detailed information, please check here:
http://www.adobe.com/devnet/flv/pdf/video_file_format_spec_v9.pdf
http://blog.f4player.org/
http://www.adobe.com/devnet/flv/pdf/video_file_format_spec_v10.pdf
http://en.wikipedia.org/wiki/Flash_Video
The latter F4V file format is based on the ISO base media file format and is supported starting with Flash Player 9 update 3.[1][2]
F4V is an 'MP4' video file utilised by 'Adobe Flash Player Version 9' and later versions.
Flash Player 9 Update 3, released on December 3, 2007,[11] also includes support for the new Flash Video file format F4V and H.264 video standard (also known as MPEG-4 part 10, or AVC) which is even more computationally demanding, but offers significantly better quality/bitrate ratio.[12] Specifically, Flash Player now supports video compressed in H.264 (MPEG-4 Part 10), audio compressed using AAC (MPEG-4 Part 3), the F4V, MP4 (MPEG-4 Part 14), M4V, M4A, 3GP and MOV multimedia container formats, 3GPP Timed Text specification (MPEG-4 Part 17) which is a standardized subtitle format and partial parsing support for the 'ilst' atom which is the ID3 equivalent iTunes uses to store metadata. MPEG-4 Part 2 video (e.g. created with DivX or Xvid) is not supported.[13]
The new file formats are completely different from the older FLV file format. For example, F4V does not support Screen video, Sorenson Spark, VP6 video compression formats and ADPCM, Nellymoser audio compression formats.
There are functional limits with the FLV structure when streaming H.264 or AAC which could not be overcome without a redesign of the file format. This is one reason why Adobe Systems is moving away from the traditional FLV file structure.
Supported media types in F4V file format:[1]
- Video: H.264
- Images (still frame of video data): GIF, PNG, JPEG
- Audio: AAC, HE-AAC, MP3
The F4V format
http://www.adobe.com/devnet/flv/pdf/video_file_format_spec_v10.pdf
Flash Player Update 3 (9,0,115,0) and higher can play F4V files.
The F4V format is based on
the format specified by ISO/IEC 14496-12: ISO base media file format.
Unlike SWF files, F4V files store multibyte integers in big-endian byte order.
1 =
little endian (01 00) (like vc)
big endian (00 01)
moov box
moov should be front than mdata box.
tkhd box
Each trak box must contain one and only one tkhd box. The tkhd box describes the main
properties of a track.(witdh , Track ID, Duration)
stsz box
The stsz box specifies the size of each sample in a sample table. An stsz atom must contain one
and only one stsz box.
chpl box
The optional chpl box allows an F4V file to specify individual chapters along the main
timeline of an F4V file. The information in this box is provided to ActionScript. The chpl box
occurs within a moov box.
_______________________________________________________________________________________________
Header BOXHEADER BoxType = 'chpl' (0x6368706C)
Version UI8 Expected to be 0
Flags UI24 Reserved, set to 0
Count UI8 T he number of entries in the Chapters
array Chapters CHAPTERRECORD[Count] An array of timestamps along the
timeline; each indicates the beginning
of a new chapter
_______________________________________________________________________________________________
pdin box
The optional pdin box defines information about progressive download. A file can contain
one pdin box at the top level of the box hierarchy. The information in this box is provided to
ActionScript.
The payload of a pdin box provides hints to software about how much data to download
before the software can safely begin playback.
Flash Player expects a valid F4V file to begin with the one of the following top-level boxes:
■ ftyp (see “ftyp box” on page 18)
■ moov (see “moov box” on page 19)
■ mdat (see “mdat box” on page 32)
Many tools that create these files place an mdat
F4V Metadata
audiochannels
audiocodecid
audiodatarate (live streams only)
audiodevice (live streams only)
audioinputvolume (live streams only)
audiosamplerate
avcprofile
avclevel
creationdate
duration (media files only)
fmeversion (Flash Media Encoder version) (media files only)
framerate
height
moovposition (media files only)
presetname (live streams only)
trackinfo (media files only)
videocodecid
videoframerate (media files only)
videodatarate (live streams only)
videodevice (live streams only)
width
http://osflash.org/flv
Metadata
Property Value Notes duration Obvious. Unlike for FLV files this field will always be present. videocodecid For H.264 it reports ‘avc1’.
audiocodecid For AAC it reports ‘mp4a’, for MP3 it reports ‘.mp3’.
avcprofile 66, 77, 88, 100, 110, 122 or 144 Corresponds to the H.264 profiles avclevel A number between 10 and 51. Consult this list to find out more. aottype Either 0, 1 or 2. This corresponds to AAC Main, AAC LC and SBR audio types. moovposition int The offset in bytes of the moov atom in a file. trackinfo Array An array of objects containing various infomation about all the tracks in a file. chapters Array Information about chapters in audiobooks. seekpoints Array Times you can directly feed into NetStream.seek(); videoframerate int The frame rate of the video if a monotone frame rate is used. Most videos will have a monotone frame rate. audiosamplerate
The original sampling rate of the audio track. audiochannels
The original number of channels of the audio track. tags
ID3 like tag information FLV Format
A Flash Video file (.FLV file extension) 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, 11: Speex 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.
반응형'Media_Dev' 카테고리의 다른 글
Mp4 Sample,encoded AAC,AVC (2) 2010.05.04 color space. (0) 2010.04.12 OGG file (0) 2010.03.19 Quicktime on iPhone's Safari (0) 2010.03.19 Media time not preserved through DMO decoder (0) 2010.03.17