Video files usually contain a video stream and an audio stream. There are many reasons you might want to extract just the audio and discard the video. One way to do this is to convert the video to an audio file and save it as an MP3. The MP3 format is an audio file that is widely supported, provides a high level of compression (smaller file size) and can be played on most devices and web browsers.
Using this demo you can upload a video, or provide a URL, click submit and the file will be uploaded or fetched. Once uploaded the conversion process will begin and within a few seconds to minutes the new audio file will be ready. You can immediately listen to the audio using the on page player or download and save the MP3 file.
There is also the option to adjust the speed of the audio playback, including preserving the pitch. If you un-tick the preserve pitch checkbox the audio will sound high pitched if sped up or low pitched if slowed down. Otherwise the pitch will be preserved and the audio will sound normal regardless of the speed.
This demo is created using the Shotstack Ingest API, used to upload, store and transform videos and images. Transformations the Ingest API can perform include transcoding from one format to another, i.e. converting video to MP3, but also resizing and cropping, frame rate, playback speed and more.
The front-end interface is built using an HTML form with Bootstrap and a simple jQuery script. The script captures the form details on submit and POSTs them via an AJAX call to a Node.js Express application. The Node.js application validates the request before formatting it and sending it to Ingest API. The Ingest API converts the video to audio, saves the new MP3 file online and returns the URL.
You can download the open source code for the project from GitHub and use it as the basis to create your own automated media convertor.