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

YouTube-dl unknown file format + no support tag #15476

Closed
coolguruji opened this issue Feb 2, 2018 · 2 comments
Closed

YouTube-dl unknown file format + no support tag #15476

coolguruji opened this issue Feb 2, 2018 · 2 comments

Comments

@coolguruji
Copy link

@coolguruji coolguruji commented Feb 2, 2018

Hi,

I am using youtube-dl with php and converting yt video in mp3.
I have found two different ways of doing it.
First is:
youtube-dl --extract-audio --audio-format mp3 video url
It works without any issue but it generates high load on server so i am not comfortable with it.

Second is:
youtube-dl -f 140 -e -g video url
This just fetch the audio/mp4 url with title, dont generate high load and it is very fast so i just give users download by setting php headers like

    header('Content-Description: File Transfer');
    header("Content-Type: audio/mpeg");	
    header('Content-Type: application/force-download');
    header('Content-Transfer-Encoding: binary'); 
    header('Content-disposition: attachment; filename="'.$title.'.mp3"'); 
    header('Connection: Keep-Alive');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
    header("Cache-Control: private", false);
    header('Pragma: no-cache');
    readfile($videopath);
    exit;

on my pc / windows it works but few of my customers are reporting that its no playing in their pc.
When i checked most of files at http://mp3val.sourceforge.net/ windows edition.
I found that files generated with first one command gives no error but files which are created by 2nd command are having issues. like unknown file formats / No supported tags in the file etc.
I dont know how to fix it.

Actually my problem is i dont want to download the whole file in mp4/webm and then convert it to mp3 via ffmpeg. It takes a lot of time. I am looking for a easier solution. so i just started to fetch audio/mp4 link and then rename it as a mp3 file with php headers but maybe i forget to fix something.

Is it possible to directly fetch mp4/audio link and turn in into a mp3 file without saving on the server?

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Feb 2, 2018

Youtube does not serve mp3 so it's technically impossible to download mp3 directly. Second case is incorrect, you won't get mp3 that way.

@dstftw dstftw closed this Feb 2, 2018
@coolguruji
Copy link
Author

@coolguruji coolguruji commented Feb 2, 2018

Hmm,

I agree with you. I also believe that.
But when i look here, i get confused.
http://solohits.net/mostrando.php?metodo=W0yp3rSfx3I
OPCIÓN MP3 4, OPCIÓN MP3 5

This API provider is giving multiple mp3 links of youtube. And the best thing is its available for download instantly. I dont think its possible to download + convert multiple links instantly.
Can you explain?

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
2 participants
You can’t perform that action at this time.