-
Notifications
You must be signed in to change notification settings - Fork 24
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 #48
Comments
I would love youtube support. I have already done some work on it: https://github.com/mjibson/moggio/tree/youtube The difficulty is that we have to extract the audio from a video file. Youtube supports webm files, which are mkv files. There are a few go projects to sort-of decode them. You can see my work off of those in the linked branch. From there we can extract a Vorbis (not Ogg-encapsulated, though) file. However the ogg vorbis decoder that moggio uses is written in C and currently only decodes Ogg Vorbis files. So we'd have to create an ogg vorbis from the vorbis and feed it to that. The youtube branch is currently missing two parts: 1) the extraction of the actual data bytes of the vorbis file frames (it currently has just one level above that, so I think it's really close), and 2) creating ogg vorbis from vorbis. I don't think either of these are too complicated, but I don't have expertise in this area and it's not obvious to me what the next parts are. I'll try again at some point. But yes, I really want this. Youtube is the only music source I use that moggio doesn't support. |
YouTube has DASH audio only streams, why not utilize those? See |
DASH would be nice. I'm not sure how hard it would be. I don't see any Go packages for it. |
I guess I dont understand what Moggio actually does. Wouldnt it be easier just to do something like this: <iframe src="http://youtube.com/embed/<videoId>?autoplay=1"></iframe> |
The moggio web interface is just a controller for the server. You don't need to have a browser open at all to use moggio. The server is what streams and plays the music, and it's all Go. |
That still doesnt make sense. YouTube is a streaming site. Sure, there are tool out there to download audio/video from YouTube, but why do that? Why wait for an entire song to download when you could easily stream it using an iframe like above? |
iframes are a browser thing. You can use moggio without ever opening a web browser. The browser does not play the music. moggio is a program that streams music to the sound system itself. You can use a browser to tell moggio what do to, but the browser is not the thing streaming the music. |
Yeah, but how the hell are you going to steam YouTube? As far as I know the only "API" for this is using an iframe, which yes, requires a browser. Failing that any solution will require fully downloading the file before playing. The only other thing that comes to mind is FFmpeg "http://" protocol, which who knows if that is possible in Golang |
Look at my youtube branch and https://godoc.org/github.com/otium/ytdl. You can get a URL, make a web request, then stream the resp.Body into some decoders. moggio already does this with, for example, mp3s hosted on dropbox or google drive. No need to download the whole file first, can just stream and decode as needed. |
Ok then. Well if you need help pull DASH URLs, I can do this. I know how to access them, and have code for it in JavaScript already. I could port it to Golang, or send you the algo so you could do it Check that, it looks like Otium does this already?
|
The last time I looked at that it wasn't clear to me how to just get a mp3 or vorbis stream. I would love having a Go library that can get me DASH URL if they can indeed provide audio-only streams. Where's your JS library in the mean time? |
You might want to drop the idea of MP3/Vorbis sir. YouTube is LARGELY AAC, so you are going to http://youtube.com/watch?v=WeYVLG1bsV0 Here are the available streams:
Notice carefully the only "audio only" stream is:
So if you want to dutifully stick to MP3/Vorbis you will need to stream a |
I have looked but not found anything I could use to decode AAC from Go, including C libraries. I'm OK using C for AAC decoding for now, but it would need to be a self-contained package like the vorbis package is (https://github.com/mccoyst/vorbis). Hence the desire to use the webm format and extract the vorbis audio out of it, because moggio can decode ogg vorbis already. |
I use FDK-AAC library in my FFmpeg builds: http://github.com/mstorsjo/fdk-aac It is C++, but might work for your needs? |
Yes, that may work. Will experiment. |
I'm looking to do exactly what this repo is doing: building a go-only media player. I specifically want to build a media player that streams audio directly from YouTube. Is your branch workable? Did you end up finding another workable solution? |
I was never able to stream audio from youtube, but it's been years since I've tried. If I were to try again today I'd look into the youtube music API (well, the unofficial API), probably starting with the python project. |
Moggio appears to be similar to Raddit:
http://reddit.com/r/radd_it
In that it can play from multiple streaming sources. However Moggio has the glaring omission of YouTube support. I see YouTube mentioned in #16, but you closed without comment?
The text was updated successfully, but these errors were encountered: