Build Audio Converter Plugin

I need a plugin that uses the ffmpeg library to convert .AMR files to .MP3 and vice versa via serverside actions.

The plugin should add two actions exclusively available in backend workflows.

1 action takes an .mp3 file and converts it to .amr

1 action takes an .amr file and converts it to .mp3

Resulting converted files should be accessible by following workflow actions.

If the action fails or times out, the workflow should continue with an empty value for the converted file.

Please DM me if interested.

3 Likes

Sent dm!

Let me know if that works because it sounds like heavy lifting for a Bubble SSA :joy:

(Genuinely curious)

4 Likes

We shall see, the node.js is pretty simple, but timeouts and performance may be a concern.

2 Likes

This really should be a cloud function or an an external API call

Bubbles, memory, size and lack of access to file system will make this very difficult to pull off if not costly.

1 Like

I’m going to try and solve this by using the CloudConvert API via API Connector instead. Will update.

1 Like

I checked CloudConvert right away when I saw your post but it says it can’t do mp3 → amr :flushed:

That’s a bummer, but the amr to mp3 is primary use case.

Yea it seems like they can do that

Interesting, I hadn’t considered trying to run ffmeg in a browser, don’t know why, guess I assumed it needed a native OS install dependency.

But you made me look!

There is a webasembly port for ffmeg.:man_shrugging:t3:

This could sort out a few things for me …:thinking::thinking::thinking:

1 Like

Hi,
I’ve done this with AWS lambda and API Gateway, it was for me easier than a plug-in, especially in terms of reliability.
If you’re interested you can reach out to me at: louis@hellooo.io

Louis

@louis2

+1 for the Lambda Function.
Simple sample:

import subprocess
import os

def lambda_handler(event, context):
    try:
        # Get the input file path and format from the event
        input_file = event['input_file']
        output_format = event['output_format']
        
        # Ensure that the input file exists
        if not os.path.exists(input_file):
            raise ValueError(f"Input file {input_file} does not exist.")
        
        # Define the output file path and format based on the input format
        if output_format == 'mp3':
            output_file = os.path.splitext(input_file)[0] + '.mp3'
        elif output_format == 'amr':
            output_file = os.path.splitext(input_file)[0] + '.amr'
        else:
            raise ValueError("Output format must be 'mp3' or 'amr'.")
        
        # Run ffmpeg command to perform the conversion
        subprocess.run(['ffmpeg', '-i', input_file, output_file])
        
        # Check if the output file was created successfully
        if os.path.exists(output_file):
            return {'converted_file': output_file}
        else:
            return {'converted_file': None}
    
    except Exception as e:
        # If any error occurs during the conversion process, return an empty value for the converted file
        print(f"Error occurred: {str(e)}")
        return {'converted_file': None}
2 Likes

@publi.code @louis2 @tylerboodman @aj11

This is something interesting in the replies that we can do it multiple ways, which one is better, using a LAMBDA function with AWS or using a 3rd party platform like CloudConvert APIs?

what the summary:

If CloudConvert supports the conversion you need (in @aj11 's case only 1 of the 2) then that is the quickest way to get conversions working without code.

1 Like

Thanks, but i am more concerns about the cost, as most of the time its the cost. i want suggest my client lesser cost path, if i ever going to advise one.

And bro, we can use lambda in many way, what is the over all cost of calling a single lambda function.

CloudConvert has worked well. We are only converting 50 or so files a month, so the cost is negligible. If we were doing higher volumes, a lambda would make sense.

3 Likes

What is the file size?