diff mbox series

[FFmpeg-devel] ffmpeg: don't force source-tracked keyframes for duplicates

Message ID 20200103070522.2260-1-ffmpeg@gyani.pro
State Accepted
Headers show
Series [FFmpeg-devel] ffmpeg: don't force source-tracked keyframes for duplicates | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Gyan Doshi Jan. 3, 2020, 7:05 a.m. UTC
Prevents a run of consecutive duplicate frames from all being encoded
as keyframes, when force_key_frames is set to source.
---
 fftools/ffmpeg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Jan. 3, 2020, 10 a.m. UTC | #1
On Fri, Jan 03, 2020 at 12:35:22PM +0530, Gyan Doshi wrote:
> Prevents a run of consecutive duplicate frames from all being encoded
> as keyframes, when force_key_frames is set to source.
> ---
>  fftools/ffmpeg.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

maybe ok (i wonder if this would be expected behavior with intra only input)

thx

[...]
Gyan Doshi Jan. 3, 2020, 10:35 a.m. UTC | #2
On 03-01-2020 03:30 pm, Michael Niedermayer wrote:
> On Fri, Jan 03, 2020 at 12:35:22PM +0530, Gyan Doshi wrote:
>> Prevents a run of consecutive duplicate frames from all being encoded
>> as keyframes, when force_key_frames is set to source.
>> ---
>>   fftools/ffmpeg.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
> maybe ok (i wonder if this would be expected behavior with intra only input)

If user wants intra-only output, they can use an intra-coded encoder or 
-g 1.

If they want to preserve same seek points as source, then the 
non-duplicated frame has the closest pts sync to the source timestamp.


Gyan
Gyan Doshi Jan. 4, 2020, 4:32 a.m. UTC | #3
On 03-01-2020 04:05 pm, Gyan wrote:
>
>
> On 03-01-2020 03:30 pm, Michael Niedermayer wrote:
>> On Fri, Jan 03, 2020 at 12:35:22PM +0530, Gyan Doshi wrote:
>>> Prevents a run of consecutive duplicate frames from all being encoded
>>> as keyframes, when force_key_frames is set to source.
>>> ---
>>>   fftools/ffmpeg.c | 3 ++-
>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>> maybe ok (i wonder if this would be expected behavior with intra only 
>> input)
>
> If user wants intra-only output, they can use an intra-coded encoder 
> or -g 1.
>
> If they want to preserve same seek points as source, then the 
> non-duplicated frame has the closest pts sync to the source timestamp.

Will push tonight.

Gyan
Gyan Doshi Jan. 5, 2020, 7:02 a.m. UTC | #4
On 04-01-2020 10:02 am, Gyan wrote:
>
>
> On 03-01-2020 04:05 pm, Gyan wrote:
>>
>>
>> On 03-01-2020 03:30 pm, Michael Niedermayer wrote:
>>> On Fri, Jan 03, 2020 at 12:35:22PM +0530, Gyan Doshi wrote:
>>>> Prevents a run of consecutive duplicate frames from all being encoded
>>>> as keyframes, when force_key_frames is set to source.
>>>> ---
>>>>   fftools/ffmpeg.c | 3 ++-
>>>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>> maybe ok (i wonder if this would be expected behavior with intra 
>>> only input)
>>
>> If user wants intra-only output, they can use an intra-coded encoder 
>> or -g 1.
>>
>> If they want to preserve same seek points as source, then the 
>> non-duplicated frame has the closest pts sync to the source timestamp.
>
> Will push tonight.

Pushed as 5d82c078ea93d7eee12ff863a4f9eb5fb2d30d16

Gyan
diff mbox series

Patch

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 9af2bc2fb5..d821b40877 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1266,7 +1266,8 @@  static void do_video_out(OutputFile *of,
             ost->forced_keyframes_expr_const_values[FKF_N] += 1;
         } else if (   ost->forced_keyframes
                    && !strncmp(ost->forced_keyframes, "source", 6)
-                   && in_picture->key_frame==1) {
+                   && in_picture->key_frame==1
+                   && !i) {
             forced_keyframe = 1;
         }