Dear nia, On 2020-03-14, Yorick Hardy wrote: > On 2020-03-14, Yorick Hardy wrote: > > Dear nia, > > > > On 2020-03-14, nia wrote: > > > On Sat, Mar 14, 2020 at 12:20:11AM +0200, Yorick Hardy wrote: > > > > You are correct. I threw together a NetBSD audio driver based on the oss > > > > driver, but it had exactly the same problem. Strangely, I have been > > > > unable to > > > > reproduce the problem on an old i386 netbook (so far). > > > > > > > > I wrote a test program to try and reproduce what ffmpeg is doing, and > > > > (I am not sure yet) it seems like non-blocking reads is causing the > > > > distortion. The same test program with blocking reads seems to work > > > > okay. > > > > > > > > I will look into it a bit more, and then report back. > > > > > > Right, /dev/audio doesn't support non-blocking I/O. But you're supposed to > > > do short enough reads and writes that it shouldn't matter. That might be > > > the cause of the worst of the problems. > > > > Oops, I think the man page might need to be updated then. > > I managed to convince my test program to correctly record > > with non-blocking I/O (perhaps by accident?) by working > > a bit differently to ffmpeg, but I am not sure how to > > adjust ffmpeg in this way. I will try blocking reads > > (presumably reading blocksize bytes at a time). > > > > Re: audacity (earlier in the thread), audacity hangs whenever I try to > > record. I probably need to update all of my packages - but I am not > > doing any long builds at the moment due to unpredictable electricity > > supply! > > > > > Do you want to work on this together somewhere? > > > > Yes, that would be great! As long as you don't mind someone who is > > extremely unresponsive most of the week! I have quite a few deadlines > > in the next week, and will probably ignore most things while I am > > doing that work. > > > > Attached are the patches for my "testing" version of the ffmpeg > > backend (heavily based on the OSS backend). I am sure it should be > > renamed to "netbsd", initially I was trying for sun compatibility - > > but I am not sure that makes sense. > > Just a side note that I keep forgetting to mention: I used ffmpeg > and oss to record videos over the last few years and "it used to > work fine". I think that the most recent audio changes have > broken some expectations that ffmpeg has, but it used to work > (more or less) as ffmpeg expected. > > That said, I think a netbsd audio backend would be great. I will > create a pkgsrc-wip package in the mean time to start working on > a netbsd audio backend, unless someone beats me to it! > > [wip/ags also has some audio problems, it uses allegro for audio; > but I will start another thread about that one day.]
I have imported wip/ffmpeg4-nbsdaudio which, thanks to your comments, now manages some simple recording and playback. I am sure many improvements are need to be made, but I am happy that I can record videos again if I need to! -- Kind regards, Yorick Hardy