Welcome! Log In Create A New Profile

Advanced

[PATCH] Use specification-compliant FLV header

Piotr Sikora
November 17, 2011 03:58PM
Hey,
according to the Flash Video (FLV) specification [1] E.2 & E.3, [2],
the correct format of the FLV header and the beginning of the stream is:

FLV\x01(\x01|\x04|\x05)\x00\x00\x00\x09\x00\x00\x00\x00

with 5th byte denoting presence of video (\x01), audio (\x04)
or both (\x05).

However, nginx is currently using:

FLV\x01\x01\x00\x00\x00\x09\x00\x00\x00\x09

and while denoting presence of only video tags (\x01) isn't strictly
incorrect, denoting presence of both audio and video (\x05) would match
"real world" usage much closer.

The real problem is \x00\x00\x00\x09 in the beginning of the stream
(denoting size of the previous tag), which is plainly wrong, because
according to the specification it should be always \x00\x00\x00\x00.

I'm aware of the fact that virtually all other pseudo-streaming modules
are using the same incorrect header, but that doesn't mean that nginx
must use it as well. Attached patch fixes this.

[1] http://www.adobe.com/devnet/f4v.html
[2] http://osflash.org/flv#flv_format

Best regards,
Piotr Sikora < piotr.sikora@frickle.com >

--- src/http/modules/ngx_http_flv_module.c.orig Thu Nov 17 17:53:11 2011
+++ src/http/modules/ngx_http_flv_module.c Thu Nov 17 17:53:29 2011
@@ -23,7 +23,7 @@
};


-static u_char ngx_flv_header[] = "FLV\x1\x1\0\0\0\x9\0\0\0\x9";
+static u_char ngx_flv_header[] = "FLV\x1\x5\0\0\0\x9\0\0\0\0";


static ngx_http_module_t ngx_http_flv_module_ctx = {
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Use specification-compliant FLV header

Piotr Sikora 1863 November 17, 2011 03:58PM

Re: [PATCH] Use specification-compliant FLV header

Maxim Dounin 511 November 17, 2011 09:06PM

Re: [PATCH] Use specification-compliant FLV header

Piotr Sikora 687 November 17, 2011 10:26PM

Re: [PATCH] Use specification-compliant FLV header

Maxim Dounin 763 November 18, 2011 09:42AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 297
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready