Bug#835608: mkchromecast: fails to Open pavucontrol and select the mkchromecast sink.

2016-09-17 Thread Cristian Ionescu-Idbohrn
Muammar,

On Sat, 17 Sep 2016, Muammar El Khatib wrote:
> On Fri, Sep 16, 2016 at 1:53 PM, Cristian Ionescu-Idbohrn 
>  wrote:
> > |   File "/usr/lib/python2.7/socket.py", line 307, in flush
> > | self._sock.sendall(view[write_offset:write_offset+buffer_size])
> > | error: [Errno 32] Broken pipe
> > `
> >
> > The terminal gets messed up and needs to be `reset'.
>
> This is because of the https://github.com/joeyespo/py-getch module I
> am using to listen to key events. Maybe I should come with my own
> solution to avoid this. So, basically this happens when one uses the
> `--volume` flag.

Check.  Doesn't happen if I skip the '--volume' option on the command
line.

> > If I first start the player and mkchromecast after, it works fine.
> > I can stop and start the player as I please, no apparent troubles.
>
> Thanks for this information. I cannot reproduce it though.

Can you think of a way to narrow down the problem on my system?

I retested that procedure using `audacious'.  It produces the
following error message:

,
| ALSA lib pcm_params.c:2162:(snd1_pcm_hw_refine_slave) Slave PCM not usable
| ERROR util.cc:160 [audgui_simple_message]:
| ALSA error: snd_pcm_hw_params_any failed: No such file or directory.
`

That happens while using this device:

,
|  1 [PCH]: HDA-Intel - HDA Intel PCH
|   HDA Intel PCH at 0xf723 irq 29
`

> I have added a `--host` flag to specify the ip of the host you want
> the google cast device to be connected.

Sounds good.  That way the chromecast device detection will be
skipped, I supose.

> Additionally, there is now a `--source-url` flag that MPD users can
> pass if they have a httpd local streaming server or you can pass
> whatever source-url you want to play to the google cast device
> (maybe cool for radio stations).

Ok.  I'll probably come to that soon.

> In the following upload I will proceed to close this report. I would
> like to thank you for all the feedback!.

You're welcome.  And thanks for mkchromecast :)


Cheers,

-- 
Cristian



Bug#835608: mkchromecast: fails to Open pavucontrol and select the mkchromecast sink.

2016-09-17 Thread Muammar El Khatib
Hi Cristian,

On Fri, Sep 16, 2016 at 1:53 PM, Cristian Ionescu-Idbohrn
 wrote:
> Alright, found that myself and installed package 'python-flask'.
> Having done that, progress ;)
>
> Cast media controller status
>
> CastStatus(is_active_input=False, ..., status_text=u'Ready To Cast')
>
>
> Controls:
> =
>
> Volume up: u
> Volume down: d
> Quit the application: q or Ctrl-C
>
> 192.168.x.y - - [16/Sep/2016 13:40:45] "GET /stream HTTP/1.1" 200 -
>
> and sound out the TV speakers.  Fun :)
>

Cool to know it is working now!.

On Fri, Sep 16, 2016 at 2:27 PM, Cristian Ionescu-Idbohrn
 wrote:
> One thing I noticed is that if I _first_ start mkchromecast and play
> some sound file _after_, the player (in this case mpg123) will bail
> out with:
>
> ,
> | [format.c:295] error: Unable to set up output format! Constraints: 44100, 
> 22050 or 11025Hz.
> | [mpg123.c:695] error: ...in decoding next frame: Unable to set up output 
> format! (code 1)
> `
>
> If I now kill (^C) mkchromecast, I get this trace:
>
> ,
> | 192.168.x.y - - [16/Sep/2016 14:01:07] "GET /stream HTTP/1.1" 200 -
> | Process Process-1:
> | Traceback (most recent call last):
> |   File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in 
> _bootstrap
> | self.run()
> |   File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
> | self._target(*self._args, **self._kwargs)
> |   File ".../mkchromecast/audio.py", line 523, in start_app
> | app.run(host= '0.0.0.0')
> |   File "/usr/lib/python2.7/dist-packages/flask/app.py", line 843, in run
> | run_simple(host, port, self, **options)
> |   File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 694, in 
> run_simple
> | inner()
> |   File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 659, in 
> inner
> | srv.serve_forever()
> |   File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 499, in 
> serve_forever
> | HTTPServer.serve_forever(self)
> |   File "/usr/lib/python2.7/SocketServer.py", line 233, in serve_forever
> | self._handle_request_noblock()
> |   File "/usr/lib/python2.7/SocketServer.py", line 292, in 
> _handle_request_noblock
> | self.handle_error(request, client_address)
> |   File "/usr/lib/python2.7/SocketServer.py", line 290, in 
> _handle_request_noblock
> | self.process_request(request, client_address)
> |   File "/usr/lib/python2.7/SocketServer.py", line 318, in process_request
> | self.finish_request(request, client_address)
> |   File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request
> | self.RequestHandlerClass(request, client_address, self)
> |   File "/usr/lib/python2.7/SocketServer.py", line 654, in __init__
> | self.finish()
> |   File "/usr/lib/python2.7/SocketServer.py", line 713, in finish
> | self.wfile.close()
> |   File "/usr/lib/python2.7/socket.py", line 283, in close
> | self.flush()
> |   File "/usr/lib/python2.7/socket.py", line 307, in flush
> | self._sock.sendall(view[write_offset:write_offset+buffer_size])
> | error: [Errno 32] Broken pipe
> `
>
> The terminal gets messed up and needs to be `reset'.
>

This is because of the https://github.com/joeyespo/py-getch module I
am using to listen to key events. Maybe I should come with my own
solution to avoid this. So, basically this happens when one uses the
`--volume` flag.

> If I first start the player and mkchromecast after, it works fine.
> I can stop and start the player as I please, no apparent troubles.

Thanks for this information. I cannot reproduce it though.

I have added a `--host` flag to specify the ip of the host you want
the google cast device to be connected. Additionally, there is now a
`--source-url` flag that MPD users can pass if they have a httpd local
streaming server or you can pass whatever source-url you want to play
to the google cast device (maybe cool for radio stations).

In the following upload  I will proceed to close this report. I would
like to thank you for all the feedback!.


Cheers,
-- 
Muammar El Khatib.
Linux user: 403107.
GPG Key = 71246E4A.
http://muammar.me | http://proyectociencia.org
  ,''`.
 : :' :
 `. `'
   `-



Bug#835608: mkchromecast: fails to Open pavucontrol and select the mkchromecast sink.

2016-09-16 Thread Cristian Ionescu-Idbohrn
On Fri, 16 Sep 2016, Cristian Ionescu-Idbohrn wrote:
>
> and sound out the TV speakers.  Fun :)

One thing I noticed is that if I _first_ start mkchromecast and play
some sound file _after_, the player (in this case mpg123) will bail
out with:

,
| [format.c:295] error: Unable to set up output format! Constraints: 44100, 
22050 or 11025Hz.
| [mpg123.c:695] error: ...in decoding next frame: Unable to set up output 
format! (code 1)
`

If I now kill (^C) mkchromecast, I get this trace:

,
| 192.168.x.y - - [16/Sep/2016 14:01:07] "GET /stream HTTP/1.1" 200 -
| Process Process-1:
| Traceback (most recent call last):
|   File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in 
_bootstrap
| self.run()
|   File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
| self._target(*self._args, **self._kwargs)
|   File ".../mkchromecast/audio.py", line 523, in start_app
| app.run(host= '0.0.0.0')
|   File "/usr/lib/python2.7/dist-packages/flask/app.py", line 843, in run
| run_simple(host, port, self, **options)
|   File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 694, in 
run_simple
| inner()
|   File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 659, in 
inner
| srv.serve_forever()
|   File "/usr/lib/python2.7/dist-packages/werkzeug/serving.py", line 499, in 
serve_forever
| HTTPServer.serve_forever(self)
|   File "/usr/lib/python2.7/SocketServer.py", line 233, in serve_forever
| self._handle_request_noblock()
|   File "/usr/lib/python2.7/SocketServer.py", line 292, in 
_handle_request_noblock
| self.handle_error(request, client_address)
|   File "/usr/lib/python2.7/SocketServer.py", line 290, in 
_handle_request_noblock
| self.process_request(request, client_address)
|   File "/usr/lib/python2.7/SocketServer.py", line 318, in process_request
| self.finish_request(request, client_address)
|   File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request
| self.RequestHandlerClass(request, client_address, self)
|   File "/usr/lib/python2.7/SocketServer.py", line 654, in __init__
| self.finish()
|   File "/usr/lib/python2.7/SocketServer.py", line 713, in finish
| self.wfile.close()
|   File "/usr/lib/python2.7/socket.py", line 283, in close
| self.flush()
|   File "/usr/lib/python2.7/socket.py", line 307, in flush
| self._sock.sendall(view[write_offset:write_offset+buffer_size])
| error: [Errno 32] Broken pipe
`

The terminal gets messed up and needs to be `reset'.

If I first start the player and mkchromecast after, it works fine.
I can stop and start the player as I please, no apparent troubles.


Cheers,

-- 
Cristian



Bug#835608: mkchromecast: fails to Open pavucontrol and select the mkchromecast sink.

2016-09-16 Thread Cristian Ionescu-Idbohrn
On Fri, 16 Sep 2016, Cristian Ionescu-Idbohrn wrote:
>
> ,
> | hw:4,1
> | hw:4,1
> | mkchromecast v0.3.6
> | Starting local streaming server
> | [Done]
> | Traceback (most recent call last):
> |   File "./mkchromecast.py", line 50, in 
> | import mkchromecast.audio
> |   File ".../mkchromecast/audio.py", line 21, in 
> | from flask import Flask, Response, request
> | ImportError: No module named flask
> `
>
> Looks like I'm missing some 'python-flask' package.

Alright, found that myself and installed package 'python-flask'.
Having done that, progress ;)

Cast media controller status

CastStatus(is_active_input=False, ..., status_text=u'Ready To Cast')


Controls:
=

Volume up: u
Volume down: d
Quit the application: q or Ctrl-C

192.168.x.y - - [16/Sep/2016 13:40:45] "GET /stream HTTP/1.1" 200 -

and sound out the TV speakers.  Fun :)


Cheers,

-- 
Cristian



Bug#835608: mkchromecast: fails to Open pavucontrol and select the mkchromecast sink.

2016-09-16 Thread Cristian Ionescu-Idbohrn
On Fri, 16 Sep 2016, Muammar El Khatib wrote:
> On Fri, Sep 16, 2016 at 10:27:57AM +0200, Cristian Ionescu-Idbohrn wrote:
>
> I have prepared two .asoundrc files (asoundrc1 and asoundrc2).

Thanks.

> You may want to download them and try them as your .asoundrc file.
>
> > ,[ cat /proc/asound/cards ]
> > |  0 [Live   ]: EMU10K1 - SB Live! 5.1 [SB0060]
> > |   SB Live! 5.1 [SB0060] (rev.7, serial:0x80611102) at 
> > 0xd000, irq 17
>
> asoundrc1 for the case where this is the right card: hw:0,0 is the device.

I tested both.  But let's discuss asoundrc1.  Problem is that this
block:

,
| pcm.!default {
|   type asym
|   playback.pcm "LoopAndReal"
|   #capture.pcm "looprec"
|   capture.pcm "hw:0,0"
| }
`

overwrites this one:

,
| pcm.!default {
| type plug
| slave.pcm spdif
| }
`

which I _must_ have in order to get sound out to the speakers through
card 0.

> Now, your Loopback's index is 4,

Right.

> and mkchromecast command should be:
> python mkchromecast.py --encoder-backend ffmpeg --alsa-device hw:4,1 -c ogg 
> --volume
>
> Did it work?.

,
| hw:4,1
| hw:4,1
| mkchromecast v0.3.6
| Starting local streaming server
| [Done]
| Traceback (most recent call last):
|   File "./mkchromecast.py", line 50, in 
| import mkchromecast.audio
|   File ".../mkchromecast/audio.py", line 21, in 
| from flask import Flask, Response, request
| ImportError: No module named flask
`

Looks like I'm missing some 'python-flask' package.


Cheers,

-- 
Cristian



Bug#835608: mkchromecast: fails to Open pavucontrol and select the mkchromecast sink.

2016-09-16 Thread Muammar El Khatib
Hi Cristian,

On Fri, Sep 16, 2016 at 10:27:57AM +0200, Cristian Ionescu-Idbohrn wrote:
> Muammar,
>
> On Fri, 16 Sep 2016, Muammar El Khatib wrote:
> >
> > I hope you are still interested in this.
>
> Of course.
>

Nice!.

> > I have prepared a page in the wiki that you can check:
> >
> > https://github.com/muammar/mkchromecast/wiki/ALSA
> >
> > I would be glad if you could test it. Note that you have to checkout
> > the `alsa` branch.
>
> I would also be glad to do so, if I could figure out how ~/.asoundrc
> must look like.  Currently, the minimal conf to get sound out the
> audio card I prefer is:
>
> ,[ ~/.asoundrc ]
> | pcm.!default {
> | type plug
> | slave.pcm spdif
> | }
> `
>
> Here are some more details on the sound cards on my system:
>

I have prepared two .asoundrc files (asoundrc1 and asoundrc2). You may want to
download them and try them as your .asoundrc file.

> ,[ cat /proc/asound/cards ]
> |  0 [Live   ]: EMU10K1 - SB Live! 5.1 [SB0060]
> |   SB Live! 5.1 [SB0060] (rev.7, serial:0x80611102) at 
> 0xd000, irq 17

asoundrc1 for the case where this is the right card: hw:0,0 is the device.

> |  1 [PCH]: HDA-Intel - HDA Intel PCH
> |   HDA Intel PCH at 0xf723 irq 29

asoundrc1 for the case where this is the right card: hw:1,0 is the device.

>
> ,[ aplay -l ]
> |  List of PLAYBACK Hardware Devices 
> | card 0: Live [SB Live! 5.1 [SB0060]], device 0: emu10k1 [ADC 
> Capture/Standard PCM Playback]
> |   Subdevices: 32/32
> |   Subdevice #0: subdevice #0
> |   Subdevice #1: subdevice #1
> |   Subdevice #2: subdevice #2
> |   Subdevice #3: subdevice #3
> |   Subdevice #4: subdevice #4
> |   Subdevice #5: subdevice #5
> |   Subdevice #6: subdevice #6
> |   Subdevice #7: subdevice #7
> |   Subdevice #8: subdevice #8
> |   Subdevice #9: subdevice #9
> |   Subdevice #10: subdevice #10
> |   Subdevice #11: subdevice #11
> |   Subdevice #12: subdevice #12
> |   Subdevice #13: subdevice #13
> |   Subdevice #14: subdevice #14
> |   Subdevice #15: subdevice #15
> |   Subdevice #16: subdevice #16
> |   Subdevice #17: subdevice #17
> |   Subdevice #18: subdevice #18
> |   Subdevice #19: subdevice #19
> |   Subdevice #20: subdevice #20
> |   Subdevice #21: subdevice #21
> |   Subdevice #22: subdevice #22
> |   Subdevice #23: subdevice #23
> |   Subdevice #24: subdevice #24
> |   Subdevice #25: subdevice #25
> |   Subdevice #26: subdevice #26
> |   Subdevice #27: subdevice #27
> |   Subdevice #28: subdevice #28
> |   Subdevice #29: subdevice #29
> |   Subdevice #30: subdevice #30
> |   Subdevice #31: subdevice #31
> | card 0: Live [SB Live! 5.1 [SB0060]], device 2: emu10k1 efx [Multichannel 
> Capture/PT Playback]
> |   Subdevices: 8/8
> |   Subdevice #0: subdevice #0
> |   Subdevice #1: subdevice #1
> |   Subdevice #2: subdevice #2
> |   Subdevice #3: subdevice #3
> |   Subdevice #4: subdevice #4
> |   Subdevice #5: subdevice #5
> |   Subdevice #6: subdevice #6
> |   Subdevice #7: subdevice #7
> | card 0: Live [SB Live! 5.1 [SB0060]], device 3: emu10k1 [Multichannel 
> Playback]
> |   Subdevices: 1/1
> |   Subdevice #0: subdevice #0
> | card 1: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
> |   Subdevices: 1/1
> |   Subdevice #0: subdevice #0
> | card 1: PCH [HDA Intel PCH], device 1: ALC892 Digital [ALC892 Digital]
> |   Subdevices: 1/1
> |   Subdevice #0: subdevice #0
> | card 2: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
> |   Subdevices: 1/1
> |   Subdevice #0: subdevice #0
> | card 2: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
> |   Subdevices: 1/1
> |   Subdevice #0: subdevice #0
> | card 2: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
> |   Subdevices: 1/1
> |   Subdevice #0: subdevice #0
> | card 3: Controller [USB Audio Controller], device 0: USB Audio [USB Audio]
> |   Subdevices: 1/1
> |   Subdevice #0: subdevice #0
> | card 4: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
> |   Subdevices: 8/8
> |   Subdevice #0: subdevice #0
> |   Subdevice #1: subdevice #1
> |   Subdevice #2: subdevice #2
> |   Subdevice #3: subdevice #3
> |   Subdevice #4: subdevice #4
> |   Subdevice #5: subdevice #5
> |   Subdevice #6: subdevice #6
> |   Subdevice #7: subdevice #7
> | card 4: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
> |   Subdevices: 8/8
> |   Subdevice #0: subdevice #0
> |   Subdevice #1: subdevice #1
> |   Subdevice #2: subdevice #2
> |   Subdevice #3: subdevice #3
> |   Subdevice #4: subdevice #4
> |   Subdevice #5: subdevice #5
> |   Subdevice #6: subdevice #6
> |   Subdevice #7: subdevice #7
> `
>
> Cards 0 and 1 connected to speakers.
>

Now, your Loopback's index is 4, and mkchromecast command should be:

python mkchromecast.py --encoder-backend ffmpeg --alsa-device hw:4,1 -c ogg
--volume

Did it work?.

> > Regarding the two interfaces in your machine, was the chromecast
> > detected? If yes, I think I can provide a flag where you can 

Bug#835608: mkchromecast: fails to Open pavucontrol and select the mkchromecast sink.

2016-09-16 Thread Cristian Ionescu-Idbohrn
Muammar,

On Fri, 16 Sep 2016, Muammar El Khatib wrote:
>
> I hope you are still interested in this.

Of course.

> After reading a lot here and
> there, I am writing this mail casting ti the chromecast using ALSA
> instead of pulseaudio :). It works pretty well so far.  I decided to
> uninstall pulseaudio and I gave it a try.
>
> I have prepared a page in the wiki that you can check:
>
> https://github.com/muammar/mkchromecast/wiki/ALSA
>
> I would be glad if you could test it. Note that you have to checkout
> the `alsa` branch.

I would also be glad to do so, if I could figure out how ~/.asoundrc
must look like.  Currently, the minimal conf to get sound out the
audio card I prefer is:

,[ ~/.asoundrc ]
| pcm.!default {
| type plug
| slave.pcm spdif
| }
`

Here are some more details on the sound cards on my system:

,[ cat /proc/asound/cards ]
|  0 [Live   ]: EMU10K1 - SB Live! 5.1 [SB0060]
|   SB Live! 5.1 [SB0060] (rev.7, serial:0x80611102) at 
0xd000, irq 17
|  1 [PCH]: HDA-Intel - HDA Intel PCH
|   HDA Intel PCH at 0xf723 irq 29
|  2 [NVidia ]: HDA-Intel - HDA NVidia
|   HDA NVidia at 0xf708 irq 17
|  3 [Controller ]: USB-Audio - USB Audio Controller
|   USB Audio Controller at usb-:00:1d.0-1.5, full speed
|  4 [Loopback   ]: Loopback - Loopback
|   Loopback 1
`

,[ aplay -l ]
|  List of PLAYBACK Hardware Devices 
| card 0: Live [SB Live! 5.1 [SB0060]], device 0: emu10k1 [ADC Capture/Standard 
PCM Playback]
|   Subdevices: 32/32
|   Subdevice #0: subdevice #0
|   Subdevice #1: subdevice #1
|   Subdevice #2: subdevice #2
|   Subdevice #3: subdevice #3
|   Subdevice #4: subdevice #4
|   Subdevice #5: subdevice #5
|   Subdevice #6: subdevice #6
|   Subdevice #7: subdevice #7
|   Subdevice #8: subdevice #8
|   Subdevice #9: subdevice #9
|   Subdevice #10: subdevice #10
|   Subdevice #11: subdevice #11
|   Subdevice #12: subdevice #12
|   Subdevice #13: subdevice #13
|   Subdevice #14: subdevice #14
|   Subdevice #15: subdevice #15
|   Subdevice #16: subdevice #16
|   Subdevice #17: subdevice #17
|   Subdevice #18: subdevice #18
|   Subdevice #19: subdevice #19
|   Subdevice #20: subdevice #20
|   Subdevice #21: subdevice #21
|   Subdevice #22: subdevice #22
|   Subdevice #23: subdevice #23
|   Subdevice #24: subdevice #24
|   Subdevice #25: subdevice #25
|   Subdevice #26: subdevice #26
|   Subdevice #27: subdevice #27
|   Subdevice #28: subdevice #28
|   Subdevice #29: subdevice #29
|   Subdevice #30: subdevice #30
|   Subdevice #31: subdevice #31
| card 0: Live [SB Live! 5.1 [SB0060]], device 2: emu10k1 efx [Multichannel 
Capture/PT Playback]
|   Subdevices: 8/8
|   Subdevice #0: subdevice #0
|   Subdevice #1: subdevice #1
|   Subdevice #2: subdevice #2
|   Subdevice #3: subdevice #3
|   Subdevice #4: subdevice #4
|   Subdevice #5: subdevice #5
|   Subdevice #6: subdevice #6
|   Subdevice #7: subdevice #7
| card 0: Live [SB Live! 5.1 [SB0060]], device 3: emu10k1 [Multichannel 
Playback]
|   Subdevices: 1/1
|   Subdevice #0: subdevice #0
| card 1: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
|   Subdevices: 1/1
|   Subdevice #0: subdevice #0
| card 1: PCH [HDA Intel PCH], device 1: ALC892 Digital [ALC892 Digital]
|   Subdevices: 1/1
|   Subdevice #0: subdevice #0
| card 2: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
|   Subdevices: 1/1
|   Subdevice #0: subdevice #0
| card 2: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
|   Subdevices: 1/1
|   Subdevice #0: subdevice #0
| card 2: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
|   Subdevices: 1/1
|   Subdevice #0: subdevice #0
| card 3: Controller [USB Audio Controller], device 0: USB Audio [USB Audio]
|   Subdevices: 1/1
|   Subdevice #0: subdevice #0
| card 4: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
|   Subdevices: 8/8
|   Subdevice #0: subdevice #0
|   Subdevice #1: subdevice #1
|   Subdevice #2: subdevice #2
|   Subdevice #3: subdevice #3
|   Subdevice #4: subdevice #4
|   Subdevice #5: subdevice #5
|   Subdevice #6: subdevice #6
|   Subdevice #7: subdevice #7
| card 4: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
|   Subdevices: 8/8
|   Subdevice #0: subdevice #0
|   Subdevice #1: subdevice #1
|   Subdevice #2: subdevice #2
|   Subdevice #3: subdevice #3
|   Subdevice #4: subdevice #4
|   Subdevice #5: subdevice #5
|   Subdevice #6: subdevice #6
|   Subdevice #7: subdevice #7
`

Cards 0 and 1 connected to speakers.

> Regarding the two interfaces in your machine, was the chromecast
> detected? If yes, I think I can provide a flag where you can specify
> the ip of the host.

Yeah, that may be needed.  Not being able to figure out the alsa
configuration, I tried this:

,
| $ python ./mkchromecast.py --debug --discover
| None
| This option is not implemented yet.
`

But the device is there.  Nmap 

Bug#835608: mkchromecast: fails to Open pavucontrol and select the mkchromecast sink.

2016-09-15 Thread Muammar El Khatib
Hi Christian,

On Wed, Aug 31, 2016 at 9:13 AM, Cristian Ionescu-Idbohrn
 wrote:
>
> Could you please heavily comment your proposed configuration so I can
> locate and modify the relevant bits, before testing again?

>
> It did capture a totally silent wav.  And I guess main reason is
> loopback device number.

I hope you are still interested in this. After reading a lot here and
there, I am writing this mail casting ti the chromecast using ALSA
instead of pulseaudio :). It works pretty well so far.  I decided to
uninstall pulseaudio and I gave it a try.

I have prepared a page in the wiki that you can check:

https://github.com/muammar/mkchromecast/wiki/ALSA

I would be glad if you could test it. Note that you have to checkout
the `alsa` branch.

Regarding the two interfaces in your machine, was the chromecast
detected? If yes, I think I can provide a flag where you can specify
the ip of the host.

Regards,
-- 
Muammar El Khatib.
Linux user: 403107.
GPG Key = 71246E4A.
http://muammar.me | http://proyectociencia.org
  ,''`.
 : :' :
 `. `'
   `-



Bug#835608: mkchromecast: fails to Open pavucontrol and select the mkchromecast sink.

2016-08-31 Thread Cristian Ionescu-Idbohrn
On Mon, 29 Aug 2016, Muammar El Khatib wrote:
>
> Would you mind testing if this procedure makes possible to record
> your audio using alsa?

Muammar,

Sorry for the delay.  Did a quick test.  Problem is I got (too) many
sound cards on this horse ;)

# cat /proc/asound/cards
 0 [Live   ]: EMU10K1 - SB Live! 5.1 [SB0060]
  SB Live! 5.1 [SB0060] (rev.7, serial:0x80611102) at 
0xd000, irq 17
 1 [PCH]: HDA-Intel - HDA Intel PCH
  HDA Intel PCH at 0xf723 irq 29
 2 [NVidia ]: HDA-Intel - HDA NVidia
  HDA NVidia at 0xf708 irq 17
 3 [Controller ]: USB-Audio - USB Audio Controller
  USB Audio Controller at usb-:00:1d.0-1.5, full speed
 4 [Loopback   ]: Loopback - Loopback
  Loopback 1

And asound.conf, ~/.asoundrc is still black magic for me, even after
so many years :(

Could you please heavily comment your proposed configuration so I can
locate and modify the relevant bits, before testing again?

> 1. Do
> modprobe snd-aloop
>
> 2. Add the following content to ~/.asoundrc
>
> pcm.!default {
>   type asym
>   playback.pcm "LoopAndReal"
>   #capture.pcm "looprec"
>   capture.pcm "hw:0,0"
> }
>
> pcm.looprec {
> type hw
> card "Loopback"
> device 1
> subdevice 0
> }
>
> pcm.LoopAndReal {
>   type plug
>   slave.pcm mdev
>   route_policy "duplicate"
> }
>
> pcm.mdev {
>   type multi
>   slaves.a.pcm pcm.MixReale
>   slaves.a.channels 2
>   slaves.b.pcm pcm.MixLoopback
>   slaves.b.channels 2
>   bindings.0.slave a
>   bindings.0.channel 0
>   bindings.1.slave a
>   bindings.1.channel 1
>   bindings.2.slave b
>   bindings.2.channel 0
>   bindings.3.slave b
>   bindings.3.channel 1
> }
>
> pcm.MixReale {
>   type dmix
>   ipc_key 1024
>   slave {
> pcm "hw:0,0"
> rate 48000
> #rate 44100
> periods 128
> period_time 0
> period_size 1024 # must be power of 2
> buffer_size 8192
>   }
> }
>
> pcm.MixLoopback {
>   type dmix
>   ipc_key 1025
>   slave {
> pcm "hw:Loopback,0,0"
> rate 48000
> #rate 44100
> periods 128
> period_time 0
> period_size 1024 # must be power of 2
> buffer_size 8192
>   }
> }
>
> 3. Install ffmpeg, and execute this command while playing anything in your
>computer:
>
> ffmpeg -f alsa -ac 2 -ar 44100 -i hw:0 -t 30 out.wav
>
> Does ffmpeg capture the audio in out.wav?.

It did capture a totally silent wav.  And I guess main reason is
loopback device number.


Cheers,

-- 
Cristian



Bug#835608: mkchromecast: fails to Open pavucontrol and select the mkchromecast sink.

2016-08-29 Thread Muammar El Khatib
Hi Cristian,

On Sun, Aug 28, 2016 at 12:50:59PM +0200, Cristian Ionescu-Idbohrn wrote:
> On Sun, 28 Aug 2016, Muammar El Khatib wrote:
> >
> > That was the idea. After your report, I realized mkchromecast is
> > mostly useless in systems without pulseaudio right now. I will
> > remove that dependency in next releases.
>
> Great.
>
> > Yesterday, I was already playing with ffmpeg + ALSA to capture
> > audio, but I think it will be a complicated solution to implement
> > (cards' and devices' names may change from system to system).  I had
> > forgotten about GStreamer completely. Reading just a bit about it,
> > it may be a possible solution.
>
> Nice.
>
> I'll be watching this space and be ready to test mkchromecast again
> whenever possible.

Would you mind testing if this procedure makes possible to record your audio
using alsa?

1. Do
modprobe snd-aloop

2. Add the following content to ~/.asoundrc

pcm.!default {
  type asym
  playback.pcm "LoopAndReal"
  #capture.pcm "looprec"
  capture.pcm "hw:0,0"
}

pcm.looprec {
type hw
card "Loopback"
device 1
subdevice 0
}

pcm.LoopAndReal {
  type plug
  slave.pcm mdev
  route_policy "duplicate"
}

pcm.mdev {
  type multi
  slaves.a.pcm pcm.MixReale
  slaves.a.channels 2
  slaves.b.pcm pcm.MixLoopback
  slaves.b.channels 2
  bindings.0.slave a
  bindings.0.channel 0
  bindings.1.slave a
  bindings.1.channel 1
  bindings.2.slave b
  bindings.2.channel 0
  bindings.3.slave b
  bindings.3.channel 1
}

pcm.MixReale {
  type dmix
  ipc_key 1024
  slave {
pcm "hw:0,0"
rate 48000
#rate 44100
periods 128
period_time 0
period_size 1024 # must be power of 2
buffer_size 8192
  }
}

pcm.MixLoopback {
  type dmix
  ipc_key 1025
  slave {
pcm "hw:Loopback,0,0"
rate 48000
#rate 44100
periods 128
period_time 0
period_size 1024 # must be power of 2
buffer_size 8192
  }
}

3. Install ffmpeg, and execute this command while playing anything in your
   computer:

ffmpeg -f alsa -ac 2 -ar 44100 -i hw:0 -t 30 out.wav

Does ffmpeg capture the audio in out.wav?. I tested this in a Virtualbox using
debian with pure alsa (I was lazy, and didn't reconfigure everything in my own
laptop).  I think the procedure above did the trick but sound was crippled
(maybe related to Virtualbox).

Thanks.

--
Muammar El Khatib.
Linux user: 403107.
GPG Key = 71246E4A.
http://muammar.me | http://proyectociencia.org
  ,''`.
 : :' :
 `. `'
   `-



Bug#835608: mkchromecast: fails to Open pavucontrol and select the mkchromecast sink.

2016-08-28 Thread Cristian Ionescu-Idbohrn
On Sun, 28 Aug 2016, Muammar El Khatib wrote:
>
> That was the idea. After your report, I realized mkchromecast is
> mostly useless in systems without pulseaudio right now. I will
> remove that dependency in next releases.

Great.

> Yesterday, I was already playing with ffmpeg + ALSA to capture
> audio, but I think it will be a complicated solution to implement
> (cards' and devices' names may change from system to system).  I had
> forgotten about GStreamer completely. Reading just a bit about it,
> it may be a possible solution.

Nice.

I'll be watching this space and be ready to test mkchromecast again
whenever possible.


Cheers,

-- 
Cristian



Bug#835608: mkchromecast: fails to Open pavucontrol and select the mkchromecast sink.

2016-08-28 Thread Muammar El Khatib
On Sun, Aug 28, 2016 at 11:30:04AM +0200, Cristian Ionescu-Idbohrn wrote:
> On Sat, 27 Aug 2016, Muammar El Khatib wrote:
> >
> > I have now updated README.Debian.
>
> I see you added this:
>
>   Depends: ..., pavucontrol, pulseaudio-utils, pulseaudio
>
> but pulseaudio-utils isn't needed, as it is on the pulseaudio
> dependency list.
>

Thanks for the remark.

> In README.md, it might be a good idea to mention pavucontrol under
> Requirements:, Linux.

I will add it.

>
> > Yes, it assumes that pulseaudio is installed on the host.
>
> Right.  Now that pulseaudio is a dependency makes mkchromecast not
> installable on most of my systems, where pulseaudio is a no-no.
>

That was the idea. After your report, I realized mkchromecast is mostly useless
in systems without pulseaudio right now. I will remove that dependency in next
releases.

> > I may try to find another way for capturing the audio from alsa. But
> > in this sense, I am afraid mkchromecast would work as it does in
> > macOS where all system sound is casted. But let's give it a try.
>
> That will certainly be useful, in my case.
> I'm guessing here, as I lack deep knowledge, but gstreamer might be
> another alternative.  It's dealing with sinks too.  See:
>
>   gstreamer1.0-alsa - GStreamer plugin for ALSA
>   gstreamer1.0-pulseaudio - GStreamer plugin for PulseAudio

Thanks for this info!. Yesterday, I was already playing with ffmpeg + ALSA to
capture audio, but I think it will be a complicated solution to implement
(cards' and devices' names may change from system to system).  I had forgotten
about GStreamer completely. Reading just a bit about it, it may be a possible
solution.

Regards,
--
Muammar El Khatib.
Linux user: 403107.
GPG Key = 71246E4A.
http://muammar.me | http://proyectociencia.org
  ,''`.
 : :' :
 `. `'
   `-



Bug#835608: mkchromecast: fails to Open pavucontrol and select the mkchromecast sink.

2016-08-28 Thread Cristian Ionescu-Idbohrn
On Sat, 27 Aug 2016, Muammar El Khatib wrote:
>
> I have now updated README.Debian.

I see you added this:

Depends: ..., pavucontrol, pulseaudio-utils, pulseaudio

but pulseaudio-utils isn't needed, as it is on the pulseaudio
dependency list.

In README.md, it might be a good idea to mention pavucontrol under
Requirements:, Linux.

> Yes, it assumes that pulseaudio is installed on the host.

Right.  Now that pulseaudio is a dependency makes mkchromecast not
installable on most of my systems, where pulseaudio is a no-no.

> I may try to find another way for capturing the audio from alsa. But
> in this sense, I am afraid mkchromecast would work as it does in
> macOS where all system sound is casted. But let's give it a try.

That will certainly be useful, in my case.
I'm guessing here, as I lack deep knowledge, but gstreamer might be
another alternative.  It's dealing with sinks too.  See:

gstreamer1.0-alsa - GStreamer plugin for ALSA
gstreamer1.0-pulseaudio - GStreamer plugin for PulseAudio


Cheers,

-- 
Cristian



Bug#835608: mkchromecast: fails to "Open pavucontrol and select the mkchromecast sink."

2016-08-27 Thread Muammar El Khatib
Hi Cristian,

On Sat, Aug 27, 2016 at 04:57:01PM +0200, Cristian Ionescu-Idbohrn wrote:
> Package: mkchromecast
> Version: 0.3.5-1
> Severity: important
>
> First time run:
>
> $ LC_ALL=en_US.UTF-8 mkchromecast --debug --encoder-backend ffmpeg
> ('backends: ', ['ffmpeg', 'avconv', 'parec'])
> ('backends: ', ['ffmpeg', 'avconv', 'parec'])
> USER =foo
> PATH =/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
> mkchromecast v0.3.5
> :::cast::: sockets method 192.168.98.55
> Creating pulseaudio sink...
> Open pavucontrol and select the mkchromecast sink.
> Traceback (most recent call last):
>   File "/usr/bin/mkchromecast", line 34, in 
> create_sink()
>   File "/usr/share/mkchromecast/mkchromecast/pulseaudio.py", line 28, in 
> create_sink
> stderr=subprocess.PIPE
>   File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
> errread, errwrite)
>   File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
> raise child_exception
> OSError: [Errno 2] No such file or directory
>
> /usr/share/doc/mkchromecast/README.Debian informs:
>
> 3. In order to cast you have to install pavucontrol, and select the
>mkchromecast sink.
>
> But /usr/share/mkchromecast/mkchromecast/pulseaudio.py seems to expect
> commands pactl and pacmd to be available.  Those commands are
> distributed in package pulseaudio-utils, not pavucontrol.
>

I have now updated README.Debian.

> Removing pavucontrol and installing pulseaudio-utils takes me further
> to:
>
> $ LC_ALL=en_US.UTF-8 mkchromecast --debug --encoder-backend ffmpeg
> ('backends: ', ['ffmpeg', 'avconv', 'parec'])
> ('backends: ', ['ffmpeg', 'avconv', 'parec'])
> USER =foo
> PATH =/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
> mkchromecast v0.3.5
> :::cast::: sockets method 192.168.98.55
> Creating pulseaudio sink...
> Open pavucontrol and select the mkchromecast sink.
> Starting local streaming server
> [Done]
> (':::audio::: chunk_size: ', 1024)
> Selected backend: ffmpeg
> Selected audio codec: mp3
> Default bitrate used: 192k
> Default sample rate used: 44100Hz
> :::audio::: command ['ffmpeg', '-ac', '2', '-ar', '44100', '-f', 'pulse', 
> '-i', 'mkchromecast.monitor', '-acodec', 'libmp3lame', '-f', 'mp3', '-ac', 
> '2', '-ar', '44100', '-b:a', '192k', 'pipe:']
> PID of main process: 14226
> PID of streaming process: 14233
>  * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
> self.cclist []
> elif len(self.cclist) == 0 and self.tray == False:
> No devices found!
>
> Wouldn't it be a good idea to add pulseaudio-utils to mkchromecast's
> "Depends:" list?  I should also mention, there's _no_ pulseaudio
> server installed on this computer.  I see this in the strace:

You are right. I have added it to the Depends field.

>
> execve("/usr/bin/pulseaudio", ["/usr/bin/pulseaudio", "--start", 
> "--log-target=syslog"], [/* 50 vars */]) = -1 ENOENT (No such file or 
> directory)
>
> Does mkchromecast assume pulseaudio is installed on the host
> mkchromecast is run on?  In that case mkchromecast is unusable for me
> as I don't want to install pulseaudio, for various reasons.

Yes, it assumes that pulseaudio is installed on the host.  What I basically do
is to monitor an output with a null-sink and pipe it to ffmpeg or record it with
parec and then stream it. With pavucontrol you can select the monitor and have
still audio in your host. I may try to find another way for capturing the audio
from alsa. But in this sense, I am afraid mkchromecast would work as it does in
macOS where all system sound is casted. But let's give it a try.

>
> And after that:
>
> pa_context_connect() failed: Connection refused
>
> The other thing I'm wondering about is this:
>
>   http://0.0.0.0:5000/
>
> nmap reports port 5000 being upnp:
>
> PORT STATE SERVICE
> 8008/tcp open  http
> 8009/tcp open  ajp13
>
> PORT STATE SERVICE
> 1900/udp open|filtered upnp
> 5353/udp open|filtered zeroconf
>
> My computer has two interfaces (eth0 and wlan0) connected to two
> _different_ local networks.  Reading `mkchromecast -h', I couldn't
> find an option enabling me to direct the discovery to a specific
> interface/network.  The chromecast device i on the wireless network
> (wlan0) while this computers primary network is wired (eth0).
>

This is a very interesting option to add. I will do my best to come with
a solution.

> I also see some trafic to 224.0.0.251:5353 and 127.0.0.1:5353, which
> would be the wired network, I guess.
>
> None of these packages:
>
> avahi-autoipd - Avahi IPv4LL network address configuration daemon
> avahi-daemon - Avahi mDNS/DNS-SD daemon
> avahi-discover - Service discover user interface for avahi
> avahi-dnsconfd - Avahi DNS configuration tool
> avahi-ui-utils - Avahi GTK+ utilities
> avahi-utils - Avahi browsing, publishing and discovery utilities
>
> are installed on this host.


Thanks for your report.

Cheers,
--
Muammar El Khatib.
Linux user: 403107.
GPG Key = 71246E4A.
http://muammar.me | 

Bug#835608: mkchromecast: fails to "Open pavucontrol and select the mkchromecast sink."

2016-08-27 Thread Cristian Ionescu-Idbohrn
Package: mkchromecast
Version: 0.3.5-1
Severity: important

First time run:

$ LC_ALL=en_US.UTF-8 mkchromecast --debug --encoder-backend ffmpeg
('backends: ', ['ffmpeg', 'avconv', 'parec'])
('backends: ', ['ffmpeg', 'avconv', 'parec'])
USER =foo
PATH =/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
mkchromecast v0.3.5
:::cast::: sockets method 192.168.98.55
Creating pulseaudio sink...
Open pavucontrol and select the mkchromecast sink.
Traceback (most recent call last):
  File "/usr/bin/mkchromecast", line 34, in 
create_sink()
  File "/usr/share/mkchromecast/mkchromecast/pulseaudio.py", line 28, in 
create_sink
stderr=subprocess.PIPE
  File "/usr/lib/python2.7/subprocess.py", line 711, in __init__
errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1343, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

/usr/share/doc/mkchromecast/README.Debian informs:

3. In order to cast you have to install pavucontrol, and select the
   mkchromecast sink.

But /usr/share/mkchromecast/mkchromecast/pulseaudio.py seems to expect
commands pactl and pacmd to be available.  Those commands are
distributed in package pulseaudio-utils, not pavucontrol.

Removing pavucontrol and installing pulseaudio-utils takes me further
to:

$ LC_ALL=en_US.UTF-8 mkchromecast --debug --encoder-backend ffmpeg
('backends: ', ['ffmpeg', 'avconv', 'parec'])
('backends: ', ['ffmpeg', 'avconv', 'parec'])
USER =foo
PATH =/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
mkchromecast v0.3.5
:::cast::: sockets method 192.168.98.55
Creating pulseaudio sink...
Open pavucontrol and select the mkchromecast sink.
Starting local streaming server
[Done]
(':::audio::: chunk_size: ', 1024)
Selected backend: ffmpeg
Selected audio codec: mp3
Default bitrate used: 192k
Default sample rate used: 44100Hz
:::audio::: command ['ffmpeg', '-ac', '2', '-ar', '44100', '-f', 'pulse', '-i', 
'mkchromecast.monitor', '-acodec', 'libmp3lame', '-f', 'mp3', '-ac', '2', 
'-ar', '44100', '-b:a', '192k', 'pipe:']
PID of main process: 14226
PID of streaming process: 14233
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
self.cclist []
elif len(self.cclist) == 0 and self.tray == False:
No devices found!

Wouldn't it be a good idea to add pulseaudio-utils to mkchromecast's
"Depends:" list?  I should also mention, there's _no_ pulseaudio
server installed on this computer.  I see this in the strace:

execve("/usr/bin/pulseaudio", ["/usr/bin/pulseaudio", "--start", 
"--log-target=syslog"], [/* 50 vars */]) = -1 ENOENT (No such file or directory)

Does mkchromecast assume pulseaudio is installed on the host
mkchromecast is run on?  In that case mkchromecast is unusable for me
as I don't want to install pulseaudio, for various reasons.

And after that:

pa_context_connect() failed: Connection refused

The other thing I'm wondering about is this:

http://0.0.0.0:5000/

nmap reports port 5000 being upnp:

PORT STATE SERVICE
8008/tcp open  http
8009/tcp open  ajp13

PORT STATE SERVICE
1900/udp open|filtered upnp
5353/udp open|filtered zeroconf

My computer has two interfaces (eth0 and wlan0) connected to two
_different_ local networks.  Reading `mkchromecast -h', I couldn't
find an option enabling me to direct the discovery to a specific
interface/network.  The chromecast device i on the wireless network
(wlan0) while this computers primary network is wired (eth0).

I also see some trafic to 224.0.0.251:5353 and 127.0.0.1:5353, which
would be the wired network, I guess.

None of these packages:

avahi-autoipd - Avahi IPv4LL network address configuration daemon
avahi-daemon - Avahi mDNS/DNS-SD daemon
avahi-discover - Service discover user interface for avahi
avahi-dnsconfd - Avahi DNS configuration tool
avahi-ui-utils - Avahi GTK+ utilities
avahi-utils - Avahi browsing, publishing and discovery utilities

are installed on this host.


-- system Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.6.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages mkchromecast depends on:
ii  flac 1.3.1-4
ii  lame 1:3.99.5-dmo5
ii  python-flask 0.11.1-1
ii  python-psutil4.2.0-1
ii  python-pychromecast  0.7.3-2
ii  python-pyqt5 5.7+dfsg-1
pn  python:any   
ii  sox  14.4.1-5+b1
ii  vorbis-tools 1.4.0-10
ii  youtube-dl   2016.06.25-2

mkchromecast recommends no packages.

Versions of packages mkchromecast suggests:
ii  ffmpeg10:3.1.3-dmo1
ii  libav-tools   7:3.1.2-1
pn  mkchromecast-doc  

-- no debconf information


Cheers,

-- 
Cristian