Board index FlightGear Development New features

Generate a video file by using the replay feature

Discussion and requests for new features. Please note that FlightGear developers are volunteers and may or may not be able to consider these requests.

Generate a video file by using the replay feature

Postby Curtis » Mon Jan 06, 2020 2:51 pm

Hello,

with flightgear there is a "replay" feature for the fly, and we can record the replay in a data file (*.out), this data file can be then "played" by flightgear :
https://www.youtube.com/watch?v=9Ev5MAamKiU

One improvement would be to create a video file of the replay, without the need of capturing the screen with a software,

To achieve this flightgear could be modified in order to use ffmpeg library, for converting image and sound to video file, the quality would be much better than a live capture of the screen.
Curtis
 
Posts: 131
Joined: Wed Jun 17, 2009 3:09 pm
OS: archlinux 64 bits

Re: Generate a video file by using the replay feature

Postby Hooray » Mon Jan 06, 2020 3:37 pm

you can use 3rd party software to capture the screen and create said video file, but that has nothing to do with the replay feature, unless you are replaying a previously recorded flight.

Directly capturing inside flightgear, is possible and is something that OSG supports out of the box - there are number of ffmpeg related osg examples, but it's nothing that is currently integrated

However, this might become much easier thanks to the compositor work done by Fernando, which is all about rendering into a buffer and passing that to a different rendering pass, to build the equivalent of a so called "pipeline" - such a pipeline could also just copy the frame buffer and pass it onto another handler, to save to disk, or stream the window contents to another process.

As a matter of fact, ThomasS created a streaming feature for the Canvas system which takes the canvas texture and streams it to a browser, this is used by Torsten's Phi front-end to display canvas textures at runtime - the same approach would work for full-screen textures:

http://wiki.flightgear.org/Read_canvas_image_by_HTTP
Image

If/when compositor ends up with Canvas support again, it would be pretty straightforward to make this kind of setup feasible again.
And we've seen a handful other valid use-cases, too: http://wiki.flightgear.org/Howto:Using_ ... Box_Server

Speaking in general, it would make sense for the instant replay/flight recorder subsystem to become a standalone thing, living in its own thread/process - also to get rid of lag, and so that custom settings can be used that don't add workload to the main loop.


Technical details about the differences between the replay file (format) and an actual video, to be found below:

Replay Conversion
Hooray wrote:
HelldiverSquadron wrote in Mon Apr 21, 2014 6:54 pm:Seemed like a binary trait. I opened it in Notepad ++, but it was just rubbish. I don't mean that it is a video format, but rather could I import it into, say, Blender, and then export it as something else? It's way too optimistic, I know. Thanks, all!

again, the format is basically seralized FlightGear properties, please see $FG_ROOT/Docs/flightrecorder.README - these are all just "numbers", the format is determined by FlightGear, and these numbers do not mean ANYTHING outside FlightGear, and even inside FlightGear it's really just the flight recorder subsystem that is able to open/process those files, read in the numbers and map them to the corresponding FlightGear properties - which in turn allows things to be animated/replayed over time JUST VIA FlightGear.

There's really no need to continue this discussion at all - all the responses given so far were rather exact, detailed and 100% correct. There's no reasonable way to visually "replay" those files outside FlightGear, short of rewriting FlightGear itself, or extending another flight simulator to partially re-interpret certain values. Unless that is something that you are interested, willing and capable to do, I'd just leave it at that.

What FlightGear is writing to those files is not actual "visual" stuff at all, it's just "gibberish" in the sense of properties that are only meaningful to FlightGear itself, and its features, most properties are in fact aircraft specific. Imagine those files to be containers for binary FlightGear properties, i.e. things like altitude, longitude, latitude - but also engine settings, flap settings, gear status etc.

So there's really just numbers stored there, nothing visual that would make sense to visually re-interpret outside a flight simulator environment like FlightGear.

To actually replay even just a single aircraft specific animation in FlightGear, you would have to write a python script that 1) loads the aircraft, 2) looks up the 3D objects, 3) maps the properties to animations - and completely ignore anything related to scenery, because it's typically just aircraft specific stuff that is recorded.

Please just believe us, and consider spending more time reading and understanding what you're told, instead of re-asking redundant questions, thank you ! :D
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11836
Joined: Tue Mar 25, 2008 8:40 am

Re: Generate a video file by using the replay feature

Postby Curtis » Mon Jan 06, 2020 5:46 pm

Hello Hooray,

currently I use the software "RecordMyDesktop" when I want to create a video of a fly :

https://en.wikipedia.org/wiki/RecordMyDesktop

It works but it is CPU consuming if the 3rd party software is not well optimized, and usually this kind of software will capture also the title bar of the flightgear window,

Hooray wrote in Mon Jan 06, 2020 3:37 pm:However, this might become much easier thanks to the compositor work done by Fernando, which is all about rendering into a buffer and passing that to a different rendering pass, to build the equivalent of a so called "pipeline" - such a pipeline could also just copy the frame buffer and pass it onto another handler, to save to disk, or stream the window contents to another process.

As a matter of fact, ThomasS created a streaming feature for the Canvas system which takes the canvas texture and streams it to a browser, this is used by Torsten's Phi front-end to display canvas textures at runtime - the same approach would work for full-screen textures:

http://wiki.flightgear.org/Read_canvas_image_by_HTTP



I like this solution : flightgear would stream its image and sound to http, and a software like VLC or mplayer would catch this stream and convert it to a video file,

VLC (or mplayer) can be located on a second PC (connected by network to the first PC), which solves the problem of CPU consuming, as the power of the first PC will be dedicated to flightgear, and the second PC to video compression with vlc or mplayer.

The idea of pipeline is good also.
Curtis
 
Posts: 131
Joined: Wed Jun 17, 2009 3:09 pm
OS: archlinux 64 bits

Re: Generate a video file by using the replay feature

Postby Hooray » Mon Jan 06, 2020 6:14 pm

that's true, a number of osg examples explicitly mention streaming to VLC - if in doubt, feel free to file a feature request at the proper location: https://sourceforge.net/p/flightgear/codetickets/
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11836
Joined: Tue Mar 25, 2008 8:40 am

Re: Generate a video file by using the replay feature

Postby V12 » Mon Jan 06, 2020 9:50 pm

Curtis :
Try OBS studio. On new graphics cards it can use HW videoencoder, I use this software on Linux and Win10 with nVidia 1060. OBS worked with older GTX750 too. With HVENC CPU load is minimal.
Check this example - https://www.youtube.com/watch?v=PJdNcQs377E under Win10 and this one https://www.youtube.com/watch?v=FBH31VYUid4 captured under Linux, first on AMD R7 3700X @4200 and GTX1060 6GB, second with i5-2550K and GTX1060 6GB. And this video https://www.youtube.com/watch?v=yv7ny_PJodk too on old i5-2550K but older 750GTX.
Fly high, fly fast - fly Concorde !
User avatar
V12
 
Posts: 1822
Joined: Thu Jan 12, 2017 4:27 pm
Location: LZIB
Callsign: BAWV12


Return to New features

Who is online

Users browsing this forum: No registered users and 3 guests