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

no youtubeinmp3 but convertmp3io #19

Open
bvdbos opened this issue Sep 25, 2017 · 12 comments
Open

no youtubeinmp3 but convertmp3io #19

bvdbos opened this issue Sep 25, 2017 · 12 comments

Comments

@bvdbos
Copy link

bvdbos commented Sep 25, 2017

http://www.youtubeinmp3.com/
redirects, see
https://www.convertmp3.io/api/

@bvdbos
Copy link
Author

bvdbos commented Sep 26, 2017

And though that one worked yesterday, now the convertmp3.io doesn't work anymore... Don't know if there's alternatives. Otherwise we should delete the Homey-Music part for now...

@bvdbos
Copy link
Author

bvdbos commented Sep 26, 2017

Or we should try using:
https://github.com/audiocogs/ogg.js

@matjaz
Copy link
Owner

matjaz commented Sep 26, 2017

there are more challenges here

  • get url of YT video (get_video_info is simple but not robust, better is youtube-dl package)
  • convert video to mp3 (did't find any examples of audiocogs converting mp4 to mp3), what performance impact would that have on Homey?
  • play mp3 on homey (Homey accepts only stream_url, so we should create streaming server for that...)

* codecs can be any combination Homey support (better quality preferred)

I suggest if you have some time, let's first explore converting mp4 to mp3 and see if we can create a POC that actually works on Homey.

@bvdbos
Copy link
Author

bvdbos commented Sep 27, 2017

Audiocogs won't work, uses web-api so we need a browser for that if I understand the code correctly.
So indeed first get the audio-info from youtube-dl in node:
https://www.npmjs.com/package/youtube-dl / https://github.com/przemyslawpluta/node-youtube-dl
Then download the stream (there's an example downloading the mp4). We could do that to a user-directory. The stream contains a Vorbis audio so Homey should be able to play that directly?
https://apps.developer.athom.com/tutorial-Media-Codecs.html
But not all players support ogg so we might need to convert to mp3, this is possible in node:
https://github.com/sopel39/audioconverter.js
But this one will be a challenge regarding performance ;-) Running from my synology using my normal laptop works fast (some seconds per song).

Why would Homey only accept stream_url? Soundboard works too...

Off course cleanup of the download/convert fs-directory is needed after that...

@matjaz
Copy link
Owner

matjaz commented Sep 27, 2017

Soundboard must first "upload" audio file to Homey system and you can't play your files directly. There is no option of streaming local audio files.
https://github.com/athombv/com.athom.soundboard/blob/d7d021246c8cae07f506153762c3f9d5a374bee2/app.js#L41
Also I haven't found sdk 2 version of this functionality.

@Povlov
Copy link

Povlov commented Sep 27, 2017

Nice bringing his up for improvements Bas, and Matjaz for looking into this.
Maybe in a later stage I can contribute; atm its a bit too technical I'm afraid... :-)

@bvdbos
Copy link
Author

bvdbos commented Sep 27, 2017

stream-url audio from a youtube url:
https://github.com/fent/node-ytdl-core

@matjaz
Copy link
Owner

matjaz commented Sep 27, 2017

Streaming doesn't actually solve anything, since we need to transcode to Homey supported audio codec.

I've found another service that 'works', but it requires passing cookies. So we'll see how long that works. Please test if you have time. In master and in on apps store review version 0.6.3.

@bvdbos
Copy link
Author

bvdbos commented Sep 27, 2017

a webm audio stream is vorbis. I think all YT-movies have webm with vorbis in them.

@matjaz
Copy link
Owner

matjaz commented Sep 27, 2017

yeah, but vorbis can't be played on Homey.

@bvdbos
Copy link
Author

bvdbos commented Sep 29, 2017

The new mp3-service doesn't work on Chromecast? Different errors: invalid media-id, media request timed out etc. Music seems to be playing but no sound (the artwork appears however, using chromecast video.

@matjaz
Copy link
Owner

matjaz commented Sep 29, 2017

see #18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants