Author Topic: Encoder losing time in output file  (Read 554 times)

Chris Oakley

  • Posts: 128
Encoder losing time in output file
« on: 21 Jun '19 - 17:32 »
Hi Folks,

I wondered if anyone has come across this problem before. We had it once in the past but never really got to the bottom of it. However, I've attached a project I put together to help demonstrate the issue. We are encoding the selected audio to hour long files of mp3 type (all this can be seen in the code). Most of the time the file lengths are spot on, either 1:00:00 or 59:59 - and as we know the difference between this to a computer could be 1 millisecond.

But every now and then the file length is 59:57 or in some cases 58:50 - and I've got absolutely no idea why this would be. Feel free to run the program overnight and see what results you get. It's driving me nuts.

Ian @ un4seen

  • Administrator
  • Posts: 22959
Re: Encoder losing time in output file
« Reply #1 on: 24 Jun '19 - 16:26 »
It looks like you're currently using a timer to trigger the new encoders, ie. it isn't dependent on the amount of data processed. One possible reason for a shorter file could be if the input/recording stalled for some reason during that time. If the input is a loopback device, it will only capture data while the corresponding output device is active.

Is there a particular reason that you're using WASAPI (via the BassWasapiHandler class) for the recording? Could you try using the standard BASS recording functions (ie. BASS_RecordInit/Start) instead for comparison? Note that BASS includes support for loopback recording itself now, so you don't need BASSWASAPI for that. There should be no need for the BASS_ENCODE_LIMIT flag when the source is realtime (eg. a recording device), so you could also try removing that from your BASS_Encode_Start call.

Chris Oakley

  • Posts: 128
Re: Encoder losing time in output file
« Reply #2 on: 25 Jun '19 - 15:31 »
Thanks Ian. I did try it with the BASS_RecordInit/Start as well and that didn't make any difference.

I can try without the BASS_ENCODE_LIMIT but I'm sure I've tried that in the past.

I'll let you know how it does.

Ian @ un4seen

  • Administrator
  • Posts: 22959
Re: Encoder losing time in output file
« Reply #3 on: 25 Jun '19 - 16:04 »
OK. Please also confirm whether the problem is happening when using a normal recording device and/or a loopback device?