[FFmpeg-user] Simultaneous two-pass?
Jesse Gordon
tojesseg at gmail.com
Thu Sep 27 12:40:49 CEST 2012
On 09/27/2012 02:55 AM, Gabri Nurtinaz Shally wrote:
> you think like that because you call the file as 'log'. while —as long
> as i remember— all documentation i've read call it statistik. so, it
> need all data to be read to calculate.
Oh, I call it the log file because the command line parameter to specify
the name is -passlogfile and it is also referred to the log in the
source code.
And the contents look like a log file of the video, but I can see
calling it the statistics as well!
> its not borrowing... after reading the statistik, the encoder will know how
> much bit should be allocated for each frame.
What I mean by borrowing is that when a high action scene comes, it can
encode a few frames above the stated bit rate. This action, however,
borrows from the bitrate budget (and the player's buffer.)
However it can only borrow from the budget if it knows that the next few
frames are lower in action, thereby allowing it to pay back quickly what
it borrowed from the bitrate budget.
Some slow frames in the next second of video allow us to over-spend in
this second.
However, if the first second of slow video is in 10 minutes, we can't
overspend now because we need to pay it back before 10 minutes.
Does that make sense, or am I all confused? (The latter is possible and
I don't mind someone pointing it out!)
> thats a good aproach to maximize cpu utilitation. my advice is, rather than
> trigger transcoding at user upload, it is better to create something like
> queue that tell ffmpeg which file that need to be encoded.
Yes - user uploads just put the source file in a queue. Then a separate
script goes over the queue and converts videos in the order uploaded.
And I've just made it so that ffmpeg runs as user ffmpeg and reads from
stdin and writes to stdout -- so if somehow a user uploaded video buffer
overflows ffmpeg or one of its encoders/decoders, the damage should be
limited to user ffmpeg's files (which aren't any) because user ffmpeg
doesn't even have read permissions in /var/www. (ffmpeg does have to
write to /tmp/ though for the -passlogfile )
In case you wondered, I'm trying to make a simple clean replacement for
youtube for myself and a few friends. I got tired of the junk that
youtube shows on the sidebar. If my little project ever amounts to
anything useful I'll open source it. So far all the basic uses work -
uploading, converting, deleting, titles and descriptions, and some
primitive search. There's no admin stuff, however. Adding users is done
on the command line as well as changing passwords.
Thanks very much,
Jesse
More information about the ffmpeg-user
mailing list