Music&Video
Convert MP4 to MP3 files
- general options
ffmpeg -v 5 -y -i input.mp4 -acodec libmp3lame -ac 2 -ab 192k output.mp3
- general from scipt *
ffmpeg -v 5 -y -i input.mp4 -acodec libmp3lame -ac 2 -ab 192k output.mp3 < /dev/null
- useful for me
rm /tmp/script.sh; ls | while read line; do \ echo ">>"$line; out=$(echo $line| sed s:mp4$::); \ echo 'ffmpeg -v 32 -y -i "'$line'" -acodec libmp3lame -ac 2 -ab 192k "'$out'mp3" < /dev/null' >> /tmp/script.sh; \ done ; \ bash /tmp/script.sh
Mplayer and usb camera
mplayer -fps 10 -tv driver=v4l2:width=640:height=480:device=/dev/video0 tv://
3 steps to find out and test a microphone on linux with alsa
1) find out cards and inputs
shell> cat /proc/asound/cards 0 [Intel ]: HDA-Intel - HDA Intel HDA Intel at 0xff950000 irq 22 1 [HVR900 ]: USB-Audio - WinTV HVR-900 WinTV HVR-900 at usb-0000:00:1a.7-3, high speed 2 [Webcam ]: USB-Audio - Philips SPC 1000NC Webcam Philips CE Philips SPC 1000NC Webcam at usb-0000:00:1a.7-5.4, high speed
=> I'm going to use the Webcam built in mic => card # 2
2) find out the input
shell> cat /proc/asound/devices 0: [ 0] : control 1: : sequencer 6: [ 0- 2]: hardware dependent 7: [ 0- 3]: hardware dependent 16: [ 0- 0]: digital audio playback 17: [ 0- 1]: digital audio playback 19: [ 0- 3]: digital audio playback 24: [ 0- 0]: digital audio capture 32: [ 1] : control 33: : timer 56: [ 1- 0]: digital audio capture 64: [ 2] : control 88: [ 2- 0]: digital audio capture
=> my input is the capture on the second card
88: [ 2- 0]: digital audio capture
3) so no we can test the mic
shell> arecord -c1 -Dplughw:2,0 -f cd -vv /dev/null
PulseAudio
pactl stat
Currently in use: 17 blocks containing 216,3 KiB bytes total. Allocated during whole lifetime: 947139 blocks containing 1,6 GiB bytes total. Sample cache size: 0 B Server String: /tmp/pulse-EPQnHaSCnLWC/native Library Protocol Version: 26 Server Protocol Version: 26 Is Local: yes Client Index: 17 Tile Size: 65472 User Name: user Host Name: localhost Server Name: pulseaudio Server Version: 2.0 Default Sample Specification: s16le 2ch 44100Hz Default Channel Map: front-left,front-right Default Sink: alsa_output.pci-0000_00_1b.0.analog-stereo Default Source: alsa_input.usb-Philips_CE_Philips_SPC_1030NC_Webcam-02-Webcam.analog-mono Cookie: 9cec:902b
Module #0 Name: module-device-restore Argument: Usage counter: n/a Properties: module.author = "Lennart Poettering" module.description = "Automatically restore the volume/mute state of devices" module.version = "2.0"
Module #1 Name: module-stream-restore Argument: Usage counter: n/a Properties: module.author = "Lennart Poettering" module.description = "Automatically restore the volume/mute/device state of streams" module.version = "2.0"
Module #2 Name: module-card-restore Argument: Usage counter: n/a Properties: module.author = "Lennart Poettering" module.description = "Automatically restore profile of cards" module.version = "2.0"
Module #3 Name: module-augment-properties Argument: Usage counter: n/a Properties: module.author = "Lennart Poettering" module.description = "Augment the property sets of streams with additional static information" module.version = "2.0"
Module #4 Name: module-alsa-card Argument: device_id="0" name="pci-0000_00_1b.0" card_name="alsa_card.pci-0000_00_1b.0" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes card_properties="module-udev-detect.discovered=1" Usage counter: 1 Properties: module.author = "Lennart Poettering" module.description = "ALSA Card" module.version = "2.0"
Module #5 Name: module-alsa-card Argument: device_id="1" name="usb-Philips_CE_Philips_SPC_1030NC_Webcam-02-Webcam" card_name="alsa_card.usb-Philips_CE_Philips_SPC_1030NC_Webcam-02-Webcam" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes card_properties="module-udev-detect.discovered=1" Usage counter: 0 Properties: module.author = "Lennart Poettering" module.description = "ALSA Card" module.version = "2.0"
Module #6 Name: module-udev-detect Argument: Usage counter: n/a Properties: module.author = "Lennart Poettering" module.description = "Detect available audio hardware and load matching drivers" module.version = "2.0"
Module #7 Name: module-native-protocol-unix Argument: Usage counter: n/a Properties: module.author = "Lennart Poettering" module.description = "Native protocol (UNIX sockets)" module.version = "2.0"
Module #8 Name: module-default-device-restore Argument: Usage counter: n/a Properties: module.author = "Lennart Poettering" module.description = "Automatically restore the default sink and source" module.version = "2.0"
Module #9 Name: module-rescue-streams Argument: Usage counter: n/a Properties: module.author = "Lennart Poettering" module.description = "When a sink/source is removed, try to move their streams to the default sink/source" module.version = "2.0"
Module #10 Name: module-always-sink Argument: Usage counter: n/a Properties: module.author = "Colin Guthrie" module.description = "Always keeps at least one sink loaded even if it's a null one" module.version = "2.0"
Module #11 Name: module-intended-roles Argument: Usage counter: n/a Properties: module.author = "Lennart Poettering" module.description = "Automatically set device of streams based of intended roles of devices" module.version = "2.0"
Module #12 Name: module-suspend-on-idle Argument: Usage counter: n/a Properties: module.author = "Lennart Poettering" module.description = "When a sink/source is idle for too long, suspend it" module.version = "2.0"
Module #13 Name: module-console-kit Argument: Usage counter: n/a Properties: module.author = "Lennart Poettering" module.description = "Create a client for each ConsoleKit session of this user" module.version = "2.0"
Module #14 Name: module-systemd-login Argument: Usage counter: n/a Properties: module.author = "Lennart Poettering" module.description = "Create a client for each login session of this user" module.version = "2.0"
Module #15 Name: module-position-event-sounds Argument: Usage counter: n/a Properties: module.author = "Lennart Poettering" module.description = "Position event sounds between L and R depending on the position on screen of the widget triggering them." module.version = "2.0"
Module #16 Name: module-filter-heuristics Argument: Usage counter: n/a Properties: module.author = "Colin Guthrie" module.description = "Detect when various filters are desirable" module.version = "2.0"
Module #17 Name: module-filter-apply Argument: Usage counter: n/a Properties: module.author = "Colin Guthrie" module.description = "Load filter sinks automatically when needed" module.version = "2.0"
Module #18 Name: module-dbus-protocol Argument: Usage counter: n/a Properties: module.author = "Tanu Kaskinen" module.description = "D-Bus interface" module.version = "2.0"
Module #19 Name: module-switch-on-port-available Argument: Usage counter: n/a Properties:
Sink #0 State: SUSPENDED Name: alsa_output.pci-0000_00_1b.0.analog-stereo Description: Built-in Audio Analog Stereo Driver: module-alsa-card.c Sample Specification: s16le 2ch 48000Hz Channel Map: front-left,front-right Owner Module: 4 Mute: no Volume: 0: 19% 1: 19% 0: -42,60 dB 1: -42,60 dB balance 0,00 Base Volume: 100% 0,00 dB Monitor Source: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor Latency: 0 usec, configured 0 usec Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY Properties: alsa.resolution_bits = "16" device.api = "alsa" device.class = "sound" alsa.class = "generic" alsa.subclass = "generic-mix" alsa.name = "STAC9200 Analog" alsa.id = "STAC9200 Analog" alsa.subdevice = "0" alsa.subdevice_name = "subdevice #0" alsa.device = "0" alsa.card = "0" alsa.card_name = "HDA Intel" alsa.long_card_name = "HDA Intel at 0xefebc000 irq 43" alsa.driver_name = "snd_hda_intel" device.bus_path = "pci-0000:00:1b.0" sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0" device.bus = "pci" device.vendor.id = "8086" device.vendor.name = "Intel Corporation" device.product.name = "NM10/ICH7 Family High Definition Audio Controller" device.form_factor = "internal" device.string = "front:0" device.buffering.buffer_size = "65536" device.buffering.fragment_size = "32768" device.access_mode = "mmap+timer" device.profile.name = "analog-stereo" device.profile.description = "Analog Stereo" device.description = "Built-in Audio Analog Stereo" alsa.mixer_name = "SigmaTel STAC9200" alsa.components = "HDA:83847690,102801d4,00102201 HDA:14f12bfa,14f100c3,00090000" module-udev-detect.discovered = "1" device.icon_name = "audio-card-pci" Ports: analog-output: Analog Output (priority: 9900) Active Port: analog-output Formats: pcm
Source #0 State: SUSPENDED Name: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor Description: Monitor of Built-in Audio Analog Stereo Driver: module-alsa-card.c Sample Specification: s16le 2ch 44100Hz Channel Map: front-left,front-right Owner Module: 4 Mute: no Volume: 0: 100% 1: 100% 0: 0,00 dB 1: 0,00 dB balance 0,00 Base Volume: 100% 0,00 dB Monitor of Sink: alsa_output.pci-0000_00_1b.0.analog-stereo Latency: 0 usec, configured 0 usec Flags: DECIBEL_VOLUME LATENCY Properties: device.description = "Monitor of Built-in Audio Analog Stereo" device.class = "monitor" alsa.card = "0" alsa.card_name = "HDA Intel" alsa.long_card_name = "HDA Intel at 0xefebc000 irq 43" alsa.driver_name = "snd_hda_intel" device.bus_path = "pci-0000:00:1b.0" sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0" device.bus = "pci" device.vendor.id = "8086" device.vendor.name = "Intel Corporation" device.product.name = "NM10/ICH7 Family High Definition Audio Controller" device.form_factor = "internal" device.string = "0" module-udev-detect.discovered = "1" device.icon_name = "audio-card-pci" Formats: pcm
Source #1 State: SUSPENDED Name: alsa_input.pci-0000_00_1b.0.analog-stereo Description: Built-in Audio Analog Stereo Driver: module-alsa-card.c Sample Specification: s16le 2ch 44100Hz Channel Map: front-left,front-right Owner Module: 4 Mute: no Volume: 0: 53% 1: 53% 0: -16,50 dB 1: -16,50 dB balance 0,00 Base Volume: 42% -22,50 dB Monitor of Sink: n/a Latency: 0 usec, configured 0 usec Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY Properties: alsa.resolution_bits = "16" device.api = "alsa" device.class = "sound" alsa.class = "generic" alsa.subclass = "generic-mix" alsa.name = "STAC9200 Analog" alsa.id = "STAC9200 Analog" alsa.subdevice = "0" alsa.subdevice_name = "subdevice #0" alsa.device = "0" alsa.card = "0" alsa.card_name = "HDA Intel" alsa.long_card_name = "HDA Intel at 0xefebc000 irq 43" alsa.driver_name = "snd_hda_intel" device.bus_path = "pci-0000:00:1b.0" sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0" device.bus = "pci" device.vendor.id = "8086" device.vendor.name = "Intel Corporation" device.product.name = "NM10/ICH7 Family High Definition Audio Controller" device.form_factor = "internal" device.string = "front:0" device.buffering.buffer_size = "65536" device.buffering.fragment_size = "32768" device.access_mode = "mmap+timer" device.profile.name = "analog-stereo" device.profile.description = "Analog Stereo" device.description = "Built-in Audio Analog Stereo" alsa.mixer_name = "SigmaTel STAC9200" alsa.components = "HDA:83847690,102801d4,00102201 HDA:14f12bfa,14f100c3,00090000" module-udev-detect.discovered = "1" device.icon_name = "audio-card-pci" Ports: analog-input-microphone-front: Front Microphone (priority: 8500, not available) analog-input-microphone-rear: Rear Microphone (priority: 8200, not available) analog-input-linein: Line In (priority: 8100) Active Port: analog-input-linein Formats: pcm
Source #2 State: SUSPENDED Name: alsa_input.usb-Philips_CE_Philips_SPC_1030NC_Webcam-02-Webcam.analog-mono Description: Webcam SPC1030NC Analog Mono Driver: module-alsa-card.c Sample Specification: s16le 1ch 48000Hz Channel Map: mono Owner Module: 5 Mute: no Volume: 0: 88% 0: -3,40 dB balance 0,00 Base Volume: 34% -28,00 dB Monitor of Sink: n/a Latency: 0 usec, configured 0 usec Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY Properties: alsa.resolution_bits = "16" device.api = "alsa" device.class = "sound" alsa.class = "generic" alsa.subclass = "generic-mix" alsa.name = "USB Audio" alsa.id = "USB Audio" alsa.subdevice = "0" alsa.subdevice_name = "subdevice #0" alsa.device = "0" alsa.card = "1" alsa.card_name = "Philips SPC 1030NC Webcam" alsa.long_card_name = "Philips CE Philips SPC 1030NC Webcam at usb-0000:00:1d.7-8.3.3, high speed" alsa.driver_name = "snd_usb_audio" device.bus_path = "pci-0000:00:1d.7-usb-0:8.3.3:1.2" sysfs.path = "/devices/pci0000:00/0000:00:1d.7/usb5/5-8/5-8.3/5-8.3.3/5-8.3.3:1.2/sound/card1" udev.id = "usb-Philips_CE_Philips_SPC_1030NC_Webcam-02-Webcam" device.bus = "usb" device.vendor.id = "0471" device.vendor.name = "Philips (or NXP)" device.product.id = "2036" device.product.name = "Webcam SPC1030NC" device.serial = "Philips_CE_Philips_SPC_1030NC_Webcam" device.form_factor = "webcam" device.string = "hw:1" device.buffering.buffer_size = "176400" device.buffering.fragment_size = "88200" device.access_mode = "mmap+timer" device.profile.name = "analog-mono" device.profile.description = "Analog Mono" device.description = "Webcam SPC1030NC Analog Mono" alsa.mixer_name = "USB Mixer" alsa.components = "USB0471:2036" module-udev-detect.discovered = "1" device.icon_name = "camera-web-usb" Ports: analog-input-microphone: Microphone (priority: 8700) Active Port: analog-input-microphone Formats: pcm
Sink Input #97 Driver: protocol-native.c Owner Module: 7 Client: 13 Sink: 0 Sample Specification: s16le 2ch 48000Hz Channel Map: front-left,front-right Format: pcm, format.sample_format = "\"s16le\"" format.rate = "48000" format.channels = "2" format.channel_map = "\"front-left,front-right\"" Mute: no Volume: 0: 19% 1: 19% 0: -42,60 dB 1: -42,60 dB balance 0,00 Buffer Latency: 496416 usec Sink Latency: 0 usec Resample method: n/a Properties: media.name = "ALSA Playback" application.name = "ALSA plug-in [mplayer1]" native-protocol.peer = "UNIX socket client" native-protocol.version = "26" application.process.id = "7147" application.process.user = "user" application.process.host = "localhost" application.process.binary = "mplayer1" application.language = "C" window.x11.display = ":0" application.process.machine_id = "0adf833fd21f786cd7b886f64b081869" application.process.session_id = "0adf833fd21f786cd7b886f64b081869-1408381524.671640-187569320" module-stream-restore.id = "sink-input-by-application-name:ALSA plug-in [mplayer1]"
Client #0 Driver: module-console-kit.c Owner Module: 13 Properties: application.name = "ConsoleKit Session /org/freedesktop/ConsoleKit/Session1" console-kit.session = "/org/freedesktop/ConsoleKit/Session1"
Client #5 Driver: protocol-native.c Owner Module: 7 Properties: application.name = "ALSA plug-in [kmix]" native-protocol.peer = "UNIX socket client" native-protocol.version = "26" application.process.id = "6978" application.process.user = "user" application.process.host = "localhost" application.process.binary = "kmix" application.language = "bg_BG.UTF-8" window.x11.display = ":0" application.process.machine_id = "0adf833fd21f786cd7b886f64b081869" application.process.session_id = "0adf833fd21f786cd7b886f64b081869-1408381524.671640-187569320"
Client #6 Driver: protocol-native.c Owner Module: 7 Properties: application.name = "Skype" native-protocol.peer = "UNIX socket client" native-protocol.version = "26" application.process.id = "6996" application.process.user = "user" application.process.host = "localhost" application.process.binary = "skype" application.language = "bg_BG.UTF-8" window.x11.display = ":0" application.process.machine_id = "0adf833fd21f786cd7b886f64b081869" application.process.session_id = "0adf833fd21f786cd7b886f64b081869-1408381524.671640-187569320"
Client #13 Driver: protocol-native.c Owner Module: 7 Properties: application.name = "ALSA plug-in [mplayer1]" native-protocol.peer = "UNIX socket client" native-protocol.version = "26" application.process.id = "7147" application.process.user = "user" application.process.host = "localhost" application.process.binary = "mplayer1" application.language = "C" window.x11.display = ":0" application.process.machine_id = "0adf833fd21f786cd7b886f64b081869" application.process.session_id = "0adf833fd21f786cd7b886f64b081869-1408381524.671640-187569320"
Client #18 Driver: protocol-native.c Owner Module: 7 Properties: application.name = "pactl" native-protocol.peer = "UNIX socket client" native-protocol.version = "26" application.process.id = "8079" application.process.user = "user" application.process.host = "localhost" application.process.binary = "pactl" application.language = "bg_BG.UTF-8" window.x11.display = ":0" application.process.machine_id = "0adf833fd21f786cd7b886f64b081869" application.process.session_id = "0adf833fd21f786cd7b886f64b081869-1408381524.671640-187569320"
Card #0 Name: alsa_card.pci-0000_00_1b.0 Driver: module-alsa-card.c Owner Module: 4 Properties: alsa.card = "0" alsa.card_name = "HDA Intel" alsa.long_card_name = "HDA Intel at 0xefebc000 irq 43" alsa.driver_name = "snd_hda_intel" device.bus_path = "pci-0000:00:1b.0" sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0" device.bus = "pci" device.vendor.id = "8086" device.vendor.name = "Intel Corporation" device.product.name = "NM10/ICH7 Family High Definition Audio Controller" device.form_factor = "internal" device.string = "0" device.description = "Built-in Audio" module-udev-detect.discovered = "1" device.icon_name = "audio-card-pci" Profiles: output:analog-stereo: Analog Stereo Output (sinks: 1, sources: 0, priority. 6000) output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (sinks: 1, sources: 1, priority. 6060) output:analog-stereo+input:iec958-stereo: Analog Stereo Output + Digital Stereo (IEC958) Input (sinks: 1, sources: 1, priority. 6055) output:iec958-stereo: Digital Stereo (IEC958) Output (sinks: 1, sources: 0, priority. 5500) output:iec958-stereo+input:analog-stereo: Digital Stereo (IEC958) Output + Analog Stereo Input (sinks: 1, sources: 1, priority. 5560) output:iec958-stereo+input:iec958-stereo: Digital Stereo Duplex (IEC958) (sinks: 1, sources: 1, priority. 5555) input:analog-stereo: Analog Stereo Input (sinks: 0, sources: 1, priority. 60) input:iec958-stereo: Digital Stereo (IEC958) Input (sinks: 0, sources: 1, priority. 55) off: Off (sinks: 0, sources: 0, priority. 0) Active Profile: output:analog-stereo+input:analog-stereo Ports: analog-output: Analog Output (priority: 9900) Part of profile(s): output:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-stereo+input:iec958-stereo analog-input-microphone-front: Front Microphone (priority: 8500, not available) Part of profile(s): output:analog-stereo+input:analog-stereo, output:iec958-stereo+input:analog-stereo, input:analog-stereo analog-input-microphone-rear: Rear Microphone (priority: 8200, not available) Part of profile(s): output:analog-stereo+input:analog-stereo, output:iec958-stereo+input:analog-stereo, input:analog-stereo analog-input-linein: Line In (priority: 8100) Part of profile(s): output:analog-stereo+input:analog-stereo, output:iec958-stereo+input:analog-stereo, input:analog-stereo iec958-stereo-input: iec958-stereo-input (priority: 0) Part of profile(s): output:analog-stereo+input:iec958-stereo, output:iec958-stereo+input:iec958-stereo, input:iec958-stereo iec958-stereo-output: Digital Output (S/PDIF) (priority: 0) Part of profile(s): output:iec958-stereo, output:iec958-stereo+input:analog-stereo, output:iec958-stereo+input:iec958-stereo
Card #1 Name: alsa_card.usb-Philips_CE_Philips_SPC_1030NC_Webcam-02-Webcam Driver: module-alsa-card.c Owner Module: 5 Properties: alsa.card = "1" alsa.card_name = "Philips SPC 1030NC Webcam" alsa.long_card_name = "Philips CE Philips SPC 1030NC Webcam at usb-0000:00:1d.7-8.3.3, high speed" alsa.driver_name = "snd_usb_audio" device.bus_path = "pci-0000:00:1d.7-usb-0:8.3.3:1.2" sysfs.path = "/devices/pci0000:00/0000:00:1d.7/usb5/5-8/5-8.3/5-8.3.3/5-8.3.3:1.2/sound/card1" udev.id = "usb-Philips_CE_Philips_SPC_1030NC_Webcam-02-Webcam" device.bus = "usb" device.vendor.id = "0471" device.vendor.name = "Philips (or NXP)" device.product.id = "2036" device.product.name = "Webcam SPC1030NC" device.serial = "Philips_CE_Philips_SPC_1030NC_Webcam" device.form_factor = "webcam" device.string = "1" device.description = "Webcam SPC1030NC" module-udev-detect.discovered = "1" device.icon_name = "camera-web-usb" Profiles: input:analog-mono: Analog Mono Input (sinks: 0, sources: 1, priority. 1) off: Off (sinks: 0, sources: 0, priority. 0) Active Profile: input:analog-mono Ports: analog-input-microphone: Microphone (priority: 8700) Part of profile(s): input:analog-mono