Re: [osg-users] osgmovie/ffmpeg plugin questions

2009-04-10 Thread Robert Osfield
Hi JS,

I don't see any delay when I've been using the Linux webcam streaming.
Stream over the http I did find a delay and I presume this was down the
plugin/ffmpeg pulling down a block of data that it could then start
processing.

One thing you could look into syncronization between the audio and video
streams, perhaps this is introducing issues.

Robert.

On Fri, Apr 10, 2009 at 2:46 PM, Jean-Sébastien Guay 
jean-sebastien.g...@cm-labs.com wrote:

 Hi all,

 I need to integrate streaming video into our app, and I started playing
 around with osgmovie and the ffmpeg plugin. I have the beginnings of some
 modifications to get ffmpeg to read rtsp and http streams, as well as
 detecting the input format from the extension (at least a list of them), but
 I'm getting some weird behavior, and I would like to know if someone has
 seen this, and if someone has any ideas for what to do about it.

 First, the video seems to have a delay at the start (about 5 seconds
 between when I move my arm and when I see my arm move on screen), but it
 seems to catch up after 15-20 seconds (there seems to be almost no delay
 at that point). Any idea what could cause that? Did you see this in your
 tests of streaming?

 Second, I can't say what happens after 15-20 seconds, because the video
 stops refreshing. Is there a fixed buffer size somewhere that could cause
 this? I have to restart the application to see video again, even pressing
 'p' or 'r' doesn't change anything.

 Any ideas?

 Other than that, it seems to work mostly as advertized and looks great. I'm
 using it with an mjpeg stream over http and it runs great.

 Thanks,

 J-S
 --
 __
 Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgmovie/ffmpeg plugin questions

2009-04-10 Thread Jean-Sébastien Guay

Hi Robert,

I don't see any delay when I've been using the Linux webcam streaming.  
Stream over the http I did find a delay and I presume this was down the 
plugin/ffmpeg pulling down a block of data that it could then start 
processing.


Hmmm, perhaps that explains the fixed stream time as well? Perhaps when 
streaming from http it pulls down a fixed block of data and then stops...


I've been trying to get streaming through rtsp working as well, but it 
doesn't seem to want to. I'll continue looking, but the ffmpeg 
documentation is not very impressive...


One thing you could look into syncronization between the audio and video 
streams, perhaps this is introducing issues.


I don't want to use audio at all, perhaps there's a way to disable that, 
and the issue would go away?


Thanks,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgmovie/ffmpeg plugin questions

2009-04-10 Thread Robert Osfield
Hi JS,

On Fri, Apr 10, 2009 at 3:14 PM, Jean-Sébastien Guay 
jean-sebastien.g...@cm-labs.com wrote:

 Hmmm, perhaps that explains the fixed stream time as well? Perhaps when
 streaming from http it pulls down a fixed block of data and then stops...

 I've been trying to get streaming through rtsp working as well, but it
 doesn't seem to want to. I'll continue looking, but the ffmpeg documentation
 is not very impressive...


Well the docs are better than when I first looked at ffmpeg a number of
years back ;-)

I haven't yet subscribed to the support list, but this is probably worth
doing.


  One thing you could look into syncronization between the audio and video
 streams, perhaps this is introducing issues.


 I don't want to use audio at all, perhaps there's a way to disable that,
 and the issue would go away?


If you aren't using audio then I don't think the plugin does any sync.
Perhaps Tanguy can clarify this.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgmovie/ffmpeg plugin questions

2009-04-10 Thread Jason Daly

Jean-Sébastien Guay wrote:
Well, it's hard to get some technical info from what docs there seem to 
be. Things like what formats are supported read/write/readwrite, what 
the format strings are for av_find_input_format, etc. I needed to go 
to the code for those things (avformat/allformats.c).
  


Try runing ffmpeg -formats.  This shows the available formats and 
containers.  On the left of each you'll see D for decode and E for 
encode.  For the codecs it will also show A for audio and V for video.  
I don't remember what the last S and/or D stands for.


Note that these are the available formats.  It won't show formats for 
which it doesn't have support compiled in.



I'm also wondering how to specify the actual format of an rtsp feed. I 
have a URL of the form


 rtsp://xx.xx.xx.xx:554/img/media.sav

and for ffmpeg to be able to read that, I need to set the format to 
rtsp, but I know that the video is actually in mpeg-4. ffmpeg doesn't 
seem to automatically figure that out, because even though data is 
transferred, no image shows up (I'm guessing the decoder can't read the 
data it gets from the camera because it thinks it's in some other 
format). Do I have some way of telling it this is mpeg-4 over rtsp?


I would have thought rtsp would be a protocol and not a codec, but 
looking at avformat/allformats.c, it's set up as a demuxer:


 REGISTER_DEMUXER  (RTSP, rtsp);
  


Demuxer kind of makes sense.  RTSP will probably act like any other 
transport/program container (.mpg or .ogg file, for example).  The audio 
and video will still have to be separated out into elementary streams, 
even if there is only one elementary stream present.


--J

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgmovie/ffmpeg plugin questions

2009-04-10 Thread Jason Daly

Jean-Sébastien Guay wrote:
Well, it's hard to get some technical info from what docs there seem to 
be. Things like what formats are supported read/write/readwrite, what 
the format strings are for av_find_input_format, etc. I needed to go 
to the code for those things (avformat/allformats.c).


I'm also wondering how to specify the actual format of an rtsp feed. I 
have a URL of the form


 rtsp://xx.xx.xx.xx:554/img/media.sav

and for ffmpeg to be able to read that, I need to set the format to 
rtsp, but I know that the video is actually in mpeg-4. ffmpeg doesn't 
seem to automatically figure that out, because even though data is 
transferred, no image shows up (I'm guessing the decoder can't read the 
data it gets from the camera because it thinks it's in some other 
format). Do I have some way of telling it this is mpeg-4 over rtsp?
  


Sorry, I didn't answer this part.  In your case, RTSP is going to be a 
container (demuxer, as you found out), containing interleaved elementary 
streams of audio and/or video (just like an .avi, .mpg, or .ogg file).


Once you enumerate the streams (av_find_stream_info() ), you'll then be 
able to instantiate the codec to decode them.


--J
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgmovie/ffmpeg plugin questions

2009-04-10 Thread Jean-Sébastien Guay

Hi Jason,

Try runing ffmpeg -formats.  This shows the available formats and 
containers.  On the left of each you'll see D for decode and E for 
encode.  For the codecs it will also show A for audio and V for video.  
I don't remember what the last S and/or D stands for.


Note that these are the available formats.  It won't show formats for 
which it doesn't have support compiled in.


Interesting, that would have been useful before I got the source and 
found out where the support for all formats is initialized... :-)


Demuxer kind of makes sense.  RTSP will probably act like any other 
transport/program container (.mpg or .ogg file, for example).  The audio 
and video will still have to be separated out into elementary streams, 
even if there is only one elementary stream present.


Sure, but then is there a way to specify what the internal stream format 
is? Because it doesn't seem to detect that my RTSP stream is MPEG-4 (at 
least osgmovie with my slightly modified ffmpeg plugin doesn't show 
anything).


Also, do you have any experience with the ffmpeg api itself? I'm 
wondering what kind of error handling there is, to be able to better 
recover from bad format errors or such.


J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgmovie/ffmpeg plugin questions

2009-04-10 Thread Jason Daly

Jean-Sébastien Guay wrote:
Also, do you have any experience with the ffmpeg api itself? I'm 
wondering what kind of error handling there is, to be able to better 
recover from bad format errors or such.
  


I have some, although I never got into live streaming like you're 
trying.  Also, my experience is with ffmpeg from about 3 years ago  :-)


Most of the av_* and avcodec_* functions return error codes.  If the 
error code was negative, badness happened, and I bailed.  That's about 
the limit of the error handling I've done.  If you actually examine the 
error codes, you might be able to handle them more intelligently.  I 
never had the need, so I'm not sure.


--J

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgmovie/ffmpeg plugin questions

2009-04-10 Thread Jean-Sébastien Guay

Hi Jason,

Most of the av_* and avcodec_* functions return error codes.  If the 
error code was negative, badness happened, and I bailed.  That's about 
the limit of the error handling I've done.


And that seems to be what the plugin currently does.

If you actually examine the 
error codes, you might be able to handle them more intelligently.  I 
never had the need, so I'm not sure.


The error codes correspond to defines, so the first step I did was print 
out what the error code corresponded to when one occurs instead of just 
saying unable to load the file/stream. But it's what to do then, or 
what could be done to try and go on gracefully, that I'm not sure about.


Anyways, I'm kind of at a dead end because there's too much I don't know 
how to do with ffmpeg. I've got some basic things to work but I'm not 
near where I want to go. I'll submit what I have and see if someone else 
can pick it up from there or suggest improvements.


Thanks for your help,

J-S
--
__
Jean-Sebastien Guayjean-sebastien.g...@cm-labs.com
   http://www.cm-labs.com/
http://whitestar02.webhop.org/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org