filter for changing frame rate

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

filter for changing frame rate

Jon bae
Hello everybody,
I have videos with 23.97 fps and I want to change the fps to 25. For this I
don't want to use fps or framerate filter, but changing the pts with:
setpts=1/1.0427093760427095*PTS

If I do this I have to define also the output frame rate with the -r
command. But I would like to change the frame rate with an video filter,
after setting the pts.

Do you know a way for that?
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

Paul B Mahol
On 5/13/19, Jon bae <[hidden email]> wrote:

> Hello everybody,
> I have videos with 23.97 fps and I want to change the fps to 25. For this I
> don't want to use fps or framerate filter, but changing the pts with:
> setpts=1/1.0427093760427095*PTS
>
> If I do this I have to define also the output frame rate with the -r
> command. But I would like to change the frame rate with an video filter,
> after setting the pts.
>
> Do you know a way for that?

You can not.

Mostly because some devs are against it.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

FFmpeg-users mailing list

>
> You can not.

I am curious what exactly the hindrance is. As I understand at least mp4 there is not really a concept of frame rate in the file and in theory every frame can have a different „rate“, defined solely by pts. So in theory pts should be all you need. Where am I going wrong in my understanding, and what exactly are the problems in ffmpeg that would arise?
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

Carl Eugen Hoyos-2
In reply to this post by Jon bae
Am Mo., 13. Mai 2019 um 13:25 Uhr schrieb Jon bae <[hidden email]>:
>
> Hello everybody,
> I have videos with 23.97 fps and I want to change the fps to 25. For this I
> don't want to use fps or framerate filter, but changing the pts with:
> setpts=1/1.0427093760427095*PTS
>
> If I do this I have to define also the output frame rate with the -r
> command. But I would like to change the frame rate with an video filter,
> after setting the pts.

What's wrong with using the fps filter?
In some cases, dejudder could also help.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

Paul B Mahol
In reply to this post by FFmpeg-users mailing list
On 5/13/19, Daniel Oberhoff via ffmpeg-user <[hidden email]> wrote:
>
>>
>> You can not.
>
> I am curious what exactly the hindrance is. As I understand at least mp4
> there is not really a concept of frame rate in the file and in theory every
> frame can have a different „rate“, defined solely by pts. So in theory pts
> should be all you need. Where am I going wrong in my understanding, and what
> exactly are the problems in ffmpeg that would arise?

frame rate is only metadata number, pts defines real frame rate.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

Carl Eugen Hoyos-2
In reply to this post by FFmpeg-users mailing list
Am Mo., 13. Mai 2019 um 13:36 Uhr schrieb Daniel Oberhoff via
ffmpeg-user <[hidden email]>:
>
>
> >
> > You can not.
>
> I am curious what exactly the hindrance is. As I understand at least mp4 there is not really a concept of frame rate in the file and in theory every frame can have a different „rate“, defined solely by pts.

FFmpeg's mp4 muxer does not support variable frame rate.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

Paul B Mahol
In reply to this post by Carl Eugen Hoyos-2
On 5/13/19, Carl Eugen Hoyos <[hidden email]> wrote:

> Am Mo., 13. Mai 2019 um 13:25 Uhr schrieb Jon bae <[hidden email]>:
>>
>> Hello everybody,
>> I have videos with 23.97 fps and I want to change the fps to 25. For this
>> I
>> don't want to use fps or framerate filter, but changing the pts with:
>> setpts=1/1.0427093760427095*PTS
>>
>> If I do this I have to define also the output frame rate with the -r
>> command. But I would like to change the frame rate with an video filter,
>> after setting the pts.
>
> What's wrong with using the fps filter?
> In some cases, dejudder could also help.
>

fps filter duplicates/drops frames, dejudder is specific filter for
specific usecase.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

Jon bae
Am Mo., 13. Mai 2019 um 13:41 Uhr schrieb Paul B Mahol <[hidden email]>:

> On 5/13/19, Carl Eugen Hoyos <[hidden email]> wrote:
> > Am Mo., 13. Mai 2019 um 13:25 Uhr schrieb Jon bae <[hidden email]>:
> >>
> >> Hello everybody,
> >> I have videos with 23.97 fps and I want to change the fps to 25. For
> this
> >> I
> >> don't want to use fps or framerate filter, but changing the pts with:
> >> setpts=1/1.0427093760427095*PTS
> >>
> >> If I do this I have to define also the output frame rate with the -r
> >> command. But I would like to change the frame rate with an video filter,
> >> after setting the pts.
> >
> > What's wrong with using the fps filter?
> > In some cases, dejudder could also help.
> >
>
> fps filter duplicates/drops frames, dejudder is specific filter for
> specific usecase.
>
> Yes the is right, I don't want any dropping or interpolating. Just setting
a new fps. But when this is not possible with filters, I have to use the -r
option.

Thank for clarifying!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

Carl Eugen Hoyos-2
Am Mo., 13. Mai 2019 um 14:03 Uhr schrieb Jon bae <[hidden email]>:

>
> Am Mo., 13. Mai 2019 um 13:41 Uhr schrieb Paul B Mahol <[hidden email]>:
>
> > On 5/13/19, Carl Eugen Hoyos <[hidden email]> wrote:
> > > Am Mo., 13. Mai 2019 um 13:25 Uhr schrieb Jon bae <[hidden email]>:
> > >>
> > >> Hello everybody,
> > >> I have videos with 23.97 fps and I want to change the fps to 25. For
> > this
> > >> I
> > >> don't want to use fps or framerate filter, but changing the pts with:
> > >> setpts=1/1.0427093760427095*PTS
> > >>
> > >> If I do this I have to define also the output frame rate with the -r
> > >> command. But I would like to change the frame rate with an video filter,
> > >> after setting the pts.
> > >
> > > What's wrong with using the fps filter?
> > > In some cases, dejudder could also help.
> > >
> >
> > fps filter duplicates/drops frames, dejudder is specific filter for
> > specific usecase.
> >
> > Yes the is right, I don't want any dropping or interpolating. Just setting
> a new fps. But when this is not possible with filters, I have to use the -r
> option.

Or the fps filter.
This filter and the r option have different algorithms that have advantages
(and disadvantages) in different situations.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

Moritz Barsnick
In reply to this post by Jon bae
On Mon, May 13, 2019 at 14:03:30 +0200, Jon bae wrote:
> Am Mo., 13. Mai 2019 um 13:41 Uhr schrieb Paul B Mahol <[hidden email]>:
> > fps filter duplicates/drops frames, dejudder is specific filter for
> > specific usecase.
> >
> Yes the is right, I don't want any dropping or interpolating. Just setting
> a new fps. But when this is not possible with filters, I have to use the -r
> option.

Isn't "-r" - at least in theory - the same as inserting the fps filter
at the end or the filter chain? [*]

Anyway, if setpts has already changed the actual (PTS-driven)
framerate, then chaining the fps filter should only change the
metadata. Caveat: Only if the input is CFR; otherwise the fps filter
will duplicate/drop to achive CFR.

So what is required here is a filter (or bitstream filter?), which can
change the metadata framerate (and only that), or such an option for
the muxer. Or what am I missing?

BTW, 'setpts=24000/1001/25*PTS' is probably the correct value, assuming
the input has a norm framerate.

Moritz

[*] I recall having read that there are some behavioral differences.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

Jon bae
In reply to this post by Carl Eugen Hoyos-2
Am Mo., 13. Mai 2019 um 14:09 Uhr schrieb Carl Eugen Hoyos <
[hidden email]>:

> Am Mo., 13. Mai 2019 um 14:03 Uhr schrieb Jon bae <[hidden email]>:
> >
> > Am Mo., 13. Mai 2019 um 13:41 Uhr schrieb Paul B Mahol <[hidden email]
> >:
> >
> > > On 5/13/19, Carl Eugen Hoyos <[hidden email]> wrote:
> > > > Am Mo., 13. Mai 2019 um 13:25 Uhr schrieb Jon bae <
> [hidden email]>:
> > > >>
> > > >> Hello everybody,
> > > >> I have videos with 23.97 fps and I want to change the fps to 25. For
> > > this
> > > >> I
> > > >> don't want to use fps or framerate filter, but changing the pts
> with:
> > > >> setpts=1/1.0427093760427095*PTS
> > > >>
> > > >> If I do this I have to define also the output frame rate with the -r
> > > >> command. But I would like to change the frame rate with an video
> filter,
> > > >> after setting the pts.
> > > >
> > > > What's wrong with using the fps filter?
> > > > In some cases, dejudder could also help.
> > > >
> > >
> > > fps filter duplicates/drops frames, dejudder is specific filter for
> > > specific usecase.
> > >
> > > Yes the is right, I don't want any dropping or interpolating. Just
> setting
> > a new fps. But when this is not possible with filters, I have to use the
> -r
> > option.
>
> Or the fps filter.
> This filter and the r option have different algorithms that have advantages
> (and disadvantages) in different situations.
>
> But how you can tell the fps filter to don't duplicate one frame? For me
it hurts less, that the video plays slightly faster, than it have every
second a duplicated frame.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

Michael Koch
In reply to this post by Carl Eugen Hoyos-2

> Or the fps filter.
> This filter and the r option have different algorithms that have advantages
> (and disadvantages) in different situations.

Are the differences explained somewhere in the documentation?

Michael

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

Carl Eugen Hoyos-2
Am Mo., 13. Mai 2019 um 14:31 Uhr schrieb Michael Koch
<[hidden email]>:

> > Or the fps filter.
> > This filter and the r option have different algorithms that have
> > advantages (and disadvantages) in different situations.
>
> Are the differences explained somewhere in the documentation?

Not to my knowledge, them main difference is that the filter is
more greedy.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

Jon bae
Am Mo., 13. Mai 2019 um 14:34 Uhr schrieb Carl Eugen Hoyos <
[hidden email]>:

> Am Mo., 13. Mai 2019 um 14:31 Uhr schrieb Michael Koch
> <[hidden email]>:
>
> > > Or the fps filter.
> > > This filter and the r option have different algorithms that have
> > > advantages (and disadvantages) in different situations.
> >
> > Are the differences explained somewhere in the documentation?
>
> Not to my knowledge, them main difference is that the filter is
> more greedy.
>
> Carl Eugen
>
>
Sorry Carl Eugen - you are right. I did a test, and when I apply the fps
filter after setpts it not duplicate any frames.

Thank you for that hint!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

Carl Eugen Hoyos-2
Am Mo., 13. Mai 2019 um 15:05 Uhr schrieb Jon bae <[hidden email]>:

>
> Am Mo., 13. Mai 2019 um 14:34 Uhr schrieb Carl Eugen Hoyos <
> [hidden email]>:
>
> > Am Mo., 13. Mai 2019 um 14:31 Uhr schrieb Michael Koch
> > <[hidden email]>:
> >
> > > > Or the fps filter.
> > > > This filter and the r option have different algorithms that have
> > > > advantages (and disadvantages) in different situations.
> > >
> > > Are the differences explained somewhere in the documentation?
> >
> > Not to my knowledge, them main difference is that the filter is
> > more greedy.
> >
> > Carl Eugen
> >
> >
> Sorry Carl Eugen - you are right. I did a test, and when I apply the fps
> filter after setpts it not duplicate any frames.

Sure?

I mean: It may or may not duplicate frames but contrary to "-r"
the console output will not tell you.

As Moritz wrote: If your input is cfr, you only need setpts,
fps is needed just in case an initial or final frame is missing.
If your input is not cfr, setpts may or may not work
correctly but you need fps (or -r) to create cfr video
which the mp4 muxer expects.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

Jon bae
Am Mo., 13. Mai 2019 um 15:29 Uhr schrieb Carl Eugen Hoyos <
[hidden email]>:

> Am Mo., 13. Mai 2019 um 15:05 Uhr schrieb Jon bae <[hidden email]>:
> >
> > Am Mo., 13. Mai 2019 um 14:34 Uhr schrieb Carl Eugen Hoyos <
> > [hidden email]>:
> >
> > > Am Mo., 13. Mai 2019 um 14:31 Uhr schrieb Michael Koch
> > > <[hidden email]>:
> > >
> > > > > Or the fps filter.
> > > > > This filter and the r option have different algorithms that have
> > > > > advantages (and disadvantages) in different situations.
> > > >
> > > > Are the differences explained somewhere in the documentation?
> > >
> > > Not to my knowledge, them main difference is that the filter is
> > > more greedy.
> > >
> > > Carl Eugen
> > >
> > >
> > Sorry Carl Eugen - you are right. I did a test, and when I apply the fps
> > filter after setpts it not duplicate any frames.
>
> Sure?
>
> I mean: It may or may not duplicate frames but contrary to "-r"
> the console output will not tell you.
>
> As Moritz wrote: If your input is cfr, you only need setpts,
> fps is needed just in case an initial or final frame is missing.
> If your input is not cfr, setpts may or may not work
> correctly but you need fps (or -r) to create cfr video
> which the mp4 muxer expects.
>
> At least by my test file the fps filter has not duplicate frames, when I
add it after setpts. In my tests I have to use fps filter or the -r option,
when I don't use them I get no 25 fps in my output file.
I think we mostly deal with crf files.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

Gyan
In reply to this post by Carl Eugen Hoyos-2


On 13-05-2019 06:59 PM, Carl Eugen Hoyos wrote:

> Am Mo., 13. Mai 2019 um 15:05 Uhr schrieb Jon bae <[hidden email]>:
>> Am Mo., 13. Mai 2019 um 14:34 Uhr schrieb Carl Eugen Hoyos <
>> [hidden email]>:
>>
>>> Am Mo., 13. Mai 2019 um 14:31 Uhr schrieb Michael Koch
>>> <[hidden email]>:
>>>
>>>>> Or the fps filter.
>>>>> This filter and the r option have different algorithms that have
>>>>> advantages (and disadvantages) in different situations.
>>>> Are the differences explained somewhere in the documentation?
>>> Not to my knowledge, them main difference is that the filter is
>>> more greedy.
>>>
>>> Carl Eugen
>>>
>>>
>> Sorry Carl Eugen - you are right. I did a test, and when I apply the fps
>> filter after setpts it not duplicate any frames.
> Sure?
>
> I mean: It may or may not duplicate frames but contrary to "-r"
> the console output will not tell you.
>
> As Moritz wrote: If your input is cfr, you only need setpts,

For vsync cfr, ffmpeg will still duplicate and/or drop frames based on
the framerate obtained from the filter buffersink. So fps or -r is 
needed to modify that.

Gyan
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

FFmpeg-users mailing list
In reply to this post by Carl Eugen Hoyos-2


> On 13 May 2019, at 13:40, Carl Eugen Hoyos <[hidden email]> wrote:
>
> Am Mo., 13. Mai 2019 um 13:36 Uhr schrieb Daniel Oberhoff via
> ffmpeg-user <[hidden email]>:
>>
>>
>>>
>>> You can not.
>>
>> I am curious what exactly the hindrance is. As I understand at least mp4 there is not really a concept of frame rate in the file and in theory every frame can have a different „rate“, defined solely by pts.
>
> FFmpeg's mp4 muxer does not support variable frame rate.

Oh, how so? From what I understand about mp4 it does not even contain frame rate in the metadata. For us this effectively means we cannot use mp4, since some of our sources are not very stable in their frame timing.
So does the muxer ignore the incoming frame pts and just imprint monotonic pts with the given frame rate?

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: filter for changing frame rate

Carl Eugen Hoyos-2
Am Mi., 15. Mai 2019 um 14:10 Uhr schrieb Daniel Oberhoff via
ffmpeg-user <[hidden email]>:

>
> > On 13 May 2019, at 13:40, Carl Eugen Hoyos <[hidden email]> wrote:
> >
> > Am Mo., 13. Mai 2019 um 13:36 Uhr schrieb Daniel Oberhoff via
> > ffmpeg-user <[hidden email]>:
> >>
> >>> You can not.
> >>
> >> I am curious what exactly the hindrance is. As I understand at
> >> least mp4 there is not really a concept of frame rate in the file
> >> and in theory every frame can have a different „rate“, defined
> >> solely by pts.
> >
> > FFmpeg's mp4 muxer does not support variable frame rate.
>
> Oh, how so? From what I understand about mp4 it does not even
> contain frame rate in the metadata.

> For us this effectively means we cannot use mp4, since some
> of our sources are not very stable in their frame timing.

Patch welcome, consider to contact Baptiste Coudurier.

> So does the muxer ignore the incoming frame pts and just
> imprint monotonic pts with the given frame rate?

No, it (allegedly) writes invalid files if you send it vfr frames.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".