问题
I'm storing audio files on Google Cloud Storage (through Firebase storage).
I need to use FFMPEG to convert the audio file from stereo (two channels) to mono (one channel).
How can I perform the above conversion on Google Cloud Platform?
Update: I suspect one possibility is to use Google Compute Engine to create a virtual machine, install ffmpeg, and somehow gain access to the audio files.
I'm not sure if this is the best way or even possible. So I'm still investigating.
回答1:
If you have code that exists already which can talk to Google Cloud Storage, you can deploy that code as an App Engine application which runs on a Custom Runtime. To ensure the ffmpeg
binary is available to your application, you'd add this to your app's Dockerfile
:
RUN apt-get install ffmpeg
Then, it is just a matter of having your code save the audio file from GCS somewhere in /tmp
, then shelling out to /usr/bin/ffmpeg
to do your conversion, then having your code do something else with the resulting output file (like serving it back to the client or saving it back to Cloud Storage).
来源:https://stackoverflow.com/questions/42147585/using-ffmpeg-on-google-cloud-platform