[Libav-user] Replacement for release_buffer

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

[Libav-user] Replacement for release_buffer

Info || Non-Lethal Applications
I’m fairly new to ffmpeg. Thus, I worked through the excellent tutorials of Stephen Dranger.
In his tutorial number 5, he presents a method to get the correct pts of a given frame.

This involves setting a custom get_buffer and release_buffer function to the AVCodecContext.
As both of these are now deprecated, I used get_buffer2 but I couldn’t get a replacement for release_buffer.

Could anyone point me in the right direction?

Thanks!

Best,

Flo

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
wm4
Reply | Threaded
Open this post in threaded view
|

Re: Replacement for release_buffer

wm4
On Thu, 27 Mar 2014 22:37:35 +0100
Info || Non-Lethal Applications <[hidden email]>
wrote:

> I’m fairly new to ffmpeg. Thus, I worked through the excellent tutorials of Stephen Dranger.
> In his tutorial number 5, he presents a method to get the correct pts of a given frame.
>
> This involves setting a custom get_buffer and release_buffer function to the AVCodecContext.
> As both of these are now deprecated, I used get_buffer2 but I couldn’t get a replacement for release_buffer.
>
> Could anyone point me in the right direction?

You don't need get_buffer/release_buffer to get the PTS. The tutorial
is probably hopelessly outdated (as the FFmpeg API moves fast), and
will do more damage than it helps in any way.

If you really want to use get_buffer2 (which you probably don't), then
read the comment surrounding it: you need to setup an AVBuffer
reference, which is released when the frame is released.

If you just want the PTS, look at AVFrame.pkt_pts and pkt_dts.
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Replacement for release_buffer

Lou Logan
In reply to this post by Info || Non-Lethal Applications
On Thu, 27 Mar 2014 22:37:35 +0100
Info || Non-Lethal Applications <[hidden email]>
wrote:

> I’m fairly new to ffmpeg. Thus, I worked through the excellent tutorials of Stephen Dranger.

An updated version of that tutorial is:
https://github.com/chelyaev/ffmpeg-tutorial
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Replacement for release_buffer

Info || Non-Lethal Applications
I have seen this update but it also still uses both a custom get_buffer (the tut was updated to use get_buffer2) and a custom release_buffer.

My custom get_buffer is called but the release_buffer is not. Thus, I'm allocating memory I can't free (or at least I wouldn't know where the best place would be).

Stephen Dranger wrote that there are certain circumstances where the pts is not correct and thus he introduced this get/release buffer workaround to always retrieve a correct pts.

Can anyone tell me if this is still required? I'd just like to be sure to always get the correct pts.

Thanks!



On 28.03.2014, at 00:04, Lou <[hidden email]> wrote:

On Thu, 27 Mar 2014 22:37:35 +0100
Info || Non-Lethal Applications <[hidden email]>
wrote:

I’m fairly new to ffmpeg. Thus, I worked through the excellent tutorials of Stephen Dranger.

An updated version of that tutorial is:
https://github.com/chelyaev/ffmpeg-tutorial
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user

_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
wm4
Reply | Threaded
Open this post in threaded view
|

Re: Replacement for release_buffer

wm4
On Fri, 28 Mar 2014 00:16:03 +0100
Info || Non-Lethal Applications <[hidden email]>
wrote:

> I have seen this update but it also still uses both a custom get_buffer (the tut was updated to use get_buffer2) and a custom release_buffer.

It combines get_buffer2 with release_buffer, which is complete
non-sense. Now I don't want to talk badly about them, but I wouldn't
try to learn from a tutorial from people who don't know what they're
doing. The best way to guess how ffmpeg is supposed to work is probably
still looking at ffplay.c.

> My custom get_buffer is called but the release_buffer is not. Thus, I'm allocating memory I can't free (or at least I wouldn't know where the best place would be).

get_buffer is legacy, and get_buffer2 is not used with release_buffer.

> Stephen Dranger wrote that there are certain circumstances where the pts is not correct and thus he introduced this get/release buffer workaround to always retrieve a correct pts.
>
> Can anyone tell me if this is still required? I'd just like to be sure to always get the correct pts.

No.
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: Replacement for release_buffer

Harald Schlangmann
On 28.03.2014, at 00:29, wm4 <[hidden email]> wrote:

>> Stephen Dranger wrote that there are certain circumstances where the pts is not correct and thus he introduced this get/release buffer workaround to always retrieve a correct pts.
>>
>> Can anyone tell me if this is still required? I'd just like to be sure to always get the correct pts.
>
> No.

The correct way to retrieve the pts is av_frame_get_best_effort_timestamp now, correct?

- Harald

-
Harald Schlangmann
Antwerpener Str. 52, 50672 Köln, Germany
+49 151 2265 4439
[hidden email]
www.gps-laptimer.de


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

smime.p7s (5K) Download Attachment
wm4
Reply | Threaded
Open this post in threaded view
|

Re: Replacement for release_buffer

wm4
On Fri, 28 Mar 2014 09:17:06 +0100
Harald Schlangmann <[hidden email]> wrote:

> On 28.03.2014, at 00:29, wm4 <[hidden email]> wrote:
>
> >> Stephen Dranger wrote that there are certain circumstances where the pts is not correct and thus he introduced this get/release buffer workaround to always retrieve a correct pts.
> >>
> >> Can anyone tell me if this is still required? I'd just like to be sure to always get the correct pts.
> >
> > No.
>
> The correct way to retrieve the pts is av_frame_get_best_effort_timestamp now, correct?

Yes, but it's better to determine it from pkt_pts and pkt_dts, because
best_effort_timestamp doesn't exist on Libav.
_______________________________________________
Libav-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/libav-user