Which Mime Type Should I Use for Mp3

Which mime type should I use for mp3

Your best bet would be using the RFC defined mime-type audio/mpeg.

mime type validation in laravel 4 doesn't work

Try changing the file rules line to:

$file_rules = array('audio_file' => 'size:5242880|mimes:audio/mpeg,audio/mp3,audio/mpeg3');

According to this, 'audio/mpeg' is the correct MIME type for mp3 files (some browsers also use 'audio/mpeg3' or 'audio/mp3').

If that doesn't work, you could get the MIME type before validation:

$file = Input::file('audio_file');
$mimeType = $file->getMimeType();
$supportedTypes = ['audio/mpeg', 'audio/mpeg3', 'audio/mp3'];

if (in_array($mimeType, $supportedTypes)) {
// validate or simply check the file size here
} else {
// do some other stuff
}

MIME type of mp3 file using Speech to Text

You can see within official documentation the Audio formats support is:

  • Audio formats: Transcribes Free Lossless Audio Codec (FLAC), Linear 16-bit Pulse-Code Modulation (PCM), Waveform Audio File Format (WAV), Ogg format with the Opus or Vorbis codec, Web Media (WebM) format with the Opus or Vorbis codec, mu-law (or u-law) audio data, or basic audio.

Check: MIME Types for Speech to Text.

One good idea to use your mp3 audio is to convert before sending for the API.

And, depends on what you want, you can use this article. In this article, Jason shows how to use mp3 with Asterisk to send the voice audio for Speech to Text. I'm not sure if works yet.

EDIT: [10/2017]

A few days ago, Watson Speech to Text release one new version that supports mp3 input features.

Check the audio formats supported now:

Audio formats: Transcribe Free Lossless Audio Codec (FLAC), MP3 (Motion Picture Experts Group, or MPEG) format, Linear 16-bit Pulse-Code Modulation (PCM), Waveform Audio File Format (WAV), Ogg format with the Opus or Vorbis codec, Web Media (WebM) format with the Opus or Vorbis codec, mu-law (or u-law) audio data, and basic audio.

  • See the Official documentation talking about here.

What is the Content-Type for mp3 files in node.js?

It is audio/mpeg.

I usually search for mime types to find out what should be sent as the Content-Type header for files.

--UPDATE--

Reading a bit more about Mime-Types, it is infact 'mime-type' that we send as Content-Type header for files.

content type for mp3 download response

Try "Content-Type: audio/mpeg"

Update

To encourage the browser to download the mp3 rather then streaming, do

Content-Disposition: filename="music.mp3"'

Android app Mp3 file mimetype resolving to null

Check the following piece of code. You will come to know why you were not getting the required output.

    String type = null;
String extension = "mp3";

type = android.webkit.MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);

Log.d(TAG,"mime type1 "+type);

extension = "MP3";

type = android.webkit.MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);

Log.d(TAG,"mime type2 "+type);

If you were not able to make any difference based on making the file extension in lowercase , consider using the

File filesDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
File mov = new File(filesDir,"song.mp3");

and construct the uri using the file's absolute path instead of hardcoding the path.

Chrome 81 mimetype change to file upload of audio/mp3

This looks to be the case in chrome 81 as per the following commit:
chromium/chromium/src/842f46a95f49e24534ad35c7a71e5c425d426550

Commit message reads as follows:

Use audio/mpeg instead of audio/mp3 for .mp3 files

audio/mpeg is used instead of audio/mp3 in safari and firefox for .mp3
files, as defined in this rfc: https://www.rfc-editor.org/rfc/rfc3003

Good find though.



Related Topics



Leave a reply



Submit