diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2012-12-09 18:40:22 +0100 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2013-01-27 16:56:47 +0100 |
commit | 43af18ef8bd97123b85c02877aa22a0f4ea56ab5 (patch) | |
tree | ccbcc4e8983811a36a4fe0fba35ad7457e4fb751 /doc/ffmpeg.texi | |
parent | 2b14344ab36efca915475a91feb744f8f4101cd5 (diff) | |
download | ffmpeg-43af18ef8bd97123b85c02877aa22a0f4ea56ab5.tar.gz |
ffmpeg: implement -force_key_frames expression evalution
Diffstat (limited to 'doc/ffmpeg.texi')
-rw-r--r-- | doc/ffmpeg.texi | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 2c023e12bf..034ca13bfb 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -552,9 +552,16 @@ Force video tag/fourcc. This is an alias for @code{-tag:v}. Show QP histogram @item -vbsf @var{bitstream_filter} Deprecated see -bsf + @item -force_key_frames[:@var{stream_specifier}] @var{time}[,@var{time}...] (@emph{output,per-stream}) +@item -force_key_frames[:@var{stream_specifier}] expr:@var{expr} (@emph{output,per-stream}) Force key frames at the specified timestamps, more precisely at the first frames after each specified time. + +If the argument is prefixed with @code{expr:}, the string @var{expr} +is interpreted like an expression and is evaluated for each frame. A +key frame is forced in case the evaluation is non-zero. + If one of the times is "@code{chapters}[@var{delta}]", it is expanded into the time of the beginning of all chapters in the file, shifted by @var{delta}, expressed as a time in seconds. @@ -567,6 +574,37 @@ before the beginning of every chapter: -force_key_frames 0:05:00,chapters-0.1 @end example +The expression in @var{expr} can contain the following constants: +@table @option +@item n +the number of current processed frame, starting from 0 +@item n_forced +the number of forced frames +@item prev_forced_n +the number of the previous forced frame, it is @code{NAN} when no +keyframe was forced yet +@item prev_forced_t +the time of the previous forced frame, it is @code{NAN} when no +keyframe was forced yet +@item t +the time of the current processed frame +@end table + +For example to force a key frame every 5 seconds, you can specify: +@example +-force_key_frames expr:gte(t,n_forced*5) +@end example + +To force a key frame 5 seconds after the time of the last forced one, +starting from second 13: +@example +-force_key_frames expr:if(isnan(prev_forced_t),gte(t,13),gte(t,prev_forced_t+5)) +@end example + +Note that forcing too many keyframes is very harmful for the lookahead +algorithms of certain encoders: using fixed-GOP options or similar +would be more efficient. + @item -copyinkf[:@var{stream_specifier}] (@emph{output,per-stream}) When doing stream copy, copy also non-key frames found at the beginning. |