Cristina
Cristina

Reputation: 1

Python - youtube-dl.utils.DownloadError: ERROR: audio conversion failed: file: mp3 invalid argument

youtube-dl.utils.DownloadError: ERROR: audio conversion failed: file: mp3 invalid argument

The above error appears with following parameters, running youtube-dl on Python 3.6 on Windows 7, FFmpeg and libmp3lame installed.

ydl_opts = {                                                
"format": "bestaudio/best",
"extractaudio": True,
"outtmpl": fetch_name + "%(ext)s",
"noplaylist": True,
"nocheckcertificate": True,
"postprocessors": [{
    "key": "FFmpegExtractAudio",
    "preferredcodec": "mp3",
    "preferredquality": "192",
}],
"progress_hooks": [hook]
}

fetch_name is for example C:\Path\File. [hook] just displays download messages. I've searched here and on internet but can't find this error.

Upvotes: 0

Views: 3680

Answers (3)

Gokul
Gokul

Reputation: 41

options={
        'writethumbnail':True,
        'format':'bestaudio/best',
        'keepvideo':False,
        'outtmpl.':filename,
        'postprocessors':[{'key': 'FFmpegExtractAudio',
            'preferredcodec': 'mp3',
            'preferredquality': '192'},
            {'key': 'EmbedThumbnail',},]
    }

This piece of script might help you. It worked for me very well.

Upvotes: 0

anon
anon

Reputation: 21

Try adding a "." to the end of the outtmpl. The error magically goes away.

I haven't checked, but I suspect this is an error with youtube-dl, where it expects a file extension to replace.

I don't know if bumping a dead question is frowned upon in here, but I thought I'd give light to this, since I was being bothered with the same issue.

Upvotes: 2

hashcode55
hashcode55

Reputation: 5860

I traced back the arguments you have in your code and found this file, which in turn traces back to the list of postprocessors.

As you can see the post processor is named FFmpegExtractAudioPP where as you have used FFmpegExtractAudio. May be this is where you are getting it wrong.

Upvotes: -1

Related Questions