Vanilagy / mp4-muxer

MP4 multiplexer in pure TypeScript with support for WebCodecs API, video & audio.
https://vanilagy.github.io/mp4-muxer/demo
MIT License
390 stars 28 forks source link

Timestamps must be monotonically increasing. #25

Closed khuramhaf closed 9 months ago

khuramhaf commented 9 months ago

Dear Sir, I am designing a video editor in JavaScript. I am a using your library which is awesome anyhow some times while using large files I am facing the following error

"Timestamps must be monotonically increasing. Muxer.validateTimestamp_fn (mp4-muxer.js:1088:13)"

I am not sure if it is a bug or my coding error. I tried to fix this error a lot but could not succeed in fixing it. You can see the code by clicking following link. https://github.com/khuramhaf/Video-Editor

The code is open source and I shall be thankful to you if you kindly help me in fixing the error.

Vanilagy commented 9 months ago

The "Timestamps must be monotonically increasing" error is thrown when you add a media chunk that has a smaller timestamp than the previous one. Since it doesn't make sense to go "back in time", the library prevents you from doing this by throwing an error.

There might be an issue with your timestamp logic. You should try logging every frame you encode and seeing when the timestamps start going backwards.

khuramhaf commented 9 months ago

Thanks for your reply. I reviewed my timestamps and found that decoder is changing the timestamps. Any how I found another solution to the problem. I really want to thank you for such a great library and I will surely sponsor ur project whenever things starts working for me.

On Sat, 2 Dec 2023, 9:48 pm Vanilagy, @.***> wrote:

The "Timestamps must be monotonically increasing" error is thrown when you add a media chunk that has a smaller timestamp than the previous one. Since it doesn't make sense to go "back in time", the library prevents you from doing this by throwing an error.

There might be an issue with your timestamp logic. You should try logging every frame you encode and seeing when the timestamps start going backwards.

— Reply to this email directly, view it on GitHub https://github.com/Vanilagy/mp4-muxer/issues/25#issuecomment-1837200205, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANBTW5L5RVYJ5I7P33VTRH3YHNLVZAVCNFSM6AAAAABABNGTNOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZXGIYDAMRQGU . You are receiving this because you authored the thread.Message ID: @.***>

Vanilagy commented 9 months ago

Awesome, that's nice to hear! Can I close this issue? :)

khuramhaf commented 9 months ago

Yes, please!. Do it. Thank you once again

On Mon, 4 Dec 2023, 3:06 pm Vanilagy, @.***> wrote:

Awesome, that's nice to hear! Can I close this issue? :)

— Reply to this email directly, view it on GitHub https://github.com/Vanilagy/mp4-muxer/issues/25#issuecomment-1838215205, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANBTW5OJBRT7RGTCDBSRN2DYHWOA3AVCNFSM6AAAAABABNGTNOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZYGIYTKMRQGU . You are receiving this because you authored the thread.Message ID: @.***>