I want to be able to calculate a target bit rate for a two pass encoding to hit a specific file size.
I can do this for avi/mp4/mkv/mov/m2ts (at least least relatively accurate) and there are quite a few sources out there talking about the container overhead for these containers, but I no discussion about flv container overhead.
As video streams I would use: MPEG-4 AVC, VP8, VP9
As audio streams I would use: mp3, aac, wav, speex
Muxing would be done with: ffmpeg
I know of the Adobe Flash Video File Format Specification and I know that knowing this specification and the ffmpeg source code it should be possible to come up with a 'rough' container overhead estimation, since this is a lot of work and I probably rather pass on flv as a container than trying to figure this out.
Since I couldn't find any info using Google, I'm interested in this issue for quite some time and it doesn't seem to be too far fetched that someone already figured this out:
Does anyone know how to calculate the container overhead of flv files before multiplexing?
Or are there at least some folks that can share some 'rule of thumb' ways they use to estimate the overhead?
+ Reply to Thread
Results 1 to 13 of 13
How accurately do you need to know the overhead? There will be a fixed overhead (ie a fixed size header), an overhead per track (each track will have info about it), and an overhead per frame of video, and chunk of audio. The fixed overheads are negligible for long videos but significant for very short videos.
As a start, I'd just take a pair of video and audio elementary streams and mux them into an FLV file. The difference in size is the sum of all those overheads.
How accurately do you need to know the overhead?
good would be an accuracy of +/- 1MB
at this moment anything which is just a few MB off would be a decent start.
Input file sizes of the content would vary between ~160GB and 1MB, but most around 100 to 500MB.
Mux two videos (including audio), one very short, one very long, into two files.
filesize1 = (variable overhead * number of frames1) + fixed overhead filesize2 = (variable overhead * number of frames2) + fixed overhead
Different (audio/video) frame sizes -> different container block sizes -> different overhead, such tries are simply too rough and will not get you any where near a usable estimation. (tried that with around 100 samples a few month ago, didn't really help)
Then you'll just have to get the FLV spec, analyze the structure, and compute the overhead. And, of course, different FLV muxers will pad differently, pack differently, and add different structures, so you'll have to account for each muxer and the different settings they can use.
Thanks, I know that and like I wrote before, I probably pass on flv as a container then. Took me quite a while to figure out a way to estimate the overhead of m2ts files (still can't really estimate the overhead of trueHD streams), don't have the time or motivation to start such a reading and testing marathon again. So the initial question still stands.
Then why did you ask?
It seems kind of normal for me to ask if someone knows a way to solve a problem before trying to solve it, if I know that it would require me month of reading and testing.
I also thought that this might be interesting for other to know too.
So, at least now I know that you are not interested in the problem and you don't really know anything useful about it, that I didn't know already, or do not care to share that information.
Thanks, but I already know the "Adobe Flash Video File Format Specification", it gave me some general hints, but didn't solve the problem.
It would have been helpful if your original post told us what you know already so we don't have to guess.
Sorry, I thought I wrote that when I wrote the
I know of the Adobe Flash Video File Format Specification ...
To make it clear:
a. I know how to make educated guesses based on specifications and test samples.
b. I know how to program in a bunch of languages
c. I'm not to shabby when it comes to algorithm design and mathematics.
So, yes if I send enough time and read up on all the stuff I could probably figure out some heuristic to calculate the overhead of the flv container. (for most newer containers the best you can hope for is a heuristic since you don't normally know the frame type ratios and similar stuff)
Yes, flv container overhead calculation is not something I will spend days on figuring it out by my own, since it's not that important to me, since I normally do not use flv as a container and I really have not the drive too spend to much time with it.
Yes, I assumed that others would have spend some time on this, since I assumed that it would be a relatively popular container format, seems like I was wrong.