How go generate a movie from Google Earth studio ESP file and images - render

How to create a movie from a .esp file (which is actually JSON) and a set of images that Google Earth Studio generates when you render?
The docs recommend Adobe products, but those are paid and I only need this once: https://earth.google.com/studio/docs/making-animations/rendering/

You can use ffmpeg
Like so:
ffmpeg -f image2 -r 30 -i your_project%03d.png -c:v libx264 -pix_fmt yuv420p out.mp4
Where the -r flag is the Frame rate you chose, and the -i flag the name pattern of the jpges in the footage folder.

You can use Blender which is free. It already has a plugin that allows you to import the jpg sequence rendered in Google Earth Studio with the JSON file so that you can edit your video and use the track points.

I assume this question was about an older/outdated version of Earth Studio since, nowadays, you can simply choose to render as an .mp4.
Plus, there's even the option to render as a 360° spherical .mp4... very cool when played on an Oculus Quest - as long as I avoid including sudden turns in the animation. (I literally almost barfed, which was simultaneously awful and awesome.)
On the other hand, the question says "movie" (without a filetype) which is pretty vague, so I'll paste in some [messy] JavaScript that I slapped together to dynamically display a set of rendered .jpeg frames, automatically progressing through the frames -- but with an <input type="range"> slider to also allow manual movement through the frames...
<style>
body{ font-family:sans-serif;
background:#000; color:#fff;
margin:0;
overflow:hidden; }
#cont{ position:absolute;
width:min(1000px,98vw);
height:min(1000px,98vh);
left:50%; top:50%;
transform:translate(-50%,-50%);}
img{ max-width:100%; max-height:100%;
position:absolute; left:50%; top:50%;
transform:translate(-50%,-50%);}
#rgcont{ position:absolute; z-index:99;
left:3%; right:3%; top:3%;
width:100vw; height:20px;
transform-origin:3% 3%;
transition:300ms;}
input{ width:90%; left:50%;
transform:translatex(-50%);
position:absolute;
filter: drop-shadow(3px 3px 5px #000)
drop-shadow(-3px -3px 5px #000); }
#media(orientation:landscape){
#rgcont{ width:100vh;
transform:rotate(90deg) translatey(-50%); }
}
#info{ position:absolute;
right:5px; bottom:5px;
font-size:22px; }
</style>
html & js
<div id='cont'><img id='iimg' src=''></div>
<div id='rgcont'>
<input type="range" id='rg' min='0' max='182' value='0' oninput="slid()">
</div>
<div id='info'></div>
<script>
var imgs={}, loaded=0,
urls=[], auto=true, idx=0;
for(var i=0;i<=182;i++){
var n=i.toString().padStart(3,'0'),
url="https://example.com/myframes_"+n+".jpeg";
urls.push(url);
imgs[i]=new Image(1000,1000);
imgs[i].addEventListener('load',did1);
imgs[i].src=url;
}
function did1(e){
info.innerHTML=(100*((++loaded)/183)).toFixed()+'%';
if(loaded==1){frame();}
}
function slid(){
idx=parseInt(rg.value);
auto=false;
frame(idx);
}
function frame(){
iimg.src=urls[idx];
if(auto){
if((++idx)<=182){
requestAnimationFrame(frame)
}else{
idx=182;
auto=false;
}
rg.value=idx;
}
}
</script>
The hard-coded 182 is the total count of frames. Again, I'm not claiming this code works; just giving an idea.

Related

Dynamically displaying static images based on view port using Sass

I'm creating a React application that has a hero display on the landing page that displays one of three images: [hero-1.jpg, hero-2.png, hero-3.png] based on the users viewport screen size.
I have been unsuccessful trying to find resources online that show a DRY method for achieving this, for the sake of participation, I'll leave this code that I attempted that - in theory made sense to me.
N.B. I am extremely new to Sass/Scss
snippet.html
<section className="hero is-fullheight has-background-black">
<div className="hero-body">
<div className="container">
</div>
</div>
</section>
hero.scss
$i: 1;
$breakpoint-phone: 480px;
$breakpoint-tablet: 768px;
$breakpoint-desktop: 1024px;
#mixin modifier ($i:1) {
#content;
#media only screen and (max-width:$breakpoint-phone) { $i: 2; }
#media only screen and (max-width:$breakpoint-tablet) { $i: 3; }
#media only screen and (max-width:$breakpoint-desktop) { $i: 1; }
}
.hero {
background-position: center;
background-size: cover
}
#include modifier {.hero {background-image: url('../assets/hero-#{$i}.jpg');}}
Methodology:
Display content by default (which is pulled from #include).
Mixin modifier will modify the $i passed to the mixin, which is interpolated in the image path.
Expected Result:
Based on each breakpoint, $i will be set to the appropriate value and change the background image dynamically.
Actual Result:
The global $i is used, and the web page displays hero-1.jpg.
There are a few ways you can achieve this. If I was going about this, this is how I would do it.
Also, it would be very wise to practice mobile first development. Use min-width and go up instead of using max-width going down. The way you currently have it structured would mean you wouldn't have a valid URL if that $i variable wasn't set at 1 at the top of your document. Writing SASS or CSS will be much easier this way once you get used to it.
$tablet: 768px;
$desktop: 1024px;
#mixin hero-image() {
.hero {
background-position: center;
background-size: cover;
background-image: url('../assets/hero-2.jpg');
#media screen and (min-width: $tablet) {
background-image: url('../assets/hero-3.jpg');
}
#media screen and (min-width: $desktop) {
background-image: url('../assets/hero-1.jpg');
}
}
}
#include hero-image();
You're still going to have to write the background-image property 3 times. The way you were doing it was close, but you would have had to #include modifier() 3 times in your consuming scss file. At the end of the day SASS compiles to CSS. You could potentially use a SASS function or For Loop to achieve this, but mixins can get really complicated and powerful, but also incredibly difficult to read and understand. Here's what the mixin I just showed you compiles to in CSS.
.hero {
background-position: center;
background-size: cover;
background-image: url("../assets/hero-2.jpg");
}
#media screen and (min-width: 768px) {
.hero {
background-image: url("../assets/hero-3.jpg");
}
}
#media screen and (min-width: 1024px) {
.hero {
background-image: url("../assets/hero-1.jpg");
}
}
I recommend putting your SCSS/SASS into this compiler to see your results before compiling your actual project.
https://www.sassmeister.com/
Even though you are repeating background-image 3 times inside of the mixin this is very much still DRY code because you can include that one mixin everywhere your images will be shown and if you need to edit it, you can edit it in one place.

Vuetify themes with custom css

Let's assume I have something like the following:
<v-app>
<div :class="getCustomCss">Blah</div>
<v-app>
getCustomCss() {
return $this.vuetify.theme.dark ? 'whenThemeIsDark' : 'whenThemeIsLight';
}
<style>
.whenThemeIsDark {
border:1px solid white;
}
.whenThemeIsLight {
border:1px solid black;
}
</style>
What would be the best way to change the color of the divs border when toggling between light/dark themes?
Do I sit and watch the $this.vuetify.theme.dark property and manually change the border from the myDarkClass to myWhiteClass similar to what's shown above? Or do I somehow use the customProperties feature in the theme/options to do this (and how?). Or is there a better way of doing this I'm unaware of?
This is a simple example which only requests the css to change in one spot, but a real application may have tons of custom css on different pages that would keep needing checks like this. I could easily see that getting messy if there are watchers/checks everywhere.
I have read the https://vuetifyjs.com/en/customization/theme page and I have a feeling the Custom Properties section may be the key, but I'm not quite getting how to translate my example to their example.
A css class of theme--light or theme--dark is applied to the v-app v-application which will identify which theme is active for you without additional watchers.
Using your simplified example:
<style>
.v-application.theme--light {
border:1px solid white;
}
.v-application.theme--dark{
border:1px solid black;
}
</style>

YouTube embed showinfo has been deprecated

We are using a YouTube video on our website as a hero banner.
However few days ago it started showing it's title, watch later button and a share button. We were able to hide them using &showinfo=0 at the end if the URL.
I found out that showinfo has been deprecated and thus you can no longer hide the fact that it is a YouTube video showing there.
Is there any other parameter that might be able to do the same thing?
You cannot do it with CSS or JavaScript as it is an iframe.
Any ideas are much appreciated.
UPDATE:
Any layer or mask over the video doesn't help, as the info shows when the video is loading, or if you click outside the browser, the video will pause and the info shows.
Hiding the top ~60px works, but it is not a good solution for me.
Directly from show info
Note: This is a deprecation announcement for the showinfo parameter. In addition, the behavior for the rel parameter is changing. Titles, channel information, and related videos are an important part of YouTube’s core user experience, and these changes help to make the YouTube viewing experience consistent across different platforms.
The behavior for the rel parameter is changing on or after September 25, 2018. The effect of the change is that you will not be able to disable related videos. However, you will have the option of specifying that the related videos shown in the player should be from the same channel as the video that was just played.
It clearly states that this is something they consider to be part of the cor youtube experience. There is no suggestion of a workaround or a new parameter that you could send to archive the old results. They are removing it. If you tried to force it out using javascript and css i would almost suggest you are against the TOC which states your not allowed to change that display. People should know you are showing something from YouTube
If you need to hide the info, ideally go for Vimeo pro (which properly supports a no info embed),
Otherwise there is a simple workaround:
https://jsfiddle.net/10ov5hgw/1/
It cuts off the bottom & top 60px of the iframe, but via overflow rather than a gross looking black bar on top, so video still looks fullscreen the entire time (and barely any of the video is cutout if you force 720) ,
This hack supports having to support mobile views aswell, without heavily impacting the visible area of the video.
.video-container{
width:100vw;
height:100vh;
overflow:hidden;
position:relative;
}
.video-container iframe,{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.video-container iframe, {
pointer-events: none;
}
.video-container iframe{
position: absolute;
top: -60px;
left: 0;
width: 100%;
height: calc(100% + 120px);
}
.video-foreground{
pointer-events:none;
}
<div class="video-container" >
<div class="video-foreground">
<iframe
src="https://www.youtube.com/embed/W0LHTWG-UmQ?controls=0&showinfo=0&rel=0&autoplay=1&loop=1&playlist=W0LHTWG-UmQ&mute=1"
frameBorder="0" allowFullScreen>
</iframe>
</div>
</div>
The solution I found aesthetically most pleasing is to lay a high res thumbnail over the video and hide it at hover. This also deals with the problem that the youtube preview is low res and looks cheap in my opinion.
Check it out here:
http://jsfiddle.net/d9D9E/1/
Had to write code in order to show the js fiddle :/
.video-thumbnail{
z-index:300;
position:absolute;
top:0;
left:0;
width:100%;
}
.video-thumbnail:hover{
display:none;
}
Not having 'rel=0' is irritating, but there is a work around. If you work with the IFrame API, (as opposed to embedding an iframe ex http://youtu.be/?videoIDxxx...) you can get the event for the stopping (completing) of the video, then cue up the video by ID into the player. See https://developers.google.com/youtube/iframe_api_reference#Playback_controls for reference to the basic player.
....
<div id="player1"></div>
<script type="text/javascript">
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player ;
function onYouTubeIframeAPIReady()
{
player = new YT.Player('player1',
{
videoId: 'YourVideoId',
events: {
'onStateChange': onPlayerStateChange
}
});
}; // onYOuTubeIframeAPIReady
function onPlayerStateChange(event)
{
// Alt approach //if( event.data == 0){ location.reload()}
if( event.data == 0)
{ player.cueVideoById({videoId:'YourVideoID',
suggestedQuality: 'hd720'})
};
}
</script>
I was looking at the same problem and the only solution I found is to set the video in autoplay and place a transparent layer over the youtube box.
The user would not be able to interact with the player, but it can be useful in some situation like banner.
Unfortunately the code doesn't seem to run correctly on stackoverflow I also add a jsfiddle: http://jsfiddle.net/z3dqpuy0/
.yt-cntainer {
position: relative;
}
.yt-mask {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
<div class="yt-cntainer">
<iframe id="vid-player-1" src="https://www.youtube.com/embed/Bey4XXJAqS8?enablejsapi=1&rel=0&controls=0&showinfo=0&autoplay=1" frameborder="0"></iframe>
<div class="yt-mask"></div>
</div>
Well, I just noticed it as well. It sucks and ruins the aesthetics. So I just did a
header {
/* remove when YT got its brain back */
margin-top: -56px;
}
while hoping that they'll re-add showinfo=0 again.
What about this. Yeah this will zoom the video.
iframe {
transform:scale(1.4);
}
<div id="schnitt">
<iframe width="500" height="280" src="https://www.youtube.com/embed/rlR4PJn8b8I?controls=1" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<style>
#schnitt {
height:250px;
overflow:hidden;
}
iframe {
margin-top:-55px;
}

IE8 Transparent PNG problems in Nivo Slider using background-image for Prev and Next Buttons

I'm using the nivo slider on our site
It's working great on all devices except for IE8 on XP, which due to the infamous IE transparent png issue, I get black borders around the prev and next buttons on rollover. The prev and next buttons need to be transparent pngs as they have a drop-shadow and are placed on top of transitioning images.
The Arrows
The Problem IN IE8 XP
The HTML
<div class="nivo-directionNav">
<a class="nivo-prevNav" style="display: none;"></a>
<a class="nivo-nextNav" style="display: none;"></a>
</div>
The CSS
.nivo-directionNav a {
position:absolute;
z-index:9;
cursor:pointer;
}
/* the arrows are taken from a single sprite with a standard and active image
for prev and next with the background-position changed on rollover */
.nivo-prevNav, .nivo-nextNav {
width: 80px;
height: 100%;
}
.nivo-prevNav {
left:0px;
background: url("images/nivo_4_arrows.png") no-repeat 0 0;
}
.nivo-prevNav:hover {
background: url("images/nivo_4_arrows.png") no-repeat -80px 0;
}
I have tried to implement this javascript as a fix:
var i;
for (i in document.images) {
if (document.images[i].src) {
var imgSrc = document.images[i].src;
if (imgSrc.substr(imgSrc.length-4) === '.png' || imgSrc.substr(imgSrc.length-4) === '.PNG') {
document.images[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='crop',src='" + imgSrc + "')";
}
}
}
...as well as this plugin found on a similar post on this forum but neither have proved successful.
Been wasting lots of time on this so I'd really appreciate anyone that can shed some light on a fix!
Try to insert the following lines into 'nivo-slider.css' (a style for no theme specified):
.nivo-slice
{
background: transparent;
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF)" !important;/* IE8 */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#00FFFFFF,endColorstr=#00FFFFFF) !important;/* IE6 & 7 */
zoom: 1;
}
It works for the slice effect, but put this for the other effects, however in my case this solution changes the fade effect into a simple changing pictures effect (without fading). Maybe it'll help you.
This javascript script will not work with images on backgrounds, only "img src"...
there are 2 ways to solve:
use "img src" and put "position:absolute" and positioning the image in the background.
OR
Make an if IE and instead of background-image use:
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='crop',src='link-to-image');
keep using backgroung-image for other browsers..

how to include video in jekyll markdown blog

I just started blogging using jekyll. I write my posts in markdown. Now, I want to include a youtube video in my post. How can I do this?
Also, I dont really like the pygments highlighting provided by jekyll by default. Is there anyway I can change this to some other style? If yes, can you point me to some nice styles/plugins?
You should be able to put the HTML for embedding directly into your markdown. Under the video, there is a "Share" button, click on this, and then the "Embed" button, which should give you something that looks a little like:
<iframe width="420" height="315" src="http://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>
Just copy and paste that into your post, the Markdown preprocessor won't touch it.
For Pygments, there is a whole pile of CSS stylesheets for various colour themes in this repository, you could experiment with them. (Note that you will have to replace .codehilite with .highlight for these to work with Jekyll.)
I did similar thing but in my case, simple copy and paste doesn't work. The error message is below:
REXML could not parse this XML/HTML:
To avoid this error, I deleted allowfullscreen from copied source as below:
<iframe width="480" height="360" src="http://www.youtube.com/embed/WO82PoAczTc" frameborder="0"> </iframe>
It is important that Adding a whitespace before the closing </iframe>.
Then, I succeeded to embed the video into my site.
The html code to insert a youtube video can be produced in Jekyll using a simple plugin
as described in https://gist.github.com/1805814.
The syntax becomes as simple as:
{% youtube oHg5SJYRHA0 %}
In my case issue has been resolved with jQuery:
jQuery
$('.x-frame.video').each(function() {
$(this).after("<iframe class=\"video\" src=\"" + ($(this).attr('data-video')) + "\" frameborder=\"0\"></iframe>");
});
Usage
<div class="x-frame video" data-video="http://player.vimeo.com/video/52302939"> </div>
Note that whitespace is required between <div> </div>
One of the nicer features of WordPres is that you can just paste a Youtube URL in the content (on a new line) and WordPress transforms this into an embed code.
The following code does the same for Jekyll. Just put this code in your footer (or use a Jekyll include) and all paragraphs with JUST a Youtube URL are automagically converted to responsive Youtube embeds by Vanilla JS.
<style>
.videoWrapper {position: relative; padding-bottom: 56.333%; height: 0;}
.videoWrapper iframe {position: absolute; top: 0; left: 0; width: 100%; height: 100%;}
</style>
<script>
function getId(url) {
var regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;
var match = url.match(regExp);
if (match && match[2].length == 11) {
return match[2];
} else {
return 'error';
}
}
function yt_url2embed() {
var p = document.getElementsByTagName('p');
for(var i = 0; i < p.length; i++) {
var pattern = /^((http|https|ftp):\/\/)/;
if(pattern.test(p[i].innerHTML)) {
var myId = getId(p[i].innerHTML);
p[i].innerHTML = '<div class="videoWrapper"><iframe width="720" height="420" src="https://www.youtube.com/embed/' + myId + '?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe></div>';
}
}
}
yt_url2embed();
</script>
Although just adding the HTML code to your Markdown is a very good (maybe even better) and valid solution, this solution might be more user-friendly.
(Source)
How often did you find yourself googling "How to embed a video in markdown?"
While its not possible to embed a video in markdown, the best and easiest way is to extract a frame from the video. To add videos to your markdown files easier, I think the jekyll plugin below would help you, and it will parse the video link inside the image block automatically.
jekyll-spaceship - 🚀 A Jekyll plugin to provide powerful supports for table, mathjax, plantuml, emoji, youtube, vimeo,dailymotion, etc.
https://github.com/jeffreytse/jekyll-spaceship
For now, these video links parsing are provided:
Youtube
Vimeo
DailyMotion
...
There are two ways to embed a video in your Jekyll blog page:
Inline-style:
![]({video-link})
Reference-style:
![][{reference}]
[{reference}]: {video-link}
Then, you succeeded to embed the video into your site.
In nowadays:
<iframe width="840" height="473" src="https://www.youtube.com/embed/IQf-vtIC-Uc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
Or
right click on the video in your browser and copy-past the embed code.

Resources