ffmpeg muxers - index not written in the result file

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

ffmpeg muxers - index not written in the result file

Julien Isorce
Hi

I join to this mail a simple test.

The test demonstrates that when the pipeline is stopped when sending eos from the client code, then ffmux_asf does not write the index, so it's not possible to seek when playing back the result file.
If I set num_buffers=N instead of sending eos, then the muxer write the index.

Yes it should be the same result because when GstBaseSrc reachs num_buffers_left = 0 then it return GST_FLOW_UNEXPECTED then an EOS is generated.

So something is not flushed when ffmux receive eos in the first way.

Is it a bug from gstffmpegmux or a problem in ffmpeg-asfmux-libavcodec ? or something else ?

( ./test 0 rec.asf   -> index not written)  (eos sent from a g_timeout_add callback)
( ./test 1 rec.asf   -> asf correclty generated)  (use num_buffers=N)

Sincerely

Julien

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

test.cpp (5K) Download Attachment
Makefile (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg muxers - index not written in the result file

Mark Nauwelaerts-2

It is something else; a problem in your approach.
There is a difference between an EOS event (an event that travels downstream in
the pipeline) and and EOS message (that is posted on the pipeline's bus).
The latter is typically posted as a *result* of all sinks in the pipeline having
received an EOS event).
However, simply posting an EOS message will not make sinks (or upstream elements
such as muxer) magically receive some EOS event.  Sending an EOS event (instead
of having basesrc do it after N buffers) could alternatively be achieved by
sending an EOS event downstream from a buffer probe callback, or pad block
callback, or etc (likely with some caution), or by some other (than basesrc)
element in the pipeline (e.g. entrans' dam).

Mark.

Julien Isorce wrote:

> Hi
>
> I join to this mail a simple test.
>
> The test demonstrates that when the pipeline is stopped when sending eos
> from the client code, then ffmux_asf does not write the index, so it's
> not possible to seek when playing back the result file.
> If I set num_buffers=N instead of sending eos, then the muxer write the
> index.
>
> Yes it should be the same result because when GstBaseSrc reachs
> num_buffers_left = 0 then it return GST_FLOW_UNEXPECTED then an EOS is
> generated.
>
> So something is not flushed when ffmux receive eos in the first way.
>
> Is it a bug from gstffmpegmux or a problem in ffmpeg-asfmux-libavcodec ?
> or something else ?
>
> ( ./test 0 rec.asf   -> index not written)  (eos sent from a
> g_timeout_add callback)
> ( ./test 1 rec.asf   -> asf correclty generated)  (use num_buffers=N)
>
> Sincerely
>
> Julien
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg muxers - index not written in the result file

Julien Isorce
In reply to this post by Julien Isorce
Launching the test in first and second way, with GST_DEBUG:ffmpeg:5

I can see that with "./test 1 rec.asf" then "gst_ffmpegenc_flush_buffers" is called woth param TRUE whereas in the second way the parameter is FALSE.

So I think the last buffer, which contains index informations maybe, is not sent to the muxer and so not written into the result file.

Why a such distinction in "gst_ffmpegenc_flush_buffers" (param send 0/1)  ?

Sincerely

Julien

2008/11/25 Julien Isorce <[hidden email]>
Hi

I join to this mail a simple test.

The test demonstrates that when the pipeline is stopped when sending eos from the client code, then ffmux_asf does not write the index, so it's not possible to seek when playing back the result file.
If I set num_buffers=N instead of sending eos, then the muxer write the index.

Yes it should be the same result because when GstBaseSrc reachs num_buffers_left = 0 then it return GST_FLOW_UNEXPECTED then an EOS is generated.

So something is not flushed when ffmux receive eos in the first way.

Is it a bug from gstffmpegmux or a problem in ffmpeg-asfmux-libavcodec ? or something else ?

( ./test 0 rec.asf   -> index not written)  (eos sent from a g_timeout_add callback)
( ./test 1 rec.asf   -> asf correclty generated)  (use num_buffers=N)

Sincerely

Julien


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg muxers - index not written in the result file

Wim Taymans
In reply to this post by Julien Isorce
On Tue, 2008-11-25 at 12:02 +0100, Julien Isorce wrote:
> Hi
>
> I join to this mail a simple test.
>
> The test demonstrates that when the pipeline is stopped when sending
> eos from the client code, then ffmux_asf does not write the index, so
> it's not possible to seek when playing back the result file.

You are not sending an EOS event but (forcefully) posting an EOS message
from the pipeline to the application.

> If I set num_buffers=N instead of sending eos, then the muxer write
> the index.
>
> Yes it should be the same result because when GstBaseSrc reachs
> num_buffers_left = 0 then it return GST_FLOW_UNEXPECTED then an EOS is
> generated.
>
> So something is not flushed when ffmux receive eos in the first way.

ffmux never receives EOS because there is no such event generated.

>
> Is it a bug from gstffmpegmux or a problem in
> ffmpeg-asfmux-libavcodec ? or something else ?

It's a bug in the application.

Wim

>
> ( ./test 0 rec.asf   -> index not written)  (eos sent from a
> g_timeout_add callback)
> ( ./test 1 rec.asf   -> asf correclty generated)  (use num_buffers=N)
>
> Sincerely
>
> Julien
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg muxers - index not written in the result file

Julien Isorce
Oh ok :P

The following is ok now:

GstEvent *eos = gst_event_new_eos ();
gst_element_send_event (pipeline , eos);

Thx a lot, you resolved me a thing I am doing wrong for a while

Julien

2008/11/25 Wim Taymans <[hidden email]>
On Tue, 2008-11-25 at 12:02 +0100, Julien Isorce wrote:
> Hi
>
> I join to this mail a simple test.
>
> The test demonstrates that when the pipeline is stopped when sending
> eos from the client code, then ffmux_asf does not write the index, so
> it's not possible to seek when playing back the result file.

You are not sending an EOS event but (forcefully) posting an EOS message
from the pipeline to the application.

> If I set num_buffers=N instead of sending eos, then the muxer write
> the index.
>
> Yes it should be the same result because when GstBaseSrc reachs
> num_buffers_left = 0 then it return GST_FLOW_UNEXPECTED then an EOS is
> generated.
>
> So something is not flushed when ffmux receive eos in the first way.

ffmux never receives EOS because there is no such event generated.

>
> Is it a bug from gstffmpegmux or a problem in
> ffmpeg-asfmux-libavcodec ? or something else ?

It's a bug in the application.

Wim
>
> ( ./test 0 rec.asf   -> index not written)  (eos sent from a
> g_timeout_add callback)
> ( ./test 1 rec.asf   -> asf correclty generated)  (use num_buffers=N)
>
> Sincerely
>
> Julien
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel