-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ffmpeg-wasm-demuxer sample #549
Conversation
ffmpeg-wasm-demuxer sample: fix 2 typos
@sandersdan, friendly ping :) |
// while the data-to-be-read is being asynchronously fetched from the network. | ||
|
||
self.debugLog = function(msg) { | ||
console.debug('[blocking worker]' + msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: , msg)
would allow more message types.
// Blocking is required because FFmpeg's AVIO read callback is synchronous, | ||
// while the data-to-be-read is being asynchronously fetched from the network. | ||
|
||
self.debugLog = function(msg) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This is the same as function debugLog(msg) {
console.debug('[blocking worker]' + msg); | ||
} | ||
|
||
debugLog(` -- worker started`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: --
not required with above change.
Nit: Template string literal not necessary for static string.
|
||
debugLog(` -- worker started`); | ||
|
||
import {FFmpegDemuxerBlockingHelper} from './ffmpeg_demuxer_blocking_helper.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work? When did it start working? (Even recently I was forced to use importSync()
in worker contexts.)
self.addEventListener('message', onMessage); | ||
|
||
async function onMessage(e) { | ||
// debugLog(`Blocking demuxer worker message: ${JSON.stringify(e.data)}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: remove commented code.
this.#readPtr += numBytes; | ||
} | ||
|
||
_onChunk(chunk) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Private methods can also just be #
(although there may be cases where that is impossible because a "caller" is external; #
private is very private).
import {SharedReadBuffer} from './shared_read_buffer.js' | ||
import {PullDemuxerBase, AUDIO_STREAM_TYPE, VIDEO_STREAM_TYPE} from '../library/pull_demuxer_base.js' | ||
|
||
let Module = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: module
, or better wasmModule
.
@@ -0,0 +1,29 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File seems incomplete?
let audioRenderer = null; | ||
|
||
self.addEventListener('message', async function(e) { | ||
// console.info(`Worker message: ${JSON.stringify(e.data)}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Remove commented code.
Chris left Google and unfortunately won't be able to complete this PR. Chris you mentioned you might want to try to close this out still. Did you want me to leave this open for a bit longer? |
Did somebody already tried to demux a file with a video and audiostream? Currently I get the following warnings from FFmpeg:
When I try to read a Chunk, FFmpeg gives me the following error: Invalid data found when processing input |
This copy of ffmpeg is built without proprietary codecs, otherwise we wouldn't be able to host/share it. You'll have to tweak the ffmpeg build options if you want other codecs enabled. |
Going to close this PR for now since we don't have anyone to finish it at this time. Others are welcome to clean it up and land it if they're so inclined. |
I'm interested to have a look at this if I can make some time. |
Hey, sorry that I still comment under a closed PR but I am currently working on it. I am almost finished with this project, but have two thing I still dont understand / I am struggling with.
|
Please see a live demo here
https://chcunningham-samples.netlify.app/ffmpeg-wasm-demuxer/wasm_demuxer_demo.html
Partial fix for #78