1 2 # check battery from command line 3 4 There are at least 2 command you can use, 5 each will tell the percentage of battery. 6 7 acpi 8 upower 9 10 I made a video to demo it, if needed, 11 you can view the youtube video: 12 [how to get battery status](https://youtu.be/1De5MzqBz7I) 13 14 By the way, I am using Ubuntu 16.04. 15 16 ## acpi 17 18 acpi 19 20 This is what I got: 21 22 Battery 0: Charging, 86%, 00:12:32 until charged 23 24 25 If you have no acpi installed, use the following to install 26 27 sudo apt-get install acpi 28 29 ## upower 30 31 upower -e 32 33 or 34 35 upower --enumerate 36 37 38 As example, this is output on my laptop: 39 40 /org/freedesktop/UPower/devices/line_power_AC 41 /org/freedesktop/UPower/devices/battery_BAT1 42 /org/freedesktop/UPower/devices/DisplayDevice 43 44 45 46 ### Then use one of the above output in the following command 47 48 49 upower -i /org/freedesktop/UPower/devices/battery_BAT1 50 51 52 This is my output this time: 53 54 native-path: BAT1 55 vendor: SANYO 56 model: 45N1767 57 serial: 1097 58 power supply: yes 59 updated: Thu 30 Mar 2017 05:00:18 PM CST (62 seconds ago) 60 has history: yes 61 has statistics: yes 62 battery 63 present: yes 64 rechargeable: yes 65 state: charging 66 warning-level: none 67 energy: 24.21 Wh 68 energy-empty: 0 Wh 69 energy-full: 40.09 Wh 70 energy-full-design: 47.52 Wh 71 energy-rate: 28.254 W 72 voltage: 11.753 V 73 time to full: 33.7 minutes 74 percentage: 60% 75 capacity: 84.3645% 76 technology: lithium-ion 77 icon-name: 'battery-full-charging-symbolic' 78 History (charge): 79 1490864418 60.000 charging 80 History (rate): 81 1490864418 28.254 charging 82 83
Thursday, March 30, 2017
check battery from command line - linux ubuntu
Tuesday, January 10, 2017
audio recording from usb microphone with linux ubuntu 16, ffmpeg, arecord,
1 2 3 4 # audio recording from usb microphone 5 6 with linux ubuntu 16, ffmpeg, arecord, 7 8 alsamixer, lsusb, audacity 9 10 11 12 ref: 13 14 https://trac.ffmpeg.org/wiki/Capture/ALSA 15 16 http://tuxradar.com/content/how-it-works-linux-audio-explained 17 18 http://trac.edgewall.org/ 19 20 21 ## ALSA, OSS 22 23 On Linux, recording with a USB microphone is best done under ALSA 24 (Advanced Linux Sound Architecture). Current Audacity provides native 25 ALSA support. 1.2.x versions of Audacity only support the older OSS 26 (Open Sound System), but can work with ALSA using an OSS emulation 27 layer. 28 29 30 ## capturing from ALSA 31 32 Capturing audio with ffmpeg and ALSA is pretty much straightforward: 33 34 ffmpeg -f alsa <input_options> -i <input_device> ... output.wav 35 36 -f fmt (input/output) 37 38 Force input or output file format. The format is normally auto 39 detected for input files and guessed from the file extension 40 for output files, so this option is not needed in most cases. 41 42 -i url (input), input file url 43 44 45 ## Selecting the input card 46 47 input_device tells ffmpeg which audio capturing card or device you 48 would like to use. To get the list of all installed cards on your 49 machine, you can type arecord -l or arecord -L (longer output). 50 51 To list recording cards or devices: 52 53 $ arecord -l 54 55 **** List of CAPTURE Hardware Devices **** 56 card 0: ICH5 [Intel ICH5], device 0: Intel ICH [Intel ICH5] 57 Subdevices: 1/1 58 Subdevice #0: subdevice #0 59 card 0: ICH5 [Intel ICH5], device 1: Intel ICH - MIC ADC [Intel 60 ICH5 - MIC ADC] 61 Subdevices: 1/1 62 Subdevice #0: subdevice #0 63 64 We can see there are 2 audio cards installed that 65 provide capturing capabilities, namely "card 0" 66 (Intel ICH5) and "card 1" (Microphone on the USB 67 web cam). The easiest thing to do is to reference 68 each of them directly using 69 70 -f alsa -i hw:0 71 72 #@or 73 74 -f alsa -i hw:1: 75 76 77 ffmpeg -f alsa -i hw:1 -t 30 out.wav 78 79 That will give us a 30 seconds WAV audio output, 80 recorded from our USB camera's default recording 81 device (microphone). The default recording device 82 can be selected using the alsamixer tool (see 83 below) or specifying the device using an 84 additional parameter Y in hw:<X>,<Y>, where 85 <X>=card, <Y>=device. For example, to select "MIC2 86 ADC" from Intel card (look above at the list), we 87 would use: 88 89 ffmpeg -f alsa -i hw:0,2 -t 30 out.wav 90 91 The best way is to select your card and default 92 recording device with the alsamixer tool, because 93 some audio cards have a complicated way of 94 selecting the default input through the ffmpeg 95 command line. 96 97 98 ## Input options 99 100 The only useful audio input options for ALSA input are -ar (audio sample rate) 101 and -ac (audio channels). 102 103 Specifying audio sampling rate/frequency will force the audio card to record 104 the audio at that specified rate. Usually the default value is "44100" (Hz). 105 Specifying audio channels will force the audio card to record the audio as 106 mono, stereo or even 2.1/5.1 (if supported by your audio card). Usually the 107 default value is "1" (mono) for Mic input and "2" (stereo) for Line-In input. 108 109 110 Another option for ffmpeg: 111 112 -thread_queue_size 512 113 114 115 ## Example 116 117 Record audio from the microphone 118 119 120 ffmpeg -f alsa -ac 1 -ar 44100 -i hw:0 -t 30 out.wav 121 122 ffmpeg -thread_queuq_size 512 \ 123 -f alsa \ 124 -ac 1 \ 125 -ar 44100 \ 126 -i hw:0 \ 127 -t 30 \ 128 youFileName.wav 129 130 131 132 133 ## end of part 1 134 135 <!-- vim: set tw=70 ft=markdown nowrap fdm=marker ignorecase: -->
Subscribe to:
Posts (Atom)