Queues

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

Queues

ldac

   Hi all,

I am launching the following pipe to record audio and video into an AVI file. When I stop the pipeline and I play the file, audio goes too fast and video has some interruptions and also goes faster. But if I run "half" pipeline just with the audio goes fine, and the other half with the video too ...

gst-launch-0.10 v4lsrc capture-width=720 capture-height=576 fps-n=25 fps-d=1 ! \
   'video/x-raw-yuv,width=720,heigh=576,framerate=(fraction)25/1' ! \
   videoencoder width=720 height=576 codec-type=std_avc qp=20 ! h264parse ! mux.\
   alsasrc ! ffenc_mp2 ! mux. \
   avimux name=mux ! filesink location=test.avi

    I guess that "queues" can fix the problem, but I have tried placing them in some positions, but without improvement. Could someone tell me how/where/why should I use/place the "queues"??? Is there something else wrong "conceptually" talking? Which clock are both branches (video and audio) using? Is a muxer problem?

    Thanks.
    All the best.
    LD.




------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Queues

Wim Taymans
On Wed, 2009-06-03 at 11:17 +0200, ldac wrote:

>
>    Hi all,
>
> I am launching the following pipe to record audio and video into an
> AVI file. When I stop the pipeline and I play the file, audio goes too
> fast and video has some interruptions and also goes faster. But if I
> run "half" pipeline just with the audio goes fine, and the other half
> with the video too ...
>
> gst-launch-0.10 v4lsrc capture-width=720 capture-height=576 fps-n=25
> fps-d=1 ! \
>    'video/x-raw-yuv,width=720,heigh=576,framerate=(fraction)25/1' ! \
>    videoencoder width=720 height=576 codec-type=std_avc qp=20 !
> h264parse ! mux.\
>    alsasrc ! ffenc_mp2 ! mux. \
>    avimux name=mux ! filesink location=test.avi
>
>     I guess that "queues" can fix the problem, but I have tried
> placing them in some positions, but without improvement. Could someone
> tell me how/where/why should I use/place the "queues"??? Is there
> something else wrong "conceptually" talking? Which clock are both
> branches (video and audio) using? Is a muxer problem?

You are probably not shutting down the pipeline cleanly (you need to
send EOS down the pipeline before shutting it down so that the muxer can
write the headers correctly).

Newer gst-launch versions also have the -e option to perform controlled
shutdown.

Wim

>
>     Thanks.
>     All the best.
>     LD.
>
>
>
> ------------------------------------------------------------------------------
> OpenSolaris 2009.06 is a cutting edge operating system for enterprises
> looking to deploy the next generation of Solaris that includes the latest
> innovations from Sun and the OpenSource community. Download a copy and
> enjoy capabilities such as Networking, Storage and Virtualization.
> Go to: http://p.sf.net/sfu/opensolaris-get
> _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Queues

ldac

    Thanks Wim,

I have implemented that pipeline in C code, and I try to do a clean shut down for the pipeline as you have suggested me (I am not able to use the last command-line version with -c option) with no improvement. But I am almost sure that you're right and my problem is that I am doing wrong the EOS propagation throught the pipeline.

    I do this to stop the pipeline (when I press certain key):

GstEvent* eos_event = NULL;
eos_event = gst_event_new_eos( );
r = gst_element_send_event( pipeline, eos_event );

    Where the code that is running is:

pipeline = gst_pipeline_new( "pipe" );
video_src = gst_element_factory_make( "v4lsrc", "video-source" );
.....
audio_src = gst_element_factory_make( "alsasrc", "audio-source" );
.....
gst_bin_add_many( GST_BIN( pipeline ), video_src, video_enc, video_parse, audio_src, audio_enc, muxer, sink, NULL );
gst_element_link_with_filter( video_src, video_enc );
gst_element_link( video_enc, video_parse );
.....
gst_element_set_state( gpipeline, GST_STATE_PLAYING );
g_main_loop_run( gloop );
.....

    Should I send the EOS in other way??? I am doing something wrong???

    Thank you very much.
    LD.


Wim Taymans wrote:
On Wed, 2009-06-03 at 11:17 +0200, ldac wrote:
  
   Hi all,

I am launching the following pipe to record audio and video into an
AVI file. When I stop the pipeline and I play the file, audio goes too
fast and video has some interruptions and also goes faster. But if I
run "half" pipeline just with the audio goes fine, and the other half
with the video too ...

gst-launch-0.10 v4lsrc capture-width=720 capture-height=576 fps-n=25
fps-d=1 ! \
   'video/x-raw-yuv,width=720,heigh=576,framerate=(fraction)25/1' ! \
   videoencoder width=720 height=576 codec-type=std_avc qp=20 !
h264parse ! mux.\
   alsasrc ! ffenc_mp2 ! mux. \
   avimux name=mux ! filesink location=test.avi

    I guess that "queues" can fix the problem, but I have tried
placing them in some positions, but without improvement. Could someone
tell me how/where/why should I use/place the "queues"??? Is there
something else wrong "conceptually" talking? Which clock are both
branches (video and audio) using? Is a muxer problem?
    

You are probably not shutting down the pipeline cleanly (you need to
send EOS down the pipeline before shutting it down so that the muxer can
write the headers correctly).

Newer gst-launch versions also have the -e option to perform controlled
shutdown.

Wim
  
    Thanks.
    All the best.
    LD.



------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
    


------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
  


------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Queues

Wim Taymans
On Wed, 2009-06-03 at 17:18 +0200, ldac wrote:

>
>     Thanks Wim,
>
> I have implemented that pipeline in C code, and I try to do a clean
> shut down for the pipeline as you have suggested me (I am not able to
> use the last command-line version with -c option) with no improvement.
> But I am almost sure that you're right and my problem is that I am
> doing wrong the EOS propagation throught the pipeline.
>
>     I do this to stop the pipeline (when I press certain key):
>
> GstEvent* eos_event = NULL;
> eos_event = gst_event_new_eos( );
> r = gst_element_send_event( pipeline, eos_event );
>
>     Where the code that is running is:
>
> pipeline = gst_pipeline_new( "pipe" );
> video_src = gst_element_factory_make( "v4lsrc", "video-source" );
> .....
> audio_src = gst_element_factory_make( "alsasrc", "audio-source" );
> .....
> gst_bin_add_many( GST_BIN( pipeline ), video_src, video_enc,
> video_parse, audio_src, audio_enc, muxer, sink, NULL );
> gst_element_link_with_filter( video_src, video_enc );
> gst_element_link( video_enc, video_parse );
> .....
> gst_element_set_state( gpipeline, GST_STATE_PLAYING );
> g_main_loop_run( gloop );
> .....
>
>     Should I send the EOS in other way??? I am doing something
> wrong???
>
After sending the EOS to the pipeline, wait for the EOS message to
appear on the bus before setting the pipeline to NULL. This makes sure
all data is processed in the pipeline and you can safely shut it down.

Wim


>     Thank you very much.
>     LD.
>
>
> Wim Taymans wrote:
> > On Wed, 2009-06-03 at 11:17 +0200, ldac wrote:
> >  
> > > Hi all,
> > >
> > > I am launching the following pipe to record audio and video into an
> > > AVI file. When I stop the pipeline and I play the file, audio goes too
> > > fast and video has some interruptions and also goes faster. But if I
> > > run "half" pipeline just with the audio goes fine, and the other half
> > > with the video too ...
> > >
> > > gst-launch-0.10 v4lsrc capture-width=720 capture-height=576 fps-n=25
> > > fps-d=1 ! \
> > >    'video/x-raw-yuv,width=720,heigh=576,framerate=(fraction)25/1' ! \
> > >    videoencoder width=720 height=576 codec-type=std_avc qp=20 !
> > > h264parse ! mux.\
> > >    alsasrc ! ffenc_mp2 ! mux. \
> > >    avimux name=mux ! filesink location=test.avi
> > >
> > >     I guess that "queues" can fix the problem, but I have tried
> > > placing them in some positions, but without improvement. Could someone
> > > tell me how/where/why should I use/place the "queues"??? Is there
> > > something else wrong "conceptually" talking? Which clock are both
> > > branches (video and audio) using? Is a muxer problem?
> > >    
> >
> > You are probably not shutting down the pipeline cleanly (you need to
> > send EOS down the pipeline before shutting it down so that the muxer can
> > write the headers correctly).
> >
> > Newer gst-launch versions also have the -e option to perform controlled
> > shutdown.
> >
> > Wim
> >  
> > > Thanks.
> > >     All the best.
> > >     LD.
> > >
> > >
> > >
> > > ------------------------------------------------------------------------------
> > > OpenSolaris 2009.06 is a cutting edge operating system for enterprises
> > > looking to deploy the next generation of Solaris that includes the latest
> > > innovations from Sun and the OpenSource community. Download a copy and
> > > enjoy capabilities such as Networking, Storage and Virtualization.
> > > Go to: http://p.sf.net/sfu/opensolaris-get
> > > _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> > >    
> >
> >
> > ------------------------------------------------------------------------------
> > OpenSolaris 2009.06 is a cutting edge operating system for enterprises
> > looking to deploy the next generation of Solaris that includes the latest
> > innovations from Sun and the OpenSource community. Download a copy and
> > enjoy capabilities such as Networking, Storage and Virtualization.
> > Go to: http://p.sf.net/sfu/opensolaris-get
> > _______________________________________________
> > gstreamer-devel mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> >  
>
> ------------------------------------------------------------------------------
> OpenSolaris 2009.06 is a cutting edge operating system for enterprises
> looking to deploy the next generation of Solaris that includes the latest
> innovations from Sun and the OpenSource community. Download a copy and
> enjoy capabilities such as Networking, Storage and Virtualization.
> Go to: http://p.sf.net/sfu/opensolaris-get
> _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Queues

ldac
In reply to this post by Wim Taymans
    Hi all,

it seems that problem was not the EOS signal. I have introduced an sleep after sending the signal and the resulting AVI is the same.

    Moreover, I have replaced the "avimux ! filesink" by an "flutsmux ! udpsink" to stream the audio and video, but the receiver watches/sees a video/audio full of interruptions (like the recorded AVI). So problem  seems to be something about the sincrhonization between the two branches of the pipeline (or maybe that the PC can not do both things at the same time? I don't think so but ...) and the flutsmux element.

    I have added one queue after the alsasrc and another one after the videosrc, without any improvement.

    Any idea is welcome!

    Thanks in any case.
    LD.



Wim Taymans wrote:
On Wed, 2009-06-03 at 11:17 +0200, ldac wrote:
  
   Hi all,

I am launching the following pipe to record audio and video into an
AVI file. When I stop the pipeline and I play the file, audio goes too
fast and video has some interruptions and also goes faster. But if I
run "half" pipeline just with the audio goes fine, and the other half
with the video too ...

gst-launch-0.10 v4lsrc capture-width=720 capture-height=576 fps-n=25
fps-d=1 ! \
   'video/x-raw-yuv,width=720,heigh=576,framerate=(fraction)25/1' ! \
   videoencoder width=720 height=576 codec-type=std_avc qp=20 !
h264parse ! mux.\
   alsasrc ! ffenc_mp2 ! mux. \
   avimux name=mux ! filesink location=test.avi

    I guess that "queues" can fix the problem, but I have tried
placing them in some positions, but without improvement. Could someone
tell me how/where/why should I use/place the "queues"??? Is there
something else wrong "conceptually" talking? Which clock are both
branches (video and audio) using? Is a muxer problem?
    

You are probably not shutting down the pipeline cleanly (you need to
send EOS down the pipeline before shutting it down so that the muxer can
write the headers correctly).

Newer gst-launch versions also have the -e option to perform controlled
shutdown.

Wim
  
    Thanks.
    All the best.
    LD.



------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
    


------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
  


------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel