lpms icon indicating copy to clipboard operation
lpms copied to clipboard

ffmpeg: Estimate duration for some audio formats in GetCodecInfoBytes

Open j0sh opened this issue 1 year ago • 2 comments

not all formats have a duration baked into the container. in those cases, ffmpeg normally uses the file size and bitrate to estimate the duration, but pipes do not have a file size ... however, we do know the file size from the input parameter (a byte slice, data) so calculate the duration ourselves for a few audio formats.

Also add a couple of small test files to cover codecs where we do not compile in encoders (mp3 and opus), and extend the existing test cases to also call GetCodecInfoBytes

Note that certain formats are known not to work with this method, eg ogg does not return a bitrate at all. This is covered in test cases as well.

j0sh avatar Jul 31 '24 07:07 j0sh

Tested these changes on the audio-to-text Whisper pipeline and it is working excellent. Great work!

eliteprox avatar Aug 06 '24 20:08 eliteprox

@j0sh I checked the code and everything looks correct. I could not test this pull request directly but https://github.com/livepeer/lpms/pull/415 which worked perfectly.

rickstaa avatar Aug 07 '24 18:08 rickstaa

Merged into master via https://github.com/livepeer/lpms/pull/415

j0sh avatar Aug 09 '24 20:08 j0sh