[Patch] flv: add support for time offset

Maxim Dounin mdounin at mdounin.ru
Mon Aug 12 11:33:08 UTC 2019


On Sun, Aug 11, 2019 at 05:48:55PM +0800, Jianyong Chen wrote:

> I have been reading nginx source code recently and found that flv module is too
> simple, more specifically, it lacks support for time offset unlike mp4 module does.
> However, in real life, the demand for time offset is more common than it for
> byte offset, especially in CDN field. In addition to CDN, many video players use
> time offset to implement drag function. But the original module only supports
> byte offset, so I think it is necessary to add this feature and I have finished it.
> To support time offset, I had to parse the metadata, but I haven’t found an
> efficient and elegant solution, so I referred to the nginx-rtmp module in this
> part(Thanks, Roman Arutyunyan). As for byte offset, I just kept it consistent
> with the original module.
> I published the project in GitHub, and here is the address:
> https://github.com/BalusChen/nginx-flv-module, where you can find more detail.
> By the way, does anyone have interest in aligning keyframes for mp4 module?
> I'm willing to do this job.
> And Maxim Dounin, could you please give me some comments or suggestions?
> I'll appreciate it.

One of the main benefits of the FLV format is that it doesn't 
require parsing on the server side, and all known FLV players are 
able to provide byte offsets.  Trying to add time offsets does not 
look like an improvement to me - parsing complex formats is not 
something a web server should do.

Note well that the fact that MP4 cannot work with byte offsets and 
instead requires time offsets is not a feature of the MP4 module, 
but rather a limitation of the format and players available.  
Fortunately, modern brosers are able to use range requests with 
MP4 files, potentially making the MP4 module unneeded in the 


Maxim Dounin

More information about the nginx-devel mailing list