[Libav-user] FFMPEG CustomIO Seeking

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

[Libav-user] FFMPEG CustomIO Seeking

Alexis
Hi there,

I'm using FFMPEG (with a custom IO, so not a file but byte as input) to decode video in my software.

So when I seek with MY software, i just send corresponding bytes to the decoder, how can i tell to my decoder that i seeked?

When i seek i flush the buffer with:
avcodec_send_packet()  with null as packet to enter in the draining mode
and read until EOF
then avcodec_flush_buffers

It looks like it clean properly.

Then come the real problem, the next frame given by the decoder have a timestamp corresponding to before the seek, I guess the decoder have an incomplete frame in his own buffer waiting to be completed before outputting it, but how can i clear this?

I'm missing something?

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

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

Re: FFMPEG CustomIO Seeking

MSC_Edge
What do you mean by "when you seek with MY software"?

And I don't think it is, but if what you mean is that you want to act when your software makes a call to ffmpeg that causes it to seek. You can set up a "AVIOContext::seek" callback that will tell you details about that callback:
https://www.ffmpeg.org/doxygen/3.1/structAVIOContext.html#a0b4f06675c3ea2df5b455bd3334244fe

-Matt

On Sat, Feb 22, 2020 at 5:15 AM Alexis <[hidden email]> wrote:
Hi there,

I'm using FFMPEG (with a custom IO, so not a file but byte as input) to decode video in my software.

So when I seek with MY software, i just send corresponding bytes to the decoder, how can i tell to my decoder that i seeked?

When i seek i flush the buffer with:
avcodec_send_packet()  with null as packet to enter in the draining mode
and read until EOF
then avcodec_flush_buffers

It looks like it clean properly.

Then come the real problem, the next frame given by the decoder have a timestamp corresponding to before the seek, I guess the decoder have an incomplete frame in his own buffer waiting to be completed before outputting it, but how can i clear this?

I'm missing something?
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

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


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

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

Re: FFMPEG CustomIO Seeking

Alexis
To explain it fast, it's kinda like a video player which read from various
entry, like ethernet or file like pcap, MPG, ...

So to use only one input I use byte to feed the video decoder.

When i seek with my software i just move the pointer in the file ton send
corresponding bytes.
Little exemple, if i want to play vidéo at his mid, i'll just send byte from
the half of the file.. the decoder don't know it.


I didnt use seek because I didnt implement a seek callback since i'm not
mapping all the whole file, so there is no stream reset or seek

I'm using a queue which hold byte array as the read callback.

The strange thing is after seek, av_read_frame give me packets from before
the seek.
I tried avcodec_flush_buffer and avio_flush but both does nothing.
I'm even ending null through avcodec_send_packet to enter the draining mode
and receive util EOF but still not enough

I looked on the web and it's seems many people face the same issue like me

Hope you will be able to give me a hint



--
Sent from: http://libav-users.943685.n4.nabble.com/
_______________________________________________
Libav-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/libav-user

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