Re: [Flightgear-devel] --jpg-httpd command line option

2013-09-18 Thread Adrian Musceac
On Tuesday, September 17, 2013 20:52:16 Curtis Olson wrote:
 If someone decides to jump into this, another feature that would be cool
 would be to stream the display out as a video stream which could then be
 played by any number of video players on a remote computer (like mplayer.)
  ffmpeg probably would provide library support to make this pretty
 straightforward, but I haven't had a chance to dive in and see how
 easy/hard it would be.
 
 One area where this feature could be useful is in UAV research and
 simulation where you'd like to emulate a live video feed back to a ground
 station.  It could also be fun for sharing/broadcasting your simulator
 session and probably could be made to work with a web video server.
 
 In my own experimentation I've been able to sort of do this by using ffmpeg
 to capture an area of the screen, encode it as h.264 and send it off to a
 remote destination as a udp video stream, for example:
 
 ffmpeg -f x11grab -s vga -r 15 -b 100k -preset ultrafast -tune zerolatency
 -maxrate 100k -i :0.0+1,58 -f mpegts -vcodec h.264 udp://
 remote.host.name.org:1234
 
 But this requires careful manual sizing and placement of my flightgear
 window and it would be cool to have this built right in...  I've seen other
 apps that can do this so I know it's technically possible, and I imagine
 not too much coding once you figure out the magic to make it happen.
 
 Curt.
 

Hi, there,
VLC does this better than ffmpeg, so it's probably a good idea to study it's 
codebase for streaming code. Also, MJPEG is nice, but as a container I'd 
choose Ogg/Theora instead of H264 since they're entirely open.

Cheers,
Adrian

--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151iu=/4140/ostg.clktrk
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] --jpg-httpd command line option

2013-09-18 Thread James Turner

On 17 Sep 2013, at 19:47, Rick Armstrong rick.armstr...@urbanrobotics.net 
wrote:

 Indeed, PNG would be ideal!
  - if you have any interested in
  doing this, I can point you at examples since the screenshot code was
  converted to do the same thing recently -it's probably a couple of hours
  hacking at most)
 
 I'd be happy to take a crack at it. This would be my first foray into the 
 FlightGear source tree, so a pointer to some sample code would be great.
 

Okay, various pieces:

gui_funcs.cxx has the screenshot dumping code, especially the logic to 
run things safely via an OSG GraphicsContextOperation. Its run() virtual 
contains a call to: sg_glDumpWindow

which is defined in SimGear and does the actual reading of the frame-buffer and 
writing via:

// dump the screen buffer to a png file, returns true on success 
bool sg_glDumpWindow(const char *filename, int win_width, int 
win_height) 
{ 
osg::ref_ptrosg::Image img(new osg::Image);
img-readPixels(0,0, win_width, win_height, GL_RGB, 
GL_UNSIGNED_BYTE); 
return osgDB::writeImageFile(*img, filename);
}

The trick will be to interface this with the jpg-httpd infrastructure. There's 
a problem I can see here - the osgDB API is very file orientated, but I assume 
you need the image data in memory to send down the HTTP socket. We might need 
to ask on the OSG mailing list if this can be done, otherwise you'd have to 
read the file back after writing it. This is little ugly but the file should be 
in the cache so probably no actual disk access happens.

Most of jpgfactory.cxx is irrelevant, I'd ignore it completely since it only 
deals with the tile-rendering (not needed these days since we can render big GL 
viewports natively) and the mechanics of running the image compressor. If you 
can plug the stuff you need into line 227 of jpg-httpd, I think you're good.

That's a very rough sketch based on ten minutes reading of course.

Note if you want actual good performance from this system, there's much smarter 
things that could be done, such as grabbing the frame buffer each normal 
rendering frame, instead of re-rendering the scene each time an HTTP get is 
received. That would need much more drastic changes to the system however.

As ever, any further questions, just ask.

Regards,
James


--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151iu=/4140/ostg.clktrk
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


[Flightgear-devel] --jpg-httpd command line option

2013-09-17 Thread Rick Armstrong
Hello all,

I'm a developer using FlightGear in a simulation project for work, and I'm
currently getting imagery from FlightGear by triggering screenshots from my
application and loading the screen captures from disk. It's kinda Rube
Goldberg, but works well enough for a first draft. What I'd /really/ like
to do is stream the imagery directly to my application. Googling around, I
notice that there's a command-line option to do exactly this! It's not
enabled in v2.10, but some more searching and I see that it can be enabled
by setting

-DJPEG_FACTORY:BOOL=ON

in CMake. My question: before I go down that road, does anyone know if the
JPG HTTPD functionality works? If yes, does it work well? The fact that
it's turned-off by default makes me think that it might not be ready for
prime-time.

Any advice is greatly appreciated.

Regards,

Rick Armstrong
Portland, OR, USA

P.S. We're using Windows 7 VS 2010 and would be looking to build 64-bit
binaries.
--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151iu=/4140/ostg.clktrk___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] --jpg-httpd command line option

2013-09-17 Thread James Turner

On 17 Sep 2013, at 10:41, Rick Armstrong waitingfortheelectric...@gmail.com 
wrote:

 -DJPEG_FACTORY:BOOL=ON 
 
 in CMake. My question: before I go down that road, does anyone know if the 
 JPG HTTPD functionality works? If yes, does it work well? The fact that it's 
 turned-off by default makes me think that it might not be ready for 
 prime-time.
 
 Any advice is greatly appreciated.

It's turned off for build reasons, not because it's new or untested. I believe 
many people have used it exactly the way you describe. If you encounter 
problems, they should be easy to fix and patches are welcome!

(The build reasons could actually be solved by using OSGDB to write out the 
files instead of using libjpeg directly - this would mean the feature could be 
enabled all the time, i.e removed from CMake, and also we could write out PNGs 
instead of JPEGs if desired - if you have any interested in doing this, I can 
point you at examples since the screenshot code was converted to do the same 
thing recently -it's probably a couple of hours hacking at most)

Kind regards,
James

--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151iu=/4140/ostg.clktrk___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] --jpg-httpd command line option

2013-09-17 Thread Curtis Olson
If someone decides to jump into this, another feature that would be cool
would be to stream the display out as a video stream which could then be
played by any number of video players on a remote computer (like mplayer.)
 ffmpeg probably would provide library support to make this pretty
straightforward, but I haven't had a chance to dive in and see how
easy/hard it would be.

One area where this feature could be useful is in UAV research and
simulation where you'd like to emulate a live video feed back to a ground
station.  It could also be fun for sharing/broadcasting your simulator
session and probably could be made to work with a web video server.

In my own experimentation I've been able to sort of do this by using ffmpeg
to capture an area of the screen, encode it as h.264 and send it off to a
remote destination as a udp video stream, for example:

ffmpeg -f x11grab -s vga -r 15 -b 100k -preset ultrafast -tune zerolatency
-maxrate 100k -i :0.0+1,58 -f mpegts -vcodec h.264 udp://
remote.host.name.org:1234

But this requires careful manual sizing and placement of my flightgear
window and it would be cool to have this built right in...  I've seen other
apps that can do this so I know it's technically possible, and I imagine
not too much coding once you figure out the magic to make it happen.

Curt.



On Tue, Sep 17, 2013 at 6:16 AM, James Turner zakal...@mac.com wrote:


 On 17 Sep 2013, at 10:41, Rick Armstrong 
 waitingfortheelectric...@gmail.com wrote:

 -DJPEG_FACTORY:BOOL=ON

 in CMake. My question: before I go down that road, does anyone know if the
 JPG HTTPD functionality works? If yes, does it work well? The fact that
 it's turned-off by default makes me think that it might not be ready for
 prime-time.

 Any advice is greatly appreciated.


 It's turned off for build reasons, not because it's new or untested. I
 believe many people have used it exactly the way you describe. If you
 encounter problems, they should be easy to fix and patches are welcome!

 (The build reasons could actually be solved by using OSGDB to write out
 the files instead of using libjpeg directly - this would mean the feature
 could be enabled all the time, i.e removed from CMake, and also we could
 write out PNGs instead of JPEGs if desired - if you have any interested in
 doing this, I can point you at examples since the screenshot code was
 converted to do the same thing recently -it's probably a couple of hours
 hacking at most)

 Kind regards,
 James



 --
 LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
 1,500+ hours of tutorials including VisualStudio 2012, Windows 8,
 SharePoint
 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack
 includes
 Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
 http://pubads.g.doubleclick.net/gampad/clk?id=58041151iu=/4140/ostg.clktrk
 ___
 Flightgear-devel mailing list
 Flightgear-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/flightgear-devel




-- 
Curtis Olson:
http://www.atiak.com - http://aem.umn.edu/~uav/
http://www.flightgear.org - http://gallinazo.flightgear.org
--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151iu=/4140/ostg.clktrk___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] --jpg-httpd command line option

2013-09-17 Thread Rick Armstrong
On Tue, Sep 17, 2013 at 6:16 AM, James Turner zakalawe@... wrote:
...
 It's turned off for build reasons, not because it's new or untested. I
 believe many people have used it exactly the way you describe. If you
 encounter problems, they should be easy to fix and patches are welcome!

 (The build reasons could actually be solved by using OSGDB to write out
 the files instead of using libjpeg directly - this would mean the feature
 could be enabled all the time, i.e removed from CMake, and also we could
 write out PNGs instead of JPEGs if desired

Indeed, PNG would be ideal!

 - if you have any interested in
 doing this, I can point you at examples since the screenshot code was
 converted to do the same thing recently -it's probably a couple of hours
 hacking at most)

I'd be happy to take a crack at it. This would be my first foray into
the FlightGear source tree, so a pointer to some sample code would be
great.


Thanks,

Rick

-- 
*Information contained herein is subject to the Code of Federal Regulations 
Chapter 22 International Traffic in Arms Regulations. This data may not be 
resold, diverted, transferred, transshipped, made available to a foreign 
national within the United States, or otherwise disposed of in any other 
country outside of its intended destination, either in original form or 
after being incorporated through an intermediate process into other data 
without the prior written approval of the US Department of State.  **Penalties 
for violation include bans on defense and military work, fines and 
imprisonment.*
--
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151iu=/4140/ostg.clktrk___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel