Also clarify behaviour in case of specified timestamps
Unified · Split
| @@ -879,12 +879,19 @@ Deprecated see -bsf · 878 unmodified lines | ||
| 879 | 879 | |
| 880 | 880 | @item -force_key_frames[:@var{stream_specifier}] @var{time}[,@var{time}...] (@emph{output,per-stream}) |
| 881 | 881 | @item -force_key_frames[:@var{stream_specifier}] expr:@var{expr} (@emph{output,per-stream}) |
| 882 | −Force key frames at the specified timestamps, more precisely at the first | |
| 883 | −frames after each specified time. | |
| 882 | +@item -force_key_frames[:@var{stream_specifier}] source (@emph{output,per-stream}) | |
| 884 | 883 | |
| 885 | −If the argument is prefixed with @code{expr:}, the string @var{expr} | |
| 886 | −is interpreted like an expression and is evaluated for each frame. A | |
| 887 | −key frame is forced in case the evaluation is non-zero. | |
| 884 | +@var{force_key_frames} can take arguments of the following form: | |
| 885 | + | |
| 886 | +@table @option | |
| 887 | + | |
| 888 | +@item @var{time}[,@var{time}...] | |
| 889 | +If the argument consists of timestamps, ffmpeg will round the specified times to the nearest | |
| 890 | +output timestamp as per the encoder time base and force a keyframe at the first frame having | |
| 891 | +timestamp equal or greater than the computed timestamp. Note that if the encoder time base is too | |
| 892 | +coarse, then the keyframes may be forced on frames with timestamps lower than the specified time. | |
| 893 | +The default encoder time base is the inverse of the output framerate but may be set otherwise | |
| 894 | +via @code{-enc_time_base}. | |
| 888 | 895 | |
| 889 | 896 | If one of the times is "@code{chapters}[@var{delta}]", it is expanded into |
| 890 | 897 | the time of the beginning of all chapters in the file, shifted by |
| @@ -898,6 +905,11 @@ before the beginning of every chapter: · 7 unmodified lines | ||
| 898 | 905 | -force_key_frames 0:05:00,chapters-0.1 |
| 899 | 906 | @end example |
| 900 | 907 | |
| 908 | +@item expr:@var{expr} | |
| 909 | +If the argument is prefixed with @code{expr:}, the string @var{expr} | |
| 910 | +is interpreted like an expression and is evaluated for each frame. A | |
| 911 | +key frame is forced in case the evaluation is non-zero. | |
| 912 | + | |
| 901 | 913 | The expression in @var{expr} can contain the following constants: |
| 902 | 914 | @table @option |
| 903 | 915 | @item n |
| @@ -925,6 +937,12 @@ starting from second 13: · 21 unmodified lines | ||
| 925 | 937 | -force_key_frames expr:if(isnan(prev_forced_t),gte(t,13),gte(t,prev_forced_t+5)) |
| 926 | 938 | @end example |
| 927 | 939 | |
| 940 | +@item source | |
| 941 | +If the argument is @code{source}, ffmpeg will force a key frame if | |
| 942 | +the current frame being encoded is marked as a key frame in its source. | |
| 943 | + | |
| 944 | +@end table | |
| 945 | + | |
| 928 | 946 | Note that forcing too many keyframes is very harmful for the lookahead |
| 929 | 947 | algorithms of certain encoders: using fixed-GOP options or similar |
| 930 | 948 | would be more efficient. |