Music&Video

From www.deloptes.org
Revision as of 01:57, 11 January 2022 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

Convert MKV to MP4

ffmpeg  -i test.mkv -vcodec copy -acodec aac -strict -2 test.mp4

or with using h264

ffmpeg  -i test.mkv -vcodec h264 -acodec aac -strict -2 test.mp4

Resize video file

ffmpeg -i test.mkv -vf scale=-1:720 -c:v libx264 -crf 18 -preset veryslow -c:a copy test_720p.mkv

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  info
  Server String: unix:/run/user/1000/pulse/native
  Library Protocol Version: 32
  Server Protocol Version: 32
  Is Local: yes
  Client Index: 157
  Tile Size: 65472
  User Name: xxxxxxx
  Host Name: xxxxxxx
  Server Name: pulseaudio
  Server Version: 10.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.pci-0000_00_1b.0.analog-stereo
  Cookie: 4aea:057c
  $ pactl stat
  Currently in use: 1 blocks containing 63.9 KiB bytes total.
  Allocated during whole lifetime: 375708 blocks containing 2.7 GiB bytes total.
  Sample cache size: 0 B