Mycroft Community Forum

YouTube Audio Skill - testing and feedback

Thanks for the feedback, and for looking into the clashing playback behaviour.

I would quite like to add to the functionality so that - say - it’s easy to choose between the top few results rather than just always playing the top match.

Patches / PRs welcome!

Hey, thx for this skill.

Just want to ask you or others if you also got a fullscreen (over the cli) when you do:
“play die drei fragezeichen folge 122 original”.

Haven’t actually checkout the HDMI output, but it looks like you have VLC with framebuffer support installed and it plays the actual videostream.

Do you have that with only that stream or all streams?

(I will do some checking for you a bit later as well, to see if I have a framebuffer player as well.)

It is this config:
-Raspberry pi 4 - with 4GB
-Respeaker Mic Array v2.0 ( )
-Picroft Unstable 2019-11-01 Buster image
-Mycroft-Core 19.8.3

I just install the skill and let them install all necessary requirements. VLC was a part of it.
Is there a reason why the skill used vlc instead of other ones? I think NewPipe (the app) used another technique, or? or

BR, suisat

Is it possible to have this skill play the audio on some other audio rendering device? ie. push the url to a different audio device (“Play Clapton Crossroads upstairs”). End devices may be an mpd client, volumio, vlc client on remote computer, chrome cast device, others…?

@suisat I think VLC is used because of the HTTPS connection and possibly the OPUS codec used by Youtube for most “best” audio streams.

Or at least, when I configured my system for it I needed to tweak my VLC install to support openssl for the https connection and needed to add the OPUS codec for it to work. I can imagine that the default mpg123 might be a bit to minimal for it all.

But… Just guessing here.

@pcwii Was wondering the exact same. Chromecast is integrated within Mycroft ini some extend, as I see something mention about it in the audio.log Wondering if you could say;

“play blabla from youtube on chromoecast-name”

Tried it of course, but nope…

1 Like

@j1nx, I did some playing around in my spare time and managed to get some youtube casted to my chromecast. It looks like the discovery portion of pychromecast, pychromecast.get_chromecasts() does not work on systems with more than one network interface as it uses the wrong interface to find the devices?? not sure if this is the mycroft issue or not.

I did have success casting a search with this code here.

Yes, you’re right. I think sometimes one of the audio streams might be something that mpg123 could play codec-wise, but from my initial experiments it seemed like vlc was consistently able to cope with the stream URLs pafy / youtube-dl return.

I’d be happy to include an option to use something other than the “best” audio stream, and/or use mpg123 if an appropriate stream is returned… but it looked to me like this might sometimes mean none of the streams returned would be playable for a given search result.

@mcdruid I discovered that if you ask to play something on youtube and there is no audio only streams available, it actually plays a video one.

This should not be a problem, however probably not intentional, so perhaps you need to catch the best-stream == 0 and report back to the user.

(My VLC is configured without screen support, so playing one of those streams gives A LOT of errors on the mycroft-cli-client screen.

Interesting, thanks @j1nx

I mostly use picroft with no video/screen at all and haven’t noticed this.

Do you have any examples of streams / searches which come back with no audio-only streams?

I did file an issue on gitlab the other day when I stumbled across a result which seemed to do something like return null for bestaudio - perhaps that’s relevant:

Not going round to looking at the code yet, but a working test case would be good as I can’t reproduce the issue myself now.

I encountered it once and thought, will save the song. However, YouTube probably logs those things and puts the encoding in a queue of some kind because double checking the song the next day it played without video.

So hard to debug, by just asking it for songs. I believe the best way is to ask for old and / or not so popular songs. Perhaps in your native language if other than English.

Hi, first of all: thanks for sharing this great stuff!
In the default settings everything is working fine.

But is there a way to change the language? At the moment I am using mycroft with german language support, following this:

When I evoke a stream by (typing) “spiele Hendrix” (=“play Hendrix”) mycroft says “eine sekunde bitte” (=“a second please”) but than an error is thrown out, saying “Bei der Bearbeitung ist ein Fehler im Skill Youtube Skill aufgetreten” (Roughly=“there was an error in the Skill youtube Skill”). Skill’s log says:

2019-12-17 09:52:54.439 | INFO | 8167 |
mycroft.skills.skill_loader:load:112 | ATTEMPTING TO LOAD SKILL:
2019-12-17 09:52:54.675 | INFO | 8167 |
mycroft.skills.settings:get_local_settings:78 | /opt/mycroft/skills
2019-12-17 09:52:54.710 | INFO | 8167 |
mycroft.skills.skill_loader:_communicate_load_status:270 | Skill
mycroft-youtube-audio loaded successfully
2019-12-17 09:54:19.921 | INFO | 8167 |
mycroft.skills.settings:save_settings:109 | Skill settings successfully
saved to /opt/mycroft/skills/mycroft-youtube-audio/settings.json
2019-12-17 09:54:24.072 | INFO | 8167 | Playback Control Skill |
Playing with: mycroft-youtube-audio
File “/opt/mycroft/skills/mycroft-youtube-audio/”, line 67,
in CPS_start
File “/opt/mycroft/skills/mycroft-youtube-audio/”, line 91,
in search_youtube

Also there was a regex error, so I’ve added de-de in locale; so this message is gone.

As I am totally new to mycroft my understanding of how things work is very few. It would be great if someone could point me to the place where this error-message comes from. Is it from the skill or from mycroft itself? Does anyone know if I could try some translations somewhere?

Hi there @t_ho, and welcome!

Skills need to be translated into each language before they can be used. You can see the translated skills into German here:

As you can see, this skill is not even on the list because still is so new. So, the best should be waiting for a proper translation, but you can contribute it in your own language directly with the developer, translating yourself the vocabulary files like those

Thank you malevolent for your reply.
I set up a locale “de-de” folder locally and would be glad to share it. But as I am not aware of how translating a skill actually works, I would keep checking/understanding for a while first… If someone could hint me with files would need a translation, I could to that…

Well, translation is a priori quite straight forward.

You need to create all the files inside the folders dialog and vocab or locale just like “en-us” does. That’s the easy part. Now, depending on the skill, the author has used more or less regular expressions. Let’s take an example:

You will create a directory de-de on locale folder, and inside the de-de folder, you need to create the file on_youtube.regex which content is
\s*(on|with|using) (youtube|you tube)\s*

I’m not an regex expert, but here you should translate just (on|with|using) into german and you will be ok. If you know nothing about regex, the character | (vertical bar, pipe, or) means it need to search one of these terms, so you can use any combination of “on”, “with”, and “using” with “youtube” or “you tube”, but both elements are needed (the to parenthesis groups).

My advice, copy all the english files into the german directories, and translate just the english words into your language, leaving all the symbols untouched.

Here you have a two useful links which can help you understand regex a little better.

Thanx, the link looks interesting… As my coding skills are very few, I avoided thinking about regex too much… but now it seems time : )

And, well, I was (intuitively) setting up de-de as you described it right after installing the skill, using the equivalent german terms, but there must be somewhere more than that. 'Cause the initial term “play” does not show up in the en-us file, but using the german term “spiele” (=“play”), the skill is evoked, but the errors described above occur. So the skill starts, but than fails at some point…

@t_ho the youtube-skill utilizes the CommonPlay framework, so the play/stop/pause intents are handled indirectly by the playback control skill

Hi there.
Thanks for cool skill!

Installed on Picroft (clean flash) on Raspberry Pi 3 b+ (3.5 jack audio out, usb mic in)
note for those who (same as me) got silence instead youtube stream:
Seems pulseaudio have some troubles with config, so you need just do:

  1. pactl set-default-sink alsa_output.platform-soc_audio.analog-mono (use tabs to find exact name in your case, in case it says no such device)
  2. pactl set-sink-volume @DEFAULT_SINK@ +100% - to set non zero value.

Sorry if duplicating info from middle of thread but I spend hour to finding this.


Hi @mcdruid

This skill is absolutely fantastic - thanks!
Just reporting a bug - the skill crashes if the first result is a live stream.

Example: Hey Mycroft, play relaxing jazz.
First Result on Youtube:

CLI Output:

Traceback (most recent call last):
File “/home/pi/mycroft-core/mycroft/skills/mycroft_skill/”, line 66, in wrapper
File “/home/pi/mycroft-core/mycroft/skills/”, line 153, in __handle_play_start
self.CPS_start(phrase, data)
File “/opt/mycroft/skills/mycroft-youtube-audio.mcdruid/”, line 67, in CPS_start
File “/opt/mycroft/skills/mycroft-youtube-audio.mcdruid/”, line 85, in search_youtube
self.stream_url = self.get_stream_url(self.vid_url)
File “/opt/mycroft/skills/mycroft-youtube-audio.mcdruid/”, line 108, in get_stream_url
return bestaudio.url
AttributeError: ‘NoneType’ object has no attribute ‘url’


Any way to get it to play video files every time… sometimes it plays the video file, but 95% it plays audio only

I use kde neon and vlc

Thanks for amazing skill :slight_smile: