artclarke / humble-video

Humble Video: Demuxing, Decoding, Filtering, Encoding and Muxing of 100's of video and audio formats and Codecs from the JVM
GNU Affero General Public License v3.0
557 stars 115 forks source link

Feature request: Set (resample) or pass through samplerate on audio conversion? #137

Open Korynkai opened 5 years ago

Korynkai commented 5 years ago

Was working on a Java project and we decided to pull in humble-video to fulfill a need that other solutions seemingly could not fulfill, however we ran into a minor issue when we noticed that humble-video's audio conversion sample rate is statically set to 22,050Hz in MediaAudioConverterFactory via the only conversion provider StereoS16AudioConverter..?

Being an audio engineer and programmer myself, I found this rather odd and unfortunate when the Java Sound API has no such limitation as far as I am aware, and the only limitation through the audio APIs of all the supported systems is usually somewhere at or above CD quality (44,100Hz), depending on hardware support and/or system default settings and/or whether the user has modified any settings... In fact, I do believe that the Java Sound API even supports VBR and different sample sizes as well, and I see you may even have stubs for some of the various formats in AudioFormat and VideoJNI?

Simply curious about whether these features are planned and whether or not there might be a time frame for such features. Something tells me MediaAudioConverterFactory's public static final String DEFAULT_JAVA_AUDIO = "HUMBLE-STEREO-S16-22050" wasn't supposed to be the only and final output format for the Java Sound API? Or was there another reason for using strictly this format that cannot otherwise be remedied using a format selection on the converter?

May consider working on a pull request to support these features if I can find the time... Right now it's not imperative in the project we're working on, but we'd like to have CD quality audio at least...