Twilypastes

streamit

Dec 29th, 2014
542
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. #
  2. # Guide to stream sound from one computer to another with
  3. # alsa trough ssh using ffmpeg and mplayer.
  4. #
  5. #
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12. ########################################### modprobe
  13. $ sudo modprobe snd-aloop
  14.  
  15. # if alsa driver is compiled without snd-aloop module
  16. # install driver with ./configure --with-cards=aloop --with-sequencer=yes
  17. # Source: http://www.alsa-project.org/main/index.php/Matrix:Module-aloop#The_module_options_for_snd-aloop
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24. ########################################### ~/.asoundrc
  25. pcm.!default {
  26. type asym
  27. playback.pcm "LoopAndReal"
  28. #capture.pcm "looprec"
  29. capture.pcm "hw:0,0"
  30. }
  31.  
  32. pcm.looprec {
  33. type hw
  34. card "Loopback"
  35. device 1
  36. subdevice 0
  37. }
  38.  
  39. pcm.LoopAndReal {
  40. type plug
  41. slave.pcm mdev
  42. route_policy "duplicate"
  43. }
  44.  
  45. pcm.mdev {
  46. type multi
  47. slaves.a.pcm pcm.MixReale
  48. slaves.a.channels 2
  49. slaves.b.pcm pcm.MixLoopback
  50. slaves.b.channels 2
  51. bindings.0.slave a
  52. bindings.0.channel 0
  53. bindings.1.slave a
  54. bindings.1.channel 1
  55. bindings.2.slave b
  56. bindings.2.channel 0
  57. bindings.3.slave b
  58. bindings.3.channel 1
  59. }
  60.  
  61. pcm.MixReale {
  62. type dmix
  63. ipc_key 1024
  64. slave {
  65. pcm "hw:0,0"
  66. rate 48000
  67. #rate 44100
  68. periods 128
  69. period_time 0
  70. period_size 1024 # must be power of 2
  71. buffer_size 8192
  72. }
  73. }
  74.  
  75. pcm.MixLoopback {
  76. type dmix
  77. ipc_key 1025
  78. slave {
  79. pcm "hw:Loopback,0,0"
  80. rate 48000
  81. #rate 44100
  82. periods 128
  83. period_time 0
  84. period_size 1024 # must be power of 2
  85. buffer_size 8192
  86. }
  87. }
  88. # Source: https://bbs.archlinux.org/viewtopic.php?pid=1153194#p1153194
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96. ########################################### ffmpeg/ssh/mplayer
  97. $ ffmpeg -f alsa -ac 2 -i hw:1,1 -f ogg - | ssh user@host mplayer/mplayer.exe - -idle -demuxer ogg
  98.  
  99. # DTS Experiment
  100. $ ffmpeg -f alsa -channel_layout stereo -ac 2 \
  101. -i hw:1,1 -f dts -strict -2 - | \
  102. ssh -c arcfour dwv@twily mplayer/mplayer.exe - \
  103. -idle -quiet -nocache -noautosub -novideo \
  104. -demuxer lavf
  105.  
  106.  
  107. # Source: http://unix.stackexchange.com/questions/116919/redirect-sound-microphone-via-ssh-how-to-telephone-via-ssh
  108. #
  109. # client require ffmpeg and ssh client
  110. # host require mplayer and ssh server
  111. #
  112. # -i hw:1,1 is Loopback device 1
  113. # find card using $ aplay -l
  114. # (hw:Card,Device,Subdevice)
  115. #
Add Comment
Please, Sign In to add comment