Reputation: 2432
We would like to support serving Ogg Opus on as many phones as reasonably possible.
Based on Wikipedia and our experimentation, we have found:
Android documentation states that .ogg and .mkv is supported from 5.0+, but experimentation proves otherwise.
We would like to use AWS S3 to store the audio in some base format (like .mkv) which would be served nativity to Android. For requests from iOS, we would like to redirect those to the AWS Lambda function that would take the base format and repackage the audio stream into the .caf container format. It shouldn't need any transcoding since the codec (Ogg Opus) is the same in both cases.
Any suggestions on how implement an AWS Lambda? We would prefer to use Python, but open to using the other supported languages.
Update:
ffmpeg
and opusenc
(from opus-tools) so the .webm file will be store in S3.ffmpeg -i foo.mp3 foo.wav
opusenc --bitrate 16 --hard-cbr foo.wav foo.opus
ffmpeg -i foo.opus -acodec copy -f webm foo.webm
ffmpeg -i foo.webm -acodec copy -f caf foo.caf
So the question is: how to setup a Lambda that either returns the .webm file stored in S3 or does this conversion via the lambda layer? Should the returned format be based on http headers (i.e. ACCEPT) or file extension?
Upvotes: 2
Views: 651
Reputation: 2432
I ended up using mobile-ffmpeg-full and convert the container from webm to caf.
// If an WebM, use FFmpeg to convert container to CAF
let error = MobileFFmpeg.execute("-i \"\(fileURL.path)\" -acodec copy \"\(cafFileURL.path)\"")
Upvotes: 1