Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec/setts_bsf: set the output packet duration to 0
@ 2022-02-09 15:28 James Almer
  2022-02-13 17:07 ` James Almer
  0 siblings, 1 reply; 8+ messages in thread
From: James Almer @ 2022-02-09 15:28 UTC (permalink / raw)
  To: ffmpeg-devel

It's not possible to know the resulting packet's duration after
applying the expression as it depends on the timestamp of the next
packet, which we haven't seen yet.
The old duration, if any, is no longer valid, so just remove it.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/setts_bsf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/setts_bsf.c b/libavcodec/setts_bsf.c
index d604f91f71..56307fc8cd 100644
--- a/libavcodec/setts_bsf.c
+++ b/libavcodec/setts_bsf.c
@@ -180,6 +180,7 @@ static int setts_filter(AVBSFContext *ctx, AVPacket *pkt)
 
     pkt->pts = new_pts;
     pkt->dts = new_dts;
+    pkt->duration = 0;
 
     return ret;
 }
-- 
2.35.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/setts_bsf: set the output packet duration to 0
  2022-02-09 15:28 [FFmpeg-devel] [PATCH] avcodec/setts_bsf: set the output packet duration to 0 James Almer
@ 2022-02-13 17:07 ` James Almer
  2022-02-13 17:14   ` Paul B Mahol
  0 siblings, 1 reply; 8+ messages in thread
From: James Almer @ 2022-02-13 17:07 UTC (permalink / raw)
  To: ffmpeg-devel

On 2/9/2022 12:28 PM, James Almer wrote:
> It's not possible to know the resulting packet's duration after
> applying the expression as it depends on the timestamp of the next
> packet, which we haven't seen yet.
> The old duration, if any, is no longer valid, so just remove it.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavcodec/setts_bsf.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/setts_bsf.c b/libavcodec/setts_bsf.c
> index d604f91f71..56307fc8cd 100644
> --- a/libavcodec/setts_bsf.c
> +++ b/libavcodec/setts_bsf.c
> @@ -180,6 +180,7 @@ static int setts_filter(AVBSFContext *ctx, AVPacket *pkt)
>   
>       pkt->pts = new_pts;
>       pkt->dts = new_dts;
> +    pkt->duration = 0;
>   
>       return ret;
>   }

Will apply.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/setts_bsf: set the output packet duration to 0
  2022-02-13 17:07 ` James Almer
@ 2022-02-13 17:14   ` Paul B Mahol
  2022-02-13 17:20     ` James Almer
  0 siblings, 1 reply; 8+ messages in thread
From: Paul B Mahol @ 2022-02-13 17:14 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Too soon.

Wait more,
does this breaks something?
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/setts_bsf: set the output packet duration to 0
  2022-02-13 17:14   ` Paul B Mahol
@ 2022-02-13 17:20     ` James Almer
  2022-02-13 17:22       ` Andreas Rheinhardt
  0 siblings, 1 reply; 8+ messages in thread
From: James Almer @ 2022-02-13 17:20 UTC (permalink / raw)
  To: ffmpeg-devel

On 2/13/2022 2:14 PM, Paul B Mahol wrote:
> Too soon.
> 
> Wait more,

Ok.

> does this breaks something?

There are no fate tests, and 0 is used when the duration is unknown, so 
it shouldn't break anything.

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/setts_bsf: set the output packet duration to 0
  2022-02-13 17:20     ` James Almer
@ 2022-02-13 17:22       ` Andreas Rheinhardt
  2022-02-13 17:28         ` James Almer
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Rheinhardt @ 2022-02-13 17:22 UTC (permalink / raw)
  To: ffmpeg-devel

James Almer:
> On 2/13/2022 2:14 PM, Paul B Mahol wrote:
>> Too soon.
>>
>> Wait more,
> 
> Ok.
> 
>> does this breaks something?
> 
> There are no fate tests, and 0 is used when the duration is unknown, so
> it shouldn't break anything.
> 

It breaks the simple use-case where this filter is used to just shift
the timestamps.

- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/setts_bsf: set the output packet duration to 0
  2022-02-13 17:22       ` Andreas Rheinhardt
@ 2022-02-13 17:28         ` James Almer
  2022-02-13 17:32           ` Andreas Rheinhardt
  2022-02-13 18:38           ` Gyan Doshi
  0 siblings, 2 replies; 8+ messages in thread
From: James Almer @ 2022-02-13 17:28 UTC (permalink / raw)
  To: ffmpeg-devel



On 2/13/2022 2:22 PM, Andreas Rheinhardt wrote:
> James Almer:
>> On 2/13/2022 2:14 PM, Paul B Mahol wrote:
>>> Too soon.
>>>
>>> Wait more,
>>
>> Ok.
>>
>>> does this breaks something?
>>
>> There are no fate tests, and 0 is used when the duration is unknown, so
>> it shouldn't break anything.
>>
> 
> It breaks the simple use-case where this filter is used to just shift
> the timestamps.

How so? It's a documented value that means unknown. What breaks because 
of it? Wouldn't it be revealing a bug if so?

And in non simple use cases that completely replace or rescale the 
timestamps, the old duration value is no longer valid, and something 
definitely worse to have than 0.

> 
> - Andreas
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/setts_bsf: set the output packet duration to 0
  2022-02-13 17:28         ` James Almer
@ 2022-02-13 17:32           ` Andreas Rheinhardt
  2022-02-13 18:38           ` Gyan Doshi
  1 sibling, 0 replies; 8+ messages in thread
From: Andreas Rheinhardt @ 2022-02-13 17:32 UTC (permalink / raw)
  To: ffmpeg-devel

James Almer:
> 
> 
> On 2/13/2022 2:22 PM, Andreas Rheinhardt wrote:
>> James Almer:
>>> On 2/13/2022 2:14 PM, Paul B Mahol wrote:
>>>> Too soon.
>>>>
>>>> Wait more,
>>>
>>> Ok.
>>>
>>>> does this breaks something?
>>>
>>> There are no fate tests, and 0 is used when the duration is unknown, so
>>> it shouldn't break anything.
>>>
>>
>> It breaks the simple use-case where this filter is used to just shift
>> the timestamps.
> 
> How so? It's a documented value that means unknown. What breaks because
> of it? Wouldn't it be revealing a bug if so?
> 

Effectively forgetting a known value can have bad consequences. Think of
subtitles.

> And in non simple use cases that completely replace or rescale the
> timestamps, the old duration value is no longer valid, and something
> definitely worse to have than 0.
> 

I am not saying that this filter is currently always outputting valid
durations.

- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/setts_bsf: set the output packet duration to 0
  2022-02-13 17:28         ` James Almer
  2022-02-13 17:32           ` Andreas Rheinhardt
@ 2022-02-13 18:38           ` Gyan Doshi
  1 sibling, 0 replies; 8+ messages in thread
From: Gyan Doshi @ 2022-02-13 18:38 UTC (permalink / raw)
  To: ffmpeg-devel



On 2022-02-13 10:58 pm, James Almer wrote:
>
>
> On 2/13/2022 2:22 PM, Andreas Rheinhardt wrote:
>> James Almer:
>>> On 2/13/2022 2:14 PM, Paul B Mahol wrote:
>>>> Too soon.
>>>>
>>>> Wait more,
>>>
>>> Ok.
>>>
>>>> does this breaks something?
>>>
>>> There are no fate tests, and 0 is used when the duration is unknown, so
>>> it shouldn't break anything.
>>>
>>
>> It breaks the simple use-case where this filter is used to just shift
>> the timestamps.
>
> How so? It's a documented value that means unknown. What breaks 
> because of it? Wouldn't it be revealing a bug if so?
>
> And in non simple use cases that completely replace or rescale the 
> timestamps, the old duration value is no longer valid, and something 
> definitely worse to have than 0.

If the legacy value remains, a downstream processor can still use it for 
some reference or heuristic.
And it can peek and compare adjacent timestamps to harmonize the 
duration value if needed.
But once zeroed out, that hint is gone.

Regards,
Gyan
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-02-13 18:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-09 15:28 [FFmpeg-devel] [PATCH] avcodec/setts_bsf: set the output packet duration to 0 James Almer
2022-02-13 17:07 ` James Almer
2022-02-13 17:14   ` Paul B Mahol
2022-02-13 17:20     ` James Almer
2022-02-13 17:22       ` Andreas Rheinhardt
2022-02-13 17:28         ` James Almer
2022-02-13 17:32           ` Andreas Rheinhardt
2022-02-13 18:38           ` Gyan Doshi

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git