Is there any way to use Cesium to export a video

1,440 views
Skip to first unread message

trista...@garmin.com

unread,
Apr 14, 2017, 4:52:15 AM4/14/17
to cesium-dev
Is there any way to use Cesium to export a video?
There is a tutorial to export video from Canvas and WebGL using websockets.
http://www.smartjava.org/content/capture-canvas-and-webgl-output-video-using-websockets
Want to know that if there is any other way to convert a Cesium animation to a video efficiently.

Rachel Hwang

unread,
Apr 14, 2017, 1:59:36 PM4/14/17
to cesium-dev, trista...@garmin.com
Hi Tristan,

We don't have support for that yet, unfortunately, but it's on our radar long-term!

Thanks,
- Rachel

Matthew Amato

unread,
Apr 14, 2017, 8:06:02 PM4/14/17
to cesiu...@googlegroups.com
Tristan,

While Cesium has no "one click" out of the box support for recording video.  This is actually a pretty straight forward thing to do with one of the many third-party libraries available. Cesium renders to an HTML canvas, so capturing frames and videos of Cesium is no different than any other canvas capturing technique.

One example would be using ccapture: https://github.com/spite/ccapture.js/.

Here's a snippet that captures whatever is going on in the Cesium window and creates a webm movie (this won't run as-is, but it gives you an idea of how it works.  Basically, every time Cesium renders a frame, we save a frame of video.

var viewer = new Cesium.Viewer('cesiumContainer');
var capturer;
var removeEvent;

startButton.onclick = function() {
capturer = new CCapture( { format: 'webm', framerate: 30 } );
capturer.start();
removeEvent = viewer.scene.postRender.addEventListener(function(){
capturer.capture( viewer.scene.canvas );
});
};

stopButton.onclick = function() {
removeEvent();
capturer.stop();
window.open(capturer.save());
capturer = undefined;
};

The exact details depend on your use case, for example, do you want to capture a pre-planned camera flight?  Or just whatever the user is doing?  Do you want to save the video to the server, or to the client machine?  Do you care about time and do you want the video to run at the same speed of the Cesium clock?

Having out of the box video capture (or a plug-in) is something that's been on my todo list for a while, but with everything else going I haven't had any time to work on it.  However, perhaps we can get a lot of mileage by choosing a decent library and at least having a blog post or Sandcastle example showing an end-to-end solution.

Hope that helps,

Matt


--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted
Message has been deleted

trista...@garmin.com

unread,
Apr 16, 2017, 10:54:46 PM4/16/17
to cesium-dev, trista...@garmin.com
Thanks, Rachel. Good to know that it is listed on the plan.

在 2017年4月15日星期六 UTC+8上午1:59:36,Rachel Hwang写道:
Message has been deleted

trista...@garmin.com

unread,
Apr 16, 2017, 11:14:59 PM4/16/17
to cesium-dev
Hi Matthew,

Many thanks for your help. I will try this way.
Actually I want to convert Cesium annimation with a pre-planned camera to a video in the background, so it will run in a server.

在 2017年4月15日星期六 UTC+8上午8:06:02,Matthew Amato写道:
> To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.

Ryan Hickman

unread,
Apr 25, 2017, 2:58:16 PM4/25/17
to cesium-dev, trista...@garmin.com
ffmpegserver works beautifully for that purpose.

Ryan Hickman

unread,
Apr 25, 2017, 3:02:24 PM4/25/17
to cesium-dev, trista...@garmin.com
Since that didn't work.


Here's a video I created using ffmpegserver + CCapture.

Rachel Hwang

unread,
May 1, 2017, 1:56:35 PM5/1/17
to cesium-dev, trista...@garmin.com
Thanks for sharing, Ryan. This looks great!

Cheers,
- Rachel

trista...@garmin.com

unread,
May 1, 2017, 9:04:02 PM5/1/17
to cesium-dev, trista...@garmin.com
在 2017年4月26日星期三 UTC+8上午3:02:24,Ryan Hickman写道:
> Since that didn't work.
>
>
> https://www.youtube.com/watch?v=cVC8lRV5QwE&feature=youtu.be
>
>
> Here's a video I created using ffmpegserver + CCapture.
>
> On Tuesday, April 25, 2017 at 12:58:16 PM UTC-6, Ryan Hickman wrote:
> ffmpegserver works beautifully for that purpose.
>
>
>
>
>
>
>
> On Friday, April 14, 2017 at 2:52:15 AM UTC-6, trista...@garmin.com wrote:Is there any way to use Cesium to export a video?
> There is a tutorial to export video from Canvas and WebGL using websockets.
> http://www.smartjava.org/content/capture-canvas-and-webgl-output-video-using-websockets
> Want to know that if there is any other way to convert a Cesium animation to a video efficiently.

Many thanks, Ryan. We are trying this way.

Qandeel Abbassi

unread,
May 2, 2017, 10:55:27 AM5/2/17
to cesium-dev

Can you please tell what does ffmpegserver do? I know about ffmpeg though.

Qandeel Abbassi

unread,
May 2, 2017, 10:58:35 AM5/2/17
to cesium-dev
Also, i will be really thankful if you can provide a step by step process of achieving what you did.

Ryan Hickman

unread,
May 2, 2017, 1:15:12 PM5/2/17
to cesium-dev, trista...@garmin.com
CCapture + ffmpegserver.

The documentation at https://github.com/greggman/ffmpegserver.js/ is sufficient. Also, read what Matthew Amato posted above. Combined, you'll get the same result as I did.


On Friday, April 14, 2017 at 2:52:15 AM UTC-6, trista...@garmin.com wrote:

Qandeel Abbassi

unread,
May 2, 2017, 2:42:33 PM5/2/17
to cesium-dev
Oh, i was looking at the wrong ffmpegserver repository. Thanks for the link
Message has been deleted

trista...@garmin.com

unread,
May 2, 2017, 10:49:52 PM5/2/17
to cesium-dev
Hi Ryan,

It is so great for your repo! Is there any way to generate video without running html? I mean just with a service that send a request to get a video.

Ryan Hickman

unread,
May 3, 2017, 11:29:54 AM5/3/17
to cesiu...@googlegroups.com
Tristan,

It would theoretically be possible to modify Cesium to work server-side using node.js and some third-party extensions (node-canvas/node-webgl). See: https://groups.google.com/forum/#!topic/cesium-dev/j723wkYI1EA

With this done, it would then be possible to render a video using ffmpegserver.

On Tue, May 2, 2017 at 8:49 PM, <trista...@garmin.com> wrote:
Hi Ryan,

It is so great for your repo! Is there any way to generate video without running html? I mean just with a service that send a request to get a video.

--
You received this message because you are subscribed to a topic in the Google Groups "cesium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cesium-dev/mvylCnnuabI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+unsubscribe@googlegroups.com.

adwi...@gmail.com

unread,
Aug 15, 2017, 4:15:36 PM8/15/17
to cesium-dev, trista...@garmin.com
Great post!
It is working for me.
But any idea how to set the frequency that render is called which indicates the frequency that capture.capture is called

Ryan Hickman

unread,
Aug 16, 2017, 6:04:41 PM8/16/17
to cesiu...@googlegroups.com, trista...@garmin.com
My suggestion to you would be to look at the TerriaJS stuff that has "postRender" hooks and "notifyRepaintRequired" (ctrl/cmd+f both of those phrases). This also works beautifully for reducing CPU/GPU usage when the map is not in the foreground or hasn't been manipulated in some time.


Reply all
Reply to author
Forward
0 new messages