[FFmpeg-devel] update data_offset field in format context

Yoav Steinberg yoav
Thu Nov 6 20:07:23 CET 2008



Reimar D?ffinger wrote:
> On Thu, Nov 06, 2008 at 05:50:46PM +0200, Yoav Steinberg wrote:
>> In my specific application (using libavformat) I'm interested in using 
>> the data_offset field to figure out how much of the file is used for 
>> data and how much is used for "headers".
> 
> And oh, I just have to ask: what is "headers"? I find it hard to imagine
> what the purpose of that should be - it seems more likely that you will
> end up misleading your users to believe this has anything to do how with
> how efficient the container is (it does not, also with that method it
> will say "0" for almost all mov files).
> 

The aim is to define general threshold to distinguish valid data from 
garbage within the file. With the intent of filtering out files that 
contain real media from files that just seem to contain media or have 
lots of corrupt packets in them. This is required in my system to try to 
keep corrupt data to a minimum and prevent user abuse. By using ff's 
demuxer's I can easily find relations between sizes of packets/streams 
and the total file size, which gives me a decent indication in many cases.
I though of utilizing the data_offset to improve calculation results on 
my test set, which it has except for mov files (until I changed the code).

>> "rating" system which isn't relevant to our discussion.
> 
> IMO if what you are doing makes any sense is very relevant to whether we
> should try to fix it for your use case.
> 
> Greetings,
> Reimar D?ffinger

I gather the data_offset field was created to for formats that need it. 
Other formats (like mov) don't care about it, so there's no "correct" 
value that should be expected in such formats. It seems it would be a 
mistake to change the code only for the purpose of my calculations.
It might however be worth adding a comment near the data_offset 
definition along the lines of the comment used for the index_entries 
field explaining when to expect this to contain something relevant.

Let me know if my understanding is correct,
Anyway thanks for clearing this up for me.






More information about the ffmpeg-devel mailing list