Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.m4a support #104

Closed
mogwai opened this issue May 16, 2019 · 6 comments
Closed

.m4a support #104

mogwai opened this issue May 16, 2019 · 6 comments

Comments

@mogwai
Copy link

mogwai commented May 16, 2019

Working with the VoxCeleb2 Dataset which encodes audio in the m4a format I've not been able to use the library to load the files.

formats: no handler for file extension `m4a'
Segmentation fault (core dumped)

I tried using ffpemg to convert to a aac file ffmpeg -i in.m4a -c:a copy out.aac and got the same error

formats: no handler for file extension `aac'
Segmentation fault (core dumped)
@hagenw
Copy link
Contributor

hagenw commented May 16, 2019

At the moment you need to convert them to WAV, e.g.

ffmpeg -i in.m4a out.wav

@mogwai mogwai closed this as completed May 16, 2019
@mogwai
Copy link
Author

mogwai commented May 16, 2019

A script to do this for all files in the directory recursively

#!/bin/bash
  
for i in $(find . -type f); do
    ext="${i##*.}"
    if [[ $ext = m4a ]]
    then
        p=${i%".m4a"}
        echo $i 
        ffmpeg -v 0  -i $i $p'.wav' </dev/null > /dev/null 2>&1 &
    fi
done

@vincentqb
Copy link
Contributor

cc @mravanelli

@MagedSaeed
Copy link

MagedSaeed commented Sep 29, 2021

Thanks, @mogwai for your helpful code snippet. Can it be extended to convert any non .wav, not only m4a, to wav?

@MagedSaeed
Copy link

hope this will work

#!/bin/bash
  
for i in $(find dataset -type f); do
    ext="${i##*.}"
    if [[ $ext != wav ]]
    then
        p=${i% $ext}
        echo $i 
        echo $p
        ffmpeg -v 0  -i $i $p'.wav' </dev/null > /dev/null 2>&1 &
    fi
done

@MagedSaeed
Copy link

In Python, I used this:

from pydub import AudioSegment
for file_path list_of_file_paths:
  audio = AudioSegment.from_file(file_path)
  audio.export('dest_path', format='wav')

Of course, you have to have pydub package installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants