-
Notifications
You must be signed in to change notification settings - Fork 5
Potential desync fixes by using aresample=async=1 filter
#13
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
base: master
Are you sure you want to change the base?
Conversation
|
Did a 2 hour stream earlier that did not have any audio desync by the end. |
|
5 hour stream today and -- again -- no audio desync by the end. That settles it for me, so I won't report further successes here, only any issues I encounter. |
|
PS: also for next PRs, would appreciate using tabs, not spaces for indentation. The merge threw off my whitespacing... :-) |
|
Why is |
|
Ah, I missed the referenced issue comment with explanation #5 (comment) |
|
Thanks for merging #12, @rfht! My apologies for the accidental change from tabs to spaces! Now that #12 has been merged, I'll rebase this and fix any lingering spacing issues. Update: Regarding For video, if the Personally, I was testing at 25fps encoding on very low-end hardware and haven't run into any significant frame drops in my live streams. |
…nc as my understanding is that will let ffmpeg drop packets it couldn't process fast enough instead of forcing them to be queued and processed in order, regardless of timing. Issue rfht#5
…512', plus only on the video & audio input when encoding, not on the raw audio inputs being merged). Also introduces the use of the filter on the individual audio streams being merged/mixed-down _and_ when merging the video and audio. The latter required moving the audio encoding to the ffmpeg process which is encoding the video. By using the 'async=1' option, the 'aresample' filter will fill and/or trim audio to keep it synced, but will not perform the more advanced stretch and/or sqeezing (I think this makes sense for our uses and _should_ be more efficient). Issue rfht#5
…; if line is too long, break with additional indentation) and tabs for indentation
709e1a9 to
ef19a7c
Compare
|
@rfht I've rebased, fixed line break formatting and whitespace. I haven't had a chance to test yet, so please test before merging. I'll comment once I've tested. |
aresample=sync=1 filteraresample=async=1 filter
|
should there also be a method for the video, like for example (Edit: better |
Good question and find! I'll investigate, but I'm wondering if maybe we should consider that in a separate issue. My initial thought-process was (and still is): PR #7 updated our Regardless, I'll be doing more review & testing this weekend and will post findings & thoughts. |
|
Just did some testing and found that monitor-only mode isn't working for me. However, if I use I'll do some more troubleshooting. |
Okay, monitor mix configuration issue on my end. I had it only configured on my USB mic (which I use headphones through), so I had to switch the sndio server to that device for the monitor mix to record. So, this is actually working okay for me. I'll still investigate whether we should be using What are your thoughts, @rfht? (As always, no urgency.) |
NOTE: PR #12 should be merged prior to this PR.
I'll be doing some more live stream stress testing of this PR, but this appears to fully resolve audio/video sync issues for me and results in a far more consistent CBR for my stream (without Twitch's frequent warnings about instabilities).
The short explanation: This uses
-thread_queue_sizemuch more conservatively and only on audio/video input on the encode side of the pipe. It also introduces the use of thearesample=async=1filter, both on the the merge of microphone & monitor audio for mix down to stereo and on the encode side of the pipe so that video and audio (no longer encoded to AAC on the audio merge side of the pipe) are fully synchronized before writing to output file/stream.For the detailed explanation, see this comment on issue #5.