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

"Unable to obtain file audio codec with ffprobe" from PHP #1742

Closed
swvjeff opened this issue Nov 9, 2013 · 1 comment
Closed

"Unable to obtain file audio codec with ffprobe" from PHP #1742

swvjeff opened this issue Nov 9, 2013 · 1 comment

Comments

@swvjeff
Copy link

@swvjeff swvjeff commented Nov 9, 2013

youtube-dl works perfectly when I run from my shell. But when I try to run the exact same command via PHP's proc_open() I get the following error:

ERROR: WARNING: unable to obtain file audio codec with ffprobe
Traceback (most recent call last):
  File "/opt/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 731, in post_process
    keep_video_wish, new_info = pp.run(info)
  File "/opt/local/bin/youtube-dl/youtube_dl/PostProcessor.py", line 156, in run
    raise PostProcessingError(u'WARNING: unable to obtain file audio codec with ffprobe')
PostProcessingError

Here's the command I'm running:

youtube-dl 'http://www.youtube.com/watch?v=dQw4w9WgXcQ' -v -k --extract-audio --audio-format mp3 --audio-quality 0 -o 'writable_dir/%(id)s.%(ext)s'

And here's some system info:

$ system_profiler SPSoftwareDataType
System Version: OS X 10.9 (13A603)
$ php --version
PHP 5.4.4 (cli) (built: Jul  4 2012 17:28:56) 
$ httpd -version
Server version: Apache/2.2.24 (Unix)
$ youtube-dl --version
2013.11.06.1
$ ffmpeg -version
ffmpeg version 2.1
$ ffprobe -version
ffprobe version 2.1
$ which ffmpeg ffprobe youtube-dl
/opt/local/bin/ffmpeg
/opt/local/bin/ffprobe
/opt/local/bin/youtube-dl

At first I thought it was a PATH issue, so I made sure PATH was set properly, but I'm still getting the error. Here's a snippet of PHP (and its output) that I'm running prior to my proc_open() command:

putenv("PATH=".getenv("PATH").PATH_SEPARATOR."/opt/local/bin");
print exec('echo $PATH');
/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin

So, is there anything I'm doing wrong here? Or is there any way to tell youtube-dl the paths of ffmpeg and ffprobe?

@swvjeff
Copy link
Author

@swvjeff swvjeff commented Nov 9, 2013

Pretty isolated case, but I finally found the issue. Hopefully this helps anyone who is running MAMP and installed ffmpeg via macports.

Apparently MAMP sets the DYLD_LIBRARY_PATH variable, which conflicts with the call to ffprobe when trying to determine the file's audio codec. To fix this, just comment out these two lines in
/Applications/MAMP/Library/bin/envvars and restart apache.

DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
export DYLD_LIBRARY_PATH

Credit:
http://stackoverflow.com/questions/10107671/ffmpeg-mamp-dyld-library-not-loaded-error

@swvjeff swvjeff closed this Nov 9, 2013
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.