Comments (16)
Hello, I am experiencing same kind of issue here.
When I try to export I get a corrupted file.
On Firefox export works and file can be open with VLC,
with Chrome, I get a buggy file with the sound and only few images of the video.
If I set a video element src with the blob URL, video is correctly playing...
Looks like an encoding problem
Did you guys find a solution ?
Thanks for your help !
from etro.
Hello, what was the code you used to export it?
from etro.
For the blob creation i passed type and codec to Vidar like this:
this._mediaRecorder = null;
resolve(
new Blob(recordedChunks,
{"type" : "video/mp4","codec":"h264"}
));
then after the creation of blob file i used StreamSaver, just like that,
const fileStream = streamSaver.createWriteStream('rendered_video.mp4', {
size: blob.size
});
const readableStream = blob.stream()
if (window.WritableStream && readableStream.pipeTo) {
return readableStream.pipeTo(fileStream)
.then(() => console.log('done writing'))
}
// Write (pipe) manually
window.writer = fileStream.getWriter()
const reader = readableStream.getReader()
const pump = () => reader.read()
.then(res => res.done
? writer.close()
: writer.write(res.value).then(pump))
pump();
but the rendered video is corrupted, i am in the final step, i created 3D/2D animation and i will share them later after i fix some bugs, i will also share a new webapp based on Vidar library in the next days, i have only one big problem now which is export movie to mp4 with h264 using JS only, i hope you can help me in that.
Animations i made until now :
3D Filp 360deg
3D Rotation 360deg
2D Rotation 360deg
2D Zoom
Fade In
from etro.
Is the first code block your code or vidar's? Also, what version or commit hash of vidar are you using?
Oh, awesome!! My twitter handle is @clabe45 if you want to chat more about that!
from etro.
Hello i am following you like one month ago, but i can't send you a private message, here is my twitter @eboujlal .
The first code block is Vidar's code modified directly, and the second block is my own code to save blob as mp4 but it's not working, i get always a damaged mp4 video.
from etro.
Ah, sorry I haven't check Twitter for a while. I just followed you back so we can now chat haha
Try putting the codecs in the type
option, as documented here:
movie.record({ framerate: 30, type: 'video/mp4; codecs="h264"' })
(I am not sure if that is the right name for the codec you want)
from etro.
Hello, after I tried the latest update which i had to modify the whole code because the way we create instance of classes like Text or Image changed from a parameter with simple value to a parameter with object, that make it difficult to migrate to migrate from last version to the current version, but the current looks more structured and clean.
I sill have a problem with the exportation, and that is the blob i got after i record the movie :
blob:null/02e99e20-6505-48c0-beb0-7bbbe8e43950
I can export and download the video as mp4 video, but it is damaged and corrupted, and this is the problem i want to fix.
Here is the exported video :
https://user-images.githubusercontent.com/13316965/106412340-d42b5f80-6447-11eb-810c-b58c81539e49.mp4
from etro.
Yeah, migrating was a concern of mine, but I thought it would be better to change all the arguments to be in options
sooner than later.
Can you post the code you used to call the record
method of Movie
?
from etro.
Hello,
Here is the code i used to render the video and call record method :
$('#render').on('click', function(e){
layersToVidar();
$('#canvasPreview').hide();
$('#controllers').hide();
$('#videoSection').hide();
$('#videoPreview').show();
$('#waitRendering').show();
$('#videoSection').hide();
$('#timeLinePreview').hide();
$('#previewModal').modal('show');
video.record({ framerate: 60, type: "video/mp4;codecs=h264" }).then(blob => {
const output_video = document.querySelector('#videoSection video')
output_video.src = URL.createObjectURL(blob);
// console.log(videoObj);
rendered_video = blob;
$('#waitRendering').hide();
$('#videoSection').show();
$('#downloader').show();
}).catch(error => {
throw error
})
});
And for saving the blob file to mp4 i used StreamSaver :
$('#saveAs').on('click',function(e){
e.preventDefault();
const fileStream = streamSaver.createWriteStream('rendered_video.mp4', {
size: rendered_video.size
});
const readableStream = rendered_video.stream()
if (window.WritableStream && readableStream.pipeTo) {
return readableStream.pipeTo(fileStream)
.then(() => console.log('done writing'))
}
// Write (pipe) manually
window.writer = fileStream.getWriter()
const reader = readableStream.getReader()
const pump = () => reader.read()
.then(res => res.done
? writer.close()
: writer.write(res.value).then(pump))
pump();
});
from etro.
I get that warning too sometimes, but I can still play it (at least when I set a video element's src to the blob url). Can you try setting a video element's src to the blob's url instead of downloading? Not sure but that might work, and then we can work from there.
from etro.
I can show the rendered video, by adding this code :
const output_video = document.querySelector('#videoSection video')
output_video.src = URL.createObjectURL(blob);
But the problem still in saving the video as mp4 and with the good codec.
from etro.
@jjf21 you can play it but frames are dropped? That might be the realtime recording not giving enough time to process well, which is a different issue.
from etro.
@eboujlal Looks like a FF issue. I can open the mp4 you provided in chrome and VLC. VIdar relies on the MediaStream Recorder API.
from etro.
I'm going to close this. If you think this is not a browser issue, feel free to re-open.
from etro.
Hey everyone, it turns out the type
option was being ignored by record
, so it most likely is a Vidar issue. It should be fixed for the next release. You can test it with the master branch if you want. Thanks for opening the issue, it always helps to know what bugs are out there!
from etro.
I know it's been a while, but version 0.8.3 has been released. Should be fixed now
from etro.
Related Issues (20)
- Add `onDraw` option to `Movie.play()` HOT 2
- Add `onDraw` option to `Movie.stream()`
- Add `onDraw` option to `Movie.record()`
- Seeking during playback doesn't seek the movie's current time HOT 2
- Can't add an outline to a text layer HOT 2
- Mute karma browser output
- `test:*` scripts in `package.json` cannot be run on Windows because of syntax error
- Can't resolve 'etro' on Next 13. HOT 13
- Quality loss when resizing picture
- `Shader` effect always rendering as solid black in firefox on macos
- Deprecate `mediaRecorderOptions`
- Non-numeric keyframe values throwing compile-time type error
- `this.data is undefined` when calling `Transform.apply()` with dynamic matrix
- Deprecate and rename `Layer.render`
- Replace `unknown` in `KeyFrame.value`'s type HOT 1
- Deprecate function properties
- Deprecate `time` parameter for `val()`
- Release commit log link broken
- Type `KeyFrame` constructor to accept custom interpolation functions
- Can't read an image layer while rendering the movie. The image is from remote, like (https://image/) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from etro.