Skip to content
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

Update encoding loop to recommended algorithm; add drain loop. #203

Merged
merged 1 commit into from
Jul 1, 2022

Conversation

dbruning
Copy link
Contributor

#191 mentions that the code in H264VideoStreamEncoder.cs isn't a "correct" encoding loop.
I implemented the recommended loop from https://ffmpeg.org/doxygen/4.1/group__lavc__encdec.html
It's a bit more verbose than it needs to be, but explains the algorithm as it goes.

I think the original H264VideoStreamEncoder.cs had 2 problems:

  • the output would have missing (or maybe duplicated) frames at the start, because it kept sending the same frame in rather than sending it once and then reading packets (if any) until EAGAIN
  • the output would have missing frames at the end, because it didn't drain.

Thanks for your great work in this project!

@Ruslan-B
Copy link
Owner

Ruslan-B commented Jul 1, 2022

Thank you for the contribution. I might tweak it later on but only with respect to coding standards. I keep auto generation running but lacking time to observe changes in documentation or examples. I had to admit FFmpeg API going to be more and more complex over years.

@Ruslan-B Ruslan-B merged commit 8c14724 into Ruslan-B:master Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants