israel-fl / bitmap2video

Generate video from Image resources, Bitmaps or a Canvas. Allows for audio multiplexing.
Apache License 2.0
89 stars 27 forks source link

Buffer Underrun #8

Open dburckh opened 3 years ago

dburckh commented 3 years ago

https://github.com/israel-fl/bitmap2video/blob/f51c404aed29e5f7043144a2ddc738f51b589d21/library/src/main/java/com/homesoft/encoder/Muxer.kt#L82

So, I'm not sure how this is working. Generally you want to interleave audio and video together. It looks like you are dumping all the video and then dumping all the audio. So, you'll end up with a bunch of video frames, followed by a bunch of audio frames. This may work for MP4 because it bunches things up in the file. My assumption is at some point you'll underrun the player buffer and lose audio. It probably won't stream very well. I have 3 theories, 1) The files are so small it doesn't matter. 2) Android is covering you sins. 3) I'm not correct in how this works. :)

israel-fl commented 3 years ago

Android is covering your sins

All praise be to thee Android gods 🙏

But in all seriousness, I'll read up more on how to mux both frames together.

kochchy commented 3 years ago

@israel-fl it even crashes when no audio is added