-
Notifications
You must be signed in to change notification settings - Fork 1
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
LU-3510 Adding duration support for webm #61
Conversation
return this.ptsToTime(this.#demuxer.streams[this.#streamIndex].duration); | ||
const stream = this.#demuxer.streams[this.#streamIndex]; | ||
if (stream.duration !== null) { | ||
return this.ptsToTime(stream.duration); |
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.
Hm, when I was playing with libav, I noticed that duration is negative sometimes. are we sure it's not the case here?
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.
The duration is "null" in this case.
@@ -73,6 +73,19 @@ describe('FrameFusion', () => { | |||
await extractor.dispose(); | |||
}); | |||
|
|||
it.only('can get duration from webm', async() => { |
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.
it.only('can get duration from webm', async() => { | |
it('can get duration from webm', async() => { |
test/framefusion.test.ts
Outdated
}); | ||
|
||
// Act and Assert | ||
expect(extractor.duration).to.equal(115); |
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.
@animanathome can we use test data which we inspect in this repo?
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.
I'm not sure what you mean with that @stepancar
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.
This doesn't work for you locally?
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.
@animanathome I mean, can we put that video to this repo directly so it would be easy to call ffprobe
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.
Just a minor question
src/backends/beamcoder.ts
Outdated
if (stream.duration !== null) { | ||
return this.ptsToTime(stream.duration); | ||
} | ||
if (stream?.metadata?.DURATION) { |
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.
I don't think it's reliable. it is just a dictionary
https://ffmpeg.org/doxygen/7.0/structAVStream.html#a4e04af7a5a4d8298649850df798dd0bc
Have you tried this?
https://stackoverflow.com/a/27208276
it seems like beamocoder executes similar code under the hood, so, the duration should be available somewhere
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.
Note that stream.duration
is null in this case.
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.
Actually, we can call duration on the parent object which seems to return the correct value. I'm going to use that instead.
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.
exactly , beamcoder executes code from stack overflow and it expands avformat context
The stream's duration can be
null
. In those cases, the duration may be described as part of the stream's metadata. We found that in our webm's generated by D-ID. In this PR, we add to return the stream's metadata's duration if available.