Yahweasel / libav.js

This is a compilation of the libraries associated with handling audio and video in ffmpeg—libavformat, libavcodec, libavfilter, libavutil, libswresample, and libswscale—for emscripten, and thus the web.
288 stars 18 forks source link

Get progress for `ffmpeg()` #37

Closed reinhrst closed 7 months ago

reinhrst commented 7 months ago

I was wondering if there is some way to get progress information when using ffmpeg()

I'm doing a simple remuxing (input.MTS -c:v copy -an -y output.mp4), and it takes 1 or two minutes for a 4GB file. This is completely acceptable, but it would be good if there is some way to keep track of progress to show some sort of progress bar.

I could manually do the remux (and have a progress bar) but I think ffmpeg does some special things that I would have to find out how to add.

I could also keep track of how many bytes were written and (considering that in this case output is going to be something like 95% of input), make something useful, but that is very specific to this case.

I guess that getting access to the default ffmpeg stdout would already do the trick (since I could parse it and get the info I need), but there may also be some other way.

marcello3d commented 7 months ago

You can use the -progress option in ffmpeg and write to a writer device

reinhrst commented 7 months ago

Perfect, thanks! Makes sense that the answer was in ffmpeg's command line options :)