Audio file encoding

Archived from the Transloadit support forum. Originally posted on November 12, 2010; details may be outdated, see our docs for current behavior. Original thread

any future plans to create and audio/encode robot?

ie. wav to mp3?

thanks kele.

Yes, in fact it can probably already be done right now using the /video/encode robot with custom ffmpeg settings. If you’re interested in trying that out let me know and I’ll see if I can get a working example for wav → mp3 for you.

Hi Felix, that would be great.

Also have another question, I saw a similar post in the forum, but just want to make sure.

When we upload through transloadit, we can pass through the original file, as well as the encoded file on to cloudfiles, and we’re given the 2 urls to those files as well?

So user uploads uncompressed wav file. Transloadit sends that file to cloudfiles as well as an mp3 file.

Thanks Kele.

Hi Felix,

Have you had any luck with getting audio conversion to work?

I’ve tried a couple times, but it doesn’t seem to do the conversion. The latest one i’ve tried is below. It seems to have no problem uploading the original file but no encoded file.

{
  "steps": {
    "encode": {
      "robot": "/video/encode",
      "ffmpeg": {
        "ab": "64k",
        "ar": "44100",
        "acodec": "mp3"
      }
    },
    "export": {
      "use": [
        ":original",
        "encode"
      ],
      "robot": "/cloudfiles/store",
      "container": "xxx",
      "user": "xxx",
      "key": "xxx"
    }
  }
}

About your first question: Yes you can upload your original files to cloudfiles as well by simply providing use: [‘:original’, …] in your export step (which I guess you have already figured out in the JSON you just posted).

About the audio encoding: I think our robot is still trying to apply video encoding parameters (ffmpeg augments our default options rather than replace them). I’ll try to find a good solution to this and will update the ticket here soon.

Hi Felix,

Do you think audio encoding will be possible? If so, would it be within the next week? We’d love to use this service on a project and it would be great to be able handle video,images,audio all under one service.

Thanks,
Kele.

Hey Kele,

yes - I think it should be possible to get this resolved in the next few days. In fact I might as well do this properly and add it as an /audio/encode robot. What presets would you need for that initially, or would you prefer raw ffmpeg access?

--fg

An /audio/encode robot would be awesome!
Personally, I’d want bitrate, format, start time and duration to be exposed to make it easy to create high and low quality mp3’s or ogg files as well as 30 second previews.

Thanks Felix,

That’s great.

Mp3 would be the most likely preset. I think.

I suppose similar to the FLV preset.

Kele.

Also, am excited about an audio robot! In fact, I might jump ship from my other provider :wink:

Hi Alex,

Wondering if you’re getting closer to releasing the audio robot. We’d love to start testing it.

Thanks Kele.

Hi Kele, sorry for the delay - there were a bunch of other support tickets coming in that we had to schedule ahead of this.

Now I’m free of those so hopefully I can get this hacked out tonight. Going to buy some club-mate for a late session if needed : ).

Great news,

We’re set to go live this week, and really need to test this piece out.

Thanks Kele.

Alright, I hacked up a very simplistic /audio/encode robot for now, but I hope it’s enough to get this going and figure out the right presets / options on the way.

At this point the robot simply takes 1 parameter, ffmpeg which works just like the one for the video encode robot and passes those settings on to ffmpeg.

For example, this is the most simple way to encode a given audio file to mp3:

{
  "steps": {
    "encode": {
      "robot": "/audio/encode",
      "ffmpeg": {
        "f": "mp3"
      },
      "result": true
    }
  }
}

Of course this is not the final robot (and the current one is free for now), but it should be enough to handle all the basic encoding.

The next step for me would be to add meta data support for audio files, as well as some presets.

Anyway, let me know what you think and what else you need right away in order to not be stuck.

--fg