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

How to add ffmpeg to embedded YouTube-dl on a server? #12190

Closed
ghost opened this issue Feb 20, 2017 · 1 comment
Closed

How to add ffmpeg to embedded YouTube-dl on a server? #12190

ghost opened this issue Feb 20, 2017 · 1 comment

Comments

@ghost
Copy link

@ghost ghost commented Feb 20, 2017

I am building a Flask application and using embedded YouTube-dl to download mp3 from YouTube, and it needs ffmpeg to be available to convert. So I made a folder in the app and placed ffmpeg inside and linked it in my python code, but It is showing an error. Is the error something to do with the YouTube-DL library or is it something to do with the way I placed the ffmpeg, and if so, how would I fix it?

`
from __future__ import unicode_literals
import youtube_dl


   class YouTubeMusic():


       def __init__(self, url):
           self.url = url

       def search(self):
        pass

ydl_opts = {
    'format': 'bestaudio/best',
    'ffmpeg_location': "static/ffmpeg/ffmpeg.exe",
    'postprocessors': [{
        'key': 'FFMpegExtractAudio',
        'preferredcodec': 'mp3',
        'preferredquality': '0',
    }]

     }

youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download(['http://www.youtube.com/watch?v=BaW_jenozKc'])`

Fig 1. The Python Code

Traceback (most recent call last):
  File "YouTubeMusic.py", line 25, in <module>
    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
  File "/Users/Vladimir/Documents/Code/Keef/venv/lib/python2.7/site-     packages/youtube_dl/YoutubeDL.py", line 376, in __init__
    pp_class = get_postprocessor(pp_def_raw['key'])
  File "/Users/Vladimir/Documents/Code/Keef/venv/lib/python2.7/site-     packages/youtube_dl/postprocessor/__init__.py", line 22, in      get_postprocessor
     return globals()[key + 'PP']
KeyError: u'FFMpegExtractAudioPP'

Fig 2. The error

venv) Admins-Air:keef Vladimir$ cd static/
(venv) Admins-Air:static Vladimir$ ls
ffmpeg
(venv) Admins-Air:static Vladimir$ cd ffmpeg/
(venv) Admins-Air:ffmpeg Vladimir$ ls

CONTRIBUTING.md     cmdutils_common_opts.h  ffprobe.c
COPYING.GPLv2       cmdutils_opencl.c   ffserver.c
COPYING.GPLv3       common.mak      ffserver_config.c
COPYING.LGPLv2.1    compat          ffserver_config.h
COPYING.LGPLv3      configure       libavcodec
CREDITS         doc         libavdevice
Changelog       ffmpeg          libavfilter
INSTALL.md      ffmpeg.c        libavformat
LICENSE.md      ffmpeg.h        libavresample
MAINTAINERS     ffmpeg_cuvid.c      libavutil
Makefile        ffmpeg_dxva2.c      libpostproc
README.md       ffmpeg_filter.c     library.mak
RELEASE         ffmpeg_opt.c        libswresample
RELEASE_NOTES       ffmpeg_qsv.c        libswscale
VERSION         ffmpeg_vaapi.c      presets
arch.mak        ffmpeg_vdpau.c      tests
cmdutils.c      ffmpeg_videotoolbox.c   tools
cmdutils.h      ffplay.c        version.sh

Fig 3. The ffmpeg location

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Feb 20, 2017

It's FFmpegExtractAudio not FFMpegExtractAudio.

@dstftw dstftw closed this Feb 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.