WASM + React... Easily build video editing software with JS & FFmpeg

Поделиться
HTML-код
  • Опубликовано: 9 сен 2024
  • Use Web Assembly to build an app that converts video files to GIF (using FFmpeg), entirely from a frontend React JavaScript application. fireship.io/le...
    Source Code: github.com/fir...
    FFmpeg.wasm ffmpegwasm.git...
    #wasm #webdev #tutorial
    Install the quiz app 🤓
    iOS itunes.apple.c...
    Android play.google.co...
    Upgrade to Fireship PRO at fireship.io/pro
    Use code lORhwXd2 for 25% off your first payment.
    My VS Code Theme
    - Atom One Dark
    - vscode-icons
    - Fira Code Font

Комментарии • 274

  • @YahirTrejo
    @YahirTrejo 3 года назад +161

    Man that was amazingly simple, I was scared of web assembly but I might start learning now. Also unrelated but have you considered doing a react course?

    • @Fireship
      @Fireship  3 года назад +57

      Yes, working on a React-Firebase course :)

    • @kordoulakis
      @kordoulakis 3 года назад +3

      @@Fireship It'll be the first time I've bought a course then

    • @YahirTrejo
      @YahirTrejo 3 года назад +1

      @@Fireship Great! Looking forward to it!

  • @joaovaz3473
    @joaovaz3473 3 года назад +402

    What people see: WASM allows one to run server tasks on the client
    What I see: serverless SQL injection

    • @jorgekunrath1016
      @jorgekunrath1016 3 года назад +35

      not sure if that's a joke or a real thing because i don't have very much knowledge on the subject, so, honest question:
      there's a point on do that? i mean you could hack it (could u?), but it will be only in your browser because nothing was sended to the server, right? so...

    • @joaovaz3473
      @joaovaz3473 3 года назад +27

      @@jorgekunrath1016 it was originally a joke. But now, re-thinking about it... you've got a point!

    • @jorgekunrath1016
      @jorgekunrath1016 3 года назад +5

      @@joaovaz3473 cool joke tho and thanks ^^

    • @Fireship
      @Fireship  3 года назад +137

      Good way to practice your hacking skills before taking them to a real server.

    • @myxmad800
      @myxmad800 3 года назад +3

      @@Fireship buddy what file icon theme do you use pls state it

  • @edwincarlsson9014
    @edwincarlsson9014 3 года назад +31

    I’ve been looking forward to this!

    • @Fireship
      @Fireship  3 года назад +14

      Me too, but more WASM content on coming soon :)

  • @jakobarsement8266
    @jakobarsement8266 3 года назад +11

    Been watching these for about a year now and dude, your videos are tremendous. You are a tremendous instructor. You keep it cutting-edge, concise, and super informative. Thank you.

  • @thomasjardanedeoliveirabou9993
    @thomasjardanedeoliveirabou9993 2 года назад +166

    Sadly the Source Code doesn't work anymore because of the Spectre Vuneability in modern browsers. They disabled SharedArrayBuffer which was essential for this to work (for some reason, i am not an expert on this). So before you try this, try to find a more recent video =D

    • @Vishnu-oo4gh
      @Vishnu-oo4gh 2 года назад +4

      @@yotubecreators47 wow thank you!

    • @batmanatkinson1188
      @batmanatkinson1188 2 года назад

      is it also disabled on Apple M1?

    • @ABDTalk1
      @ABDTalk1 Год назад +1

      @@yotubecreators47JavaFX is so good though

    • @BelugaSam
      @BelugaSam Год назад

      @@yotubecreators47 is their any solution for vue too?

    • @irahazda
      @irahazda 11 месяцев назад

      Thank you man. Saved my time.

  • @Apoorvpandey
    @Apoorvpandey 2 года назад +23

    I ran into these errors:
    1. ffmpeg was not loading in browser:
    Soln: downgrade ffmpeg version to 0.9.0
    2. SharedArray buffer error:
    Soln: Run chrome wuth this flag "chrome --enable-features=SharedArrayBuffer "

    • @creativeusername4400
      @creativeusername4400 Месяц назад

      incase anyone's wondering how to downgrade the ffmpeg version
      run `npm uninstall @ffmpeg/ffmpeg`
      then run `npm install @ffmpeg/ffmpeg@0.9.0

  • @jaforewit
    @jaforewit 3 года назад +13

    In your Rust to WASM video, I'd love to see some sort of visuals in rust port over to visuals on the browser

  • @parikshitthale7708
    @parikshitthale7708 3 года назад +26

    How about Intro to AssemblyScript 🔥🔥

  • @CodingUnited
    @CodingUnited 3 года назад +63

    How 'bout a 2d Rust game compiled to WASM? The game could be a flappy bird clone.

  • @OBLIVIOUSKARI
    @OBLIVIOUSKARI 3 года назад +2

    Omg I’m so pumped for the rust web assembly video. I am a rust dev and would like to get some benefit from it on the web

  • @aminehl6025
    @aminehl6025 2 года назад +1

    Thank you very much

  • @captainlennyjapan27
    @captainlennyjapan27 3 года назад +5

    Can someone please help? I cannot move forward due to SharedBufferArray undefined error...

  • @rubenpoppe
    @rubenpoppe 3 года назад +15

    Hi Jeff, could you do a video on how to use 'raw' wasm code? In this video you use a wrapper javascript library.

  • @jessejordan8569
    @jessejordan8569 3 года назад +3

    Great stuff as always.
    Still can't believe Nathan Fielder is this knowledgeable on web dev!

  • @CodeWithAndrea
    @CodeWithAndrea 3 года назад +2

    Awesome video as usual! Really cool to see how to use all these things together!

  • @acollierr17
    @acollierr17 3 года назад +3

    Been looking forward to this, Jeff! Definitely going to expand on this sometime in the future on my own project. Thanks!

  • @DrSwad
    @DrSwad 3 года назад +4

    Awesome work man

  • @fevicoI
    @fevicoI 3 года назад +21

    We are about to enter an age, when there would be no OS. Just JS & Chrome. Your OS would be Chrome and everything else loaded in WASM. SMFH.

    • @MatthewTaylor86
      @MatthewTaylor86 3 года назад +14

      Wait until you hear about Chromebooks 🤣

    • @fevicoI
      @fevicoI 3 года назад +4

      @@MatthewTaylor86 those are awful

    • @iyxan2340
      @iyxan2340 3 года назад +1

      Linux, WASM edition :p

    • @fevicoI
      @fevicoI 3 года назад

      @@iyxan2340 Chrome-book would literally be Wasmbook

    • @nhat4359
      @nhat4359 3 года назад +3

      For some people, Windows is already just a bootloader for Chrome

  • @miguel_bogota
    @miguel_bogota 3 года назад +3

    I don't know how you make this videos so interesting always!! Thank you, I think an AssemblyScript video will also be awesome.

  • @dibaliba
    @dibaliba 3 года назад +6

    🔥🚀 I have press the like button when I get into this page at the very first time, coz there is no chance this video will have crap content.
    未看先讚啦!!!

  • @prashoonbhattacharjee8211
    @prashoonbhattacharjee8211 3 года назад +3

    This tutorial is fantastic!! Got a lot of value from this tutorial!!

  • @amoldalwai3961
    @amoldalwai3961 3 года назад +3

    3:53 great way to add a preloader ,never thought of it that way

    • @Fireship
      @Fireship  3 года назад +4

      You can also use React Suspense for things like that, but that's a topic for another video...

    • @DrSwad
      @DrSwad 3 года назад +1

      You might also want to take a look at swr.vercel.app/. It deals with fetching data while showing a loading state or optionally showing already cached data while the data is being updated. It also supports infinite scrolling and react-native. Not exactly related to this video's scenario, but you might find it cool.

    • @amoldalwai3961
      @amoldalwai3961 3 года назад +1

      @@Fireship thanks ...I made a react app that actually allows you to watch movies and web series online.
      amoldalwai.github.io/watch-any-movie/
      Can I get your thoughts on it?

  • @Daimyo7
    @Daimyo7 3 года назад +6

    Going to be honest here I was looking at the same technology about 2 years ago.
    I worked on a transcoding project with multiple video streaming m3 u8, vast advertising.

  • @mikemartire1612
    @mikemartire1612 3 года назад +1

    I definitely asked for this video and you delivered, thanks a bunch! Great video as always Jeff, very very useful

  • @wizamit
    @wizamit 3 года назад +2

    This is awesome. Thank you for this great introduction to WA ❤

  • @ridl27
    @ridl27 3 года назад +2

    great stuff man, ty. now its really open my mind for WASM :D

  • @davidhusicka8440
    @davidhusicka8440 3 года назад +2

    Really excited for the rust video. I could port my CLI app to web if you keep on your promise. Amazing as usual! Keep it up!

  • @thecoderabbi
    @thecoderabbi 2 года назад +2

    This is helpful

  • @dj_256
    @dj_256 7 месяцев назад

    Dude just accomplished my dream tool in under 8 minutes lmao

  • @nithinchinni
    @nithinchinni 2 года назад +4

    Can you fix the codebase that you shared in GIT. When I tried to run it, it throws an error: ffmpeg-core.js:22 Uncaught (in promise) ReferenceError: SharedArrayBuffer is not defined

  • @MrChernicharo
    @MrChernicharo 3 года назад +1

    Amazing! More videos on WebAssembly please!

  • @yampolskie
    @yampolskie 3 года назад +1

    It seemed tough to build but you made it look so easy!

  • @jamesxu4538
    @jamesxu4538 3 года назад +1

    Oh I've watched a video about the chopped truck. THe bridge was elevated, but still choppin the trucks

  • @NicolaiWeitkemper
    @NicolaiWeitkemper 3 года назад +1

    Amazing! I can't wait to see more WASM content.

  • @WrongAkram
    @WrongAkram 3 года назад

    This is sweet! I was thinking about using wasm to try to make a video editing tool on the web.

  • @nadawhoever
    @nadawhoever 2 года назад +2

    I cloned the repo and it gave me this error "SharedArrayBuffer is not defined"

  • @aaron32190
    @aaron32190 3 года назад +3

    Would love to see a vid about assembly script :)

  • @theseriouslook
    @theseriouslook 3 года назад

    I am fan of your way of telling things as they are very easy

  • @HenokWehibe
    @HenokWehibe 3 года назад

    Another really useful video, will try it with my open alpr project great work again.

  • @ChunkyChest
    @ChunkyChest 2 года назад

    Thanks for this!! can't wait to dive wasm :D

  • @TheRanguna
    @TheRanguna 3 года назад +4

    Awesome video, so incredibly simple.
    Now I'm going to read more in depth about how to create these Web assembly files and bind them to javascript. Can't wait for the rust to wasm video!!
    Do you know if FS will conflict with other tabs accessing the same file ?
    This could be a problem, even two tabs overwriting the same place in memory.
    But I'm guessing this only runs in the current context of the tab.
    Another question, can we access the whole file system with wasm ?
    I'm not really sure what the `video` var contained, but could we somehow build it so we could access any file in the system or is the browser sandboxing this ?
    Thanks!!

  • @aryanmn1569
    @aryanmn1569 2 года назад

    u r hero of making things look simple

  • @surbhigoel7062
    @surbhigoel7062 3 года назад +2

    not working on crome v92....can you suggest how to set cors?

  • @HackUniversity
    @HackUniversity 3 года назад

    Wow! This is simply amazing! Everyone should see this! :)

  • @talha-nagorik
    @talha-nagorik Год назад

    Just what I was looking for 🔥

  • @DodaGarcia
    @DodaGarcia 3 года назад

    Oh wow this one went way over my head

  • @amanraj1608
    @amanraj1608 3 года назад +1

    Finally most awaited video 🌟✨

  • @djcardwellai
    @djcardwellai 3 года назад

    These videos are gold. Thank you so much

  • @vietnamnguyen369
    @vietnamnguyen369 3 года назад

    That's what I am looking forward. I am also trying to develop custom rust code and covert it to WASM. That's cool.

  • @SogMosee
    @SogMosee 3 года назад +4

    1. Create react and react fiber in rust, then have a ui framework entirely in webassembly
    2. Rewrite typescript in webassembly and have faster linting

    • @oplik0
      @oplik0 3 года назад +2

      1. You want to have core of React in wasm and an JS API? I'm not sure if the overhead due to the need for communication between JS and WASM (not just with the api, but WASM can't modify DOM, so it needs to call JS to do that).
      2. There is a TS compiler in rust, SWC: swc.rs/
      It's not WASM, but why would you run typescript compiler in the browser anyway?
      SWC is already used by Deno, though TSC still handles the actual typechecking (github.com/denoland/deno/issues/5432)

  • @ShafterPlay
    @ShafterPlay 3 года назад

    Your videos are sooooo amazing I can't even tell

  • @uniqhnd23
    @uniqhnd23 3 года назад

    Really good music in the beginning 👌

  • @daksmemes7428
    @daksmemes7428 3 года назад

    excited for web assembly

  • @sicknickeroni
    @sicknickeroni 2 года назад +2

    i keep getting this: Uncaught ReferenceError: createFFmpegCore is not defined I can't find a fix. Does anyone know how to fix it?

  • @omegaomar29
    @omegaomar29 3 года назад

    Amazing, WASM it's so powerful, i'll try this example.

  • @manvendrasingh4556
    @manvendrasingh4556 Год назад +1

    please update the wasm changed some functions and features like i can't able to use createFFmpeg

  • @prashoonbhattacharjee8211
    @prashoonbhattacharjee8211 3 года назад

    Pumped to make this project!!

  • @ymi_yugy3133
    @ymi_yugy3133 3 года назад +2

    WASM decreased the size of the gap between the web and native substantially, but the lack of access to hardware encoders and decoders still remains an issue.

    • @fltfathin
      @fltfathin 2 года назад

      Wdym hardware encoder decoder? For video file? Or interfacing with hardware? For the second one, we have webusb/ webserial

    • @ymi_yugy3133
      @ymi_yugy3133 2 года назад

      @@fltfathin I should have been clearer. I mean for video.

    • @fltfathin
      @fltfathin 2 года назад

      @@ymi_yugy3133 thanks for clarifying, hardware video codec is indeed a problem, maybe can be alleviated by doing codec with webgl or the likes.

    • @ymi_yugy3133
      @ymi_yugy3133 2 года назад

      @@fltfathin it can’t. GPU implementations of video codecs are rarely faster than CPU implementations and when they are they need to be tuned for a specific model of GPU and require low level APIs like Vulkan and tweaks to the driver and probably even shader compiler. I would be extremely surprised if this was possible with WebGPU yet alone WebGL. But even those successful GPU implementations are still orders of magnitudes slower or less power efficient than ASICS.

  • @Yuu-6883
    @Yuu-6883 3 года назад +4

    The overhead of ffmpeg compiled to wasm is huge and converting a video to gif is not computational expensive. When it comes heavier tasks like encoding, ffmpeg in browser runs significantly slower. I think the title is a bit misleading or too ambitious as “video editing” is mostly frame encoding tasks which is not practical at all with the wasm build. The wasm build doesn’t have access to native gpu drivers and that will make process even slower than a native app, which is why nobody has ever tried to port an actual video editing software like Vegas or AE to the web because the performance would be 20x worse. But for simple tasks like converting video to gif, doing it on the frontend is fine I guess.

  • @JeremyChone
    @JeremyChone 3 года назад +3

    Good vid. Curious to know the licensing restriction for this type of "distribution."

    • @katech6020
      @katech6020 3 года назад +1

      FFMPEG is a FOSS tool, so it is not a problem in this case. but in other cases, I get what do you mean

  • @tippy_
    @tippy_ 3 года назад

    slowly and slowly wasm is starting to tickle my curisoity

  • @rand0mtv660
    @rand0mtv660 3 года назад

    Hmm you using React more and more? I always thought of you as an Angular guy. It's good to see that you are open to everything.

  • @johnstorm589
    @johnstorm589 3 года назад

    The future is now, old man!

  • @pro-nav
    @pro-nav 3 года назад

    coming first is really exciting

  • @fevicoI
    @fevicoI 3 года назад +2

    Uncaught TypeError: Failed to execute 'importScripts' on 'WorkerGlobalScope': This document requires 'TrustedScriptURL' assignment.
    Been getting this error. Any idea why?

  • @thenextdoorneighburre458
    @thenextdoorneighburre458 3 года назад

    Fire ship you truly are a god of tutorials

  • @brucewayne2480
    @brucewayne2480 3 года назад

    Amazing !!! It inspires me to code a simple app to gain some money 😛 (I ve never done it and dont know how to monetize something like that aside ads)

  • @sridharkatta3461
    @sridharkatta3461 3 года назад

    May be in future plan an intro to rust and how we can write web assembly code using rust, I am really interested in those kind of videos.

  • @Iglum
    @Iglum 3 года назад

    FFmpeg is my favorite program

  • @DaggieBlanqx
    @DaggieBlanqx 3 года назад

    Wow! Thank you!

  • @nathandaven
    @nathandaven 3 года назад

    Webassembly is so crazy

  • @poopoo888888
    @poopoo888888 6 месяцев назад

    Very valuable content! Thank you very much!

  • @Vim_Tim
    @Vim_Tim 3 года назад +8

    Upload to GIPHY... which converts the GIF back to an MP4 file 😂

  • @jaimerojas6578
    @jaimerojas6578 3 года назад

    Well, that was pretty cool!

  • @sumukhakb2701
    @sumukhakb2701 3 года назад

    Awesome tutorial . Please make a video converter using WASM and ffmpeg

  • @malikmouhiidine9828
    @malikmouhiidine9828 3 года назад

    Please do a full course about webAssembly!

  • @Abhinavkmr
    @Abhinavkmr 3 года назад

    Thank You so much!!!

  • @alejkun4923
    @alejkun4923 3 года назад

    Idea: Add Tensorflow to have Text hovering over tracked objects

  • @kumaramresh7905
    @kumaramresh7905 2 года назад +1

    Uncaught (in promise) ReferenceError: SharedArrayBuffer is not defined, getting this error

  • @supremelizard946
    @supremelizard946 2 года назад

    If you use youtube-dl or one of the forks you can go from a source video straight to a gif I have a personal bash script that does that for me

  • @aspiringpro
    @aspiringpro 3 года назад +2

    I want to be able to load a video, draw on that video(using canvas?), and then save it as a new file with the drawing visible. I also want to be able to have some sort of trim controls. Is something like this possible?

  • @AB3D-tutorials
    @AB3D-tutorials 3 года назад

    This is really cool!

  • @SpaghettDev
    @SpaghettDev 3 года назад

    Back at it again!

  • @timkelly9886
    @timkelly9886 2 года назад

    Hey Jeff, are you still planning to create the Rust to WASM tutorial? That would be super cool

  • @31redorange08
    @31redorange08 3 года назад +22

    Alternative title: How to create a memory leak by not revoking object URLs.

    • @engineeringwithai
      @engineeringwithai 3 года назад +4

      it gets removed on page close right?

    • @nguyenhoangminhtrung2779
      @nguyenhoangminhtrung2779 3 года назад +8

      now all the C/C++ pointer, memory issues will occurs much more easier on the Web

    • @31redorange08
      @31redorange08 3 года назад

      @@engineeringwithai Yes. But that's not a good reason to be sloppy while developing web apps.

    • @ambarmutha8504
      @ambarmutha8504 3 года назад +1

      @@engineeringwithai As per this answer, there is no guarantee. stackoverflow.com/questions/28896028/do-javascript-memory-leaks-matter-after-a-page-refresh-why

    • @engineeringwithai
      @engineeringwithai 3 года назад +2

      @@ambarmutha8504 developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL
      The URL lifetime is tied to the document in the window on which it was created.
      as per MDN documentation it states its lifetime is for window.

  • @tegaogheneovo5881
    @tegaogheneovo5881 2 года назад

    hey, hey thank you , i mean it ...sensei🤗😘😘😘😁 yah i need this, download

  • @albertbennett6290
    @albertbennett6290 3 года назад

    Weird request, but can we have Reasonml in 100 seconds?
    Your videos are great by the way!

  • @rubenuijtde
    @rubenuijtde 3 года назад +3

    The code at 8:01 is mindblowing :O
    Great video by the way!

    • @fire_boat
      @fire_boat 3 года назад

      ? 8:01 is the end

  • @ikezedev
    @ikezedev 3 года назад

    Great video as always. I heard you say Rust 😍😋

  • @alexzinkevych3596
    @alexzinkevych3596 3 года назад

    This video is not about WASM. It is about using FFmpeg which is already wrapped to be used in JS.

  • @johncerpa3782
    @johncerpa3782 3 года назад

    Very cool

  • @TheEtsgp1
    @TheEtsgp1 2 года назад

    An idea I would like to see is how to handle editing videos and how to store and retrieve those videos in the local file system in react for different users e.g user 1 and user 2? sadly there is not very many resources showing how to work with react and video media

  • @keteremillpario
    @keteremillpario 3 года назад +1

    It would be interesting to see how you deploy this app on the web.
    One aspect I'm oblivious is how to bunddle everything up.
    Since you said that WASM binary it's a pretty large file, how do you give that to the client? I mean the ffmpeg object is already there, is the .load() method that brings it down to the computer client or the client already downloaded it? Sorry if I'm confusing some concepts here.

    • @jorgekunrath1016
      @jorgekunrath1016 3 года назад

      I guess that FFMPEG does it in the background with .load() (2:58). Or the files already was bundled in the application, but not really downloaded and that function did that, but he mention CDN so not sure
      this part got me too

    • @keteremillpario
      @keteremillpario 3 года назад +1

      ​@@jorgekunrath1016 indeed, I took a look at the documentation. What's bundled and sended to the user is always a javascript bundle. From there, once in the client enviroment, the script triggers the method .load() (this is an API call that downloads ffmpeg-core.js from a CDN - the file occupies arround 25MB! That's the reason you trigger load() from the client with an async function). Afterwards the method instantiate a .wasm code (or session), all in the browser.

    • @jorgekunrath1016
      @jorgekunrath1016 3 года назад

      @@keteremillpario wow thats cool, thanks for share ^^

  • @PTM1008
    @PTM1008 3 года назад

    Next level stuff

  • @VeryBlueBot
    @VeryBlueBot 3 года назад

    thanks very useful

  • @martinmaldonado4923
    @martinmaldonado4923 3 года назад

    You're a legend!

  • @DioArsya
    @DioArsya 2 года назад

    Wow............

  • @mariusandersons
    @mariusandersons 3 года назад +1

    how to add download feature to generated gif ?

  • @kevinbatdorf
    @kevinbatdorf 2 года назад

    Where's the rust course mentioned at the end?

  • @NicoZadeh
    @NicoZadeh 3 года назад +1

    What theme are you using on the code editor?