Rudloff / alltube

Web GUI for youtube-dl
GNU General Public License v3.0
2.97k stars 585 forks source link

Can't find avconv or ffmpeg #109

Closed shanmugam023 closed 7 years ago

shanmugam023 commented 7 years ago

Hi ,

This is shanmugam i installed ffmpeg and also configure like ffmpeg: vendor/bin/ffmpeg and vconv: vendor/bin/ffmpeg in config.yml but i got error like Can't find avconv or ffmpeg kindly give some solution

Rudloff commented 7 years ago

Can you please copy here the complete content of your config.yml file? Also you need to make sure that the avconv option points to your ffmpeg binary. How did you install ffmpeg?

shanmugam023 commented 7 years ago

Yes everything i did, i used centos server ,manually ffmpeg command work but i execute in my website it doesn't work , kindly help me thank you , this is my configuration file youtubedl: vendor/rg3/youtube-dl/youtube_dl/main.py python: /usr/bin/python params:

Rudloff commented 7 years ago

Can you please run these commands (from inside Alltube's folder) and copy the result:

which ffmpeg
which /usr/bin/ffmpeg
ffmpeg -version
php -r "require_once __DIR__.'/vendor/autoload.php'; var_dump(\Alltube\Config::getInstance());"

(Also please quote the output to make it more readable.)

shanmugam023 commented 7 years ago

Hi, /usr/bin/ffmpeg

ffmpeg version 2.6.8 Copyright (c) 2000-2016 the FFmpeg developers

["youtubedl"]=> string(44) "vendor/rg3/youtube-dl/youtube_dl/main.py" ["python"]=> string(15) "/usr/bin/python" ["params"]=> array(4) { [0]=> string(13) "--no-playlist" [1]=> string(13) "--no-warnings" [2]=> string(14) "--playlist-end" [3]=> int(1) } ["convert"]=> bool(true) ["avconv"]=> string(15) "/usr/bin/ffmpeg" ["rtmpdump"]=> string(19) "vendor/bin/rtmpdump" ["uglyUrls"]=> bool(true) ["stream"]=> bool(true) ["remux"]=> bool(false) ["file":"Alltube\Config":private]=> string(10) "config.yml" }

shanmugam023 commented 7 years ago

hi , I reconfigured setting please see below result

object(Alltube\Config)#3 (10) { ["youtubedl"]=> string(44) "vendor/rg3/youtube-dl/youtube_dl/main.py" ["python"]=> string(15) "/usr/bin/python" ["params"]=> array(4) { [0]=> string(13) "--no-playlist" [1]=> string(13) "--no-warnings" [2]=> string(14) "--playlist-end" [3]=> int(1) } ["convert"]=> bool(true) ["avconv"]=> string(17) "vendor/bin/ffmpeg" ["rtmpdump"]=> string(19) "vendor/bin/rtmpdump" ["uglyUrls"]=> bool(true) ["stream"]=> bool(true) ["remux"]=> bool(false) ["file":"Alltube\Config":private]=> string(10) "config.yml" }

Rudloff commented 7 years ago

Well, if your ffmpeg is in /usr/bin, you should put that in your config file, not vendor/bin. Please separate the different outputs (and quote them) so we can see which command returns what. Did you run the two which command or did the second one return nothing? (This could be the issue here.)

shanmugam023 commented 7 years ago

Hi , i run it please see the result

object(Alltube\Config)#3 (10) { ["youtubedl"]=> string(44) "vendor/rg3/youtube-dl/youtube_dl/main.py" ["python"]=> string(15) "/usr/bin/python" ["params"]=> array(4) { [0]=> string(13) "--no-playlist" [1]=> string(13) "--no-warnings" [2]=> string(14) "--playlist-end" [3]=> int(1) } ["convert"]=> bool(true) ["avconv"]=> string(15) "/usr/bin/ffmpeg" ["rtmpdump"]=> string(19) "vendor/bin/rtmpdump" ["uglyUrls"]=> bool(true) ["stream"]=> bool(true) ["remux"]=> bool(false) ["file":"Alltube\Config":private]=> string(10) "config.yml" }

shanmugam023 commented 7 years ago

hi , I changed configuration file video/classes/Config.php and classes/Config.php everything i did but it doesn't work anything idea ?

Rudloff commented 7 years ago

You should not modify the classes/Config.php file, only the config.yml file. Also I don't know what that video/ folder you are talking about is.

Can you please run this and copy the output:

php -r "var_dump(exec('which /usr/bin/ffmpeg'));"
shanmugam023 commented 7 years ago

sorry dude i did but now working

shanmugam023 commented 7 years ago

string(15) "/usr/bin/ffmpeg"

Rudloff commented 7 years ago

I'm running out of ideas here.

Can you please add this in classes/VideoDownload.php:

diff --git a/classes/VideoDownload.php b/classes/VideoDownload.php
index 0d42a97..82eda1b 100644
--- a/classes/VideoDownload.php
+++ b/classes/VideoDownload.php
@@ -249,6 +249,7 @@ class VideoDownload
      */
     private function getAvconvMp3Process($url)
     {
+        var_dump($this->config->avconv, shell_exec('which '.$this->config->avconv)); die;
         if (!shell_exec('which '.$this->config->avconv)) {
             throw(new \Exception('Can\'t find avconv or ffmpeg'));
         }

Then try to convert a file in your browser and copy here what is displayed in the browser.

shanmugam023 commented 7 years ago

"PHP message: PHP Parse error: syntax error, unexpected 'diff' (T_STRING), expecting function (T_FUNCTION) in /var/www/html/Alltube/classes/VideoDownload.php on line 22" while reading response header from upstream,

Rudloff commented 7 years ago

Don't copy the entire patch, just insert the green var_dump... line (without the starting +) at the correct line in the file.

shanmugam023 commented 7 years ago

can you share your VideoDownload.php ?? i couldn't find correct location

Rudloff commented 7 years ago

If that's easier for you, you can create a test.php file at the root of your alltube folder with the following content:

<?php
require_once __DIR__.'/vendor/autoload.php';
$config = \Alltube\Config::getInstance();
var_dump($config->avconv, shell_exec('which '.$config->avconv));

Then run this file in your browser.

shanmugam023 commented 7 years ago

hi i got message

string(15) "/usr/bin/ffmpeg" NULL

julthon commented 7 years ago

I didn't find the problem, but a solution. I commented out the exception in classes/VideoDownload.php

private function getAvconvMp3Process($url)
{
    //if (!shell_exec('which '.$this->config->avconv)) {
    //    throw(new \Exception('Can\'t find avconv or ffmpeg'));
    //}

    return ProcessBuilder::create(
        [
            $this->config->avconv,
            '-v', 'quiet',
            //Vimeo needs a correct user-agent
            '-user-agent', $this->getProp(null, null, 'dump-user-agent'),
            '-i', $url,
            '-f', 'mp3',
            '-vn',
            'pipe:1',
        ]
    );
}

This may has something to do with security settings of php.

Rudloff commented 7 years ago

That's great news if you can use it like this! It's strange that the test fails but converting works. I'll try to improve the test.

shanmugam023 commented 7 years ago

sorry it doesn't work i got some problem if i click download mp3 i got error message

FastCGI sent in stderr: "PHP message: PHP Parse error: syntax error, unexpected 'public' (T_PUBLIC) , expecting ';' or '{' in /var/www/html/Alltube/classes/VideoDownload.php on line 279" while reading response header from upstream

Rudloff commented 7 years ago

You probably have some typo left from your changes. Try restoring the file from Git or the release package.

shanmugam023 commented 7 years ago

k thanks

shanmugam023 commented 7 years ago

Call to undefined method Alltube\VideoDownlo ad::getAvconvMp3Process() in /var/www/html/Alltube/classes/VideoDownload.php on line 294" while reading response header from upstream,

Rudloff commented 7 years ago

I'm pretty sure you didn't restore the file correctly if this function is missing…

Rudloff commented 7 years ago

I improved the test on the develop branch (a89b3380603625a59b94a7659b7a6b7c12efc94c) if someone wants to try it.

julthon commented 7 years ago

It works now as expected. I see, ffmpeg returns as exit status 1 if you call it without parameters and 0 if "--help" is supplied. Thanks for you effort!

shanmugam023 commented 7 years ago

Hi , Finally It works Thank you so much

fididev commented 6 years ago

Hi,

I'm getting the same error as OP but weird thing is that it worked 2 days ago. I tried also the develop branch but no luck. All I did yesterday and the day before was installing some essential modules for PHP to make it work with a script for DNS lookups but nothing about conversion / ffmpeg or avconv.

Rudloff commented 6 years ago

@veeg4z What is the content of your config/config.yml file. How did you install ffmpeg/avconv? (If it stopped working without any Alltube update it is probably a problem with your server config though.)

fididev commented 6 years ago

Config same as default, only changed convertAdvanced: true. I installed ffmpeg with sudo apt-get install ffmpeg.

But now I noticed that the conversion works on the backup folder where I originally installed AllTube. I made another folder this morning and copied all the content from the backup to this new folder and the AllTube inside the new folder doesn't work on conversions.

Maybe it's a problem related to paths that I should update? Or everytime I change folder I have to install everything from scratch?

Rudloff commented 6 years ago

If you didn't change the config, it looks at vendor/bin/ffmpegby default (which is where Composer installs ffmpeg) but apt-get installs it in /usr/bin/ffmpeg. So you need to add this to your config file:

avconv: /usr/bin/ffmpeg
fididev commented 6 years ago

Thanks, it works!

I did change the path earlier as in avconv: usr/bin/ffmpeg but forgot the slash, the slash means from root folder then I see.. And I also noticed there's another ffmpeg in vendor/bin/ffmpeg but then why it doesn't work? Just asking out of curiosity :D

Rudloff commented 6 years ago

The ffmpeg binary in vendor is provided for people that can't install it globally (on shared hosting for example) but it only works on x86_64 Linux (I don't know what you are using).

fididev commented 6 years ago

I do have x86_64 Ubuntu but as I wrote you earlier it just worked before with default config. How my site is now: http://mysite.com/youtube-dl <- (works with default config and avconv pointing to vendor/bin/ffmpeg) http://mysite.com/youtube-dl_dev <- (doesn't work, have to change to avconv: /usr/bin/ffmpeg) http://mysite.com <- (same as ^)

They all have same files, same folders, same everything. It's odd that it works in the folder where I originally installed the script but not in the other 2 copies. Never mind, I'm just writing this in case you want to improve the tests or something in the check but I'm happy it just works now.