English 中文(简体)
AVPacket 的 FLV 信头
原标题:FFMPEG: FLV header for AVPacket
  • 时间:2012-05-25 12:00:28
  •  标签:
  • ffmpeg
  • flv

我在我的应用程序中使用了 HippPegg 代码, 在那里我需要为我的程序获取 FLV 包。 对于这个程序, 我使用 avcodc_ encode_ visual2( ) 。 我的问题是, 函数会创建 AVPacket 包, 它不保留完整的 FLV格式, 只有它的身体。 但我仍然需要它的头。 通常, 另外一个函数 (av_ write_ frame ()) 使它成为它。 我无法在我的应用程序中使用 av_ write_ frame (), 因为它不符合我的要求 。 所以也许有人知道 ffmpeg 库中的函数, 它可以通过 avcodec_ encode_ view 2 将 FLV Hele inceptal 加入创建的包 。

问题回答

FLV头本身比较简单。

可以用下列代码作为模型:

/* FLV file header */
#define FLV_SIGNATURE       "FLV"
#define FLV_VERSION         ((uint8)0x01)

#define FLV_FLAG_VIDEO      ((uint8)0x01)
#define FLV_FLAG_AUDIO      ((uint8)0x04)

typedef struct __flv_header {
    uint8_t         signature[3]; /* always "FLV" */
    uint8_t         version; /* should be 1 */
    uint8_t         flags;
    uint32_t        offset; /* always 9 */
} flv_header;

glass 字段是一个位mask, 显示文件是否拥有视频、 音频或两个流。 例如, 如果您的文件有音频和视频, 它的价值将是 5 。

请注意, offsets 字段以大东编码,在小东平台上以价值150994944表示。

如果您不想使用这样的结构, 并有直接写缓冲文件的方法, 您可以创建这样的缓冲文件 :

uint_8 buffer[9] = {0x46, 0x4c, 0x56, 0x01, 0x05, 0x00, 0x00, 0x00, 0x09};




相关问题
FLV s not being served by web server (302 response)

I have a web app. IIS 6. .NET 3.5. I have 2 websites on the web server. One of which is already correctly serving FLVs. The newer one is not. I have added the MIME type information to the HTTP ...

How to compress an FLV movie in java?

How can we compress the flv movie? Is there any free library which i can use? for compressing the video i can go for reducing the resoultion as well, even framerate reducing is acceptable to me.

Multi-bitrate/dynamic rate for progressive FLV playback

Is there a way to get multi-bitrate playback working with progessive playback without having to download all versions of the file? People all coming up with all kinds of cool ways to make progressive ...

flv file loses quality when uploaded to server

When i view an flv file inside a swf file it looks fine locally, but when its uploaded text loses it shape. The bitrate for the flv is 1,500+ kbps. Ive attached a picture. The one on the left is local,...

Javascript & Ajax video player not working in PHP file

PHP + javascript code + flv player: I am trying to play a .flv video on a web page and I have the file name to play from mysql database so i need to use PHP. In the code below there is a script that ...

FLVs on timeline are glitching out

I have a Movieclip with about five FLV movies embedded on its timeline, one after another. I am loading multiple instances (about 5-10) of this movieclip onto the stage. Once added to the stage, they ...

store wget link into a database (php)

I m trying to find a solution to download automatically .flv link everyday from a website using wget and to store all the links into a database to stream them in my website. (all in php) How to do ...

热门标签