forked from andonome/lk
initial commit
This commit is contained in:
25
sound/basics.md
Normal file
25
sound/basics.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Volume Control
|
||||
|
||||
> pactl set sink @DEFAULT_SINK@ +5%
|
||||
|
||||
Find working outputs:
|
||||
|
||||
> aplay -l
|
||||
|
||||
#Sound Settings
|
||||
|
||||
Surround.5 seems best.
|
||||
|
||||
|
||||
# Find what sound settings exist
|
||||
|
||||
amixer scontrols
|
||||
|
||||
# Change a sound setting
|
||||
|
||||
> amixer set Master 5%-
|
||||
|
||||
# Restart everything
|
||||
|
||||
pulseaudio -k && sudo alsa force-reload
|
||||
|
12
sound/festival.md
Normal file
12
sound/festival.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Basics
|
||||
|
||||
Add your user to the audio group.
|
||||
|
||||
# Set Default Voice
|
||||
|
||||
Edit ~/.festivalrc with
|
||||
|
||||
`(set! voice_default voice_cmu_us_slt_arctic_hts)`
|
||||
|
||||
Or change the order in `/usr/share/festival/voices.scm`
|
||||
|
135
sound/ffmpeg.md
Normal file
135
sound/ffmpeg.md
Normal file
@@ -0,0 +1,135 @@
|
||||
# Basics
|
||||
|
||||
ffmpeg -i [input file] output_file.mkv
|
||||
|
||||
The input file might be a device, such as a camera.
|
||||
|
||||
Play video:
|
||||
|
||||
> ffplay file.mp4
|
||||
|
||||
#Record screen
|
||||
Take the format as 'grab the x11 screen'.
|
||||
|
||||
> ffmpeg -f x11grab -s [screensize] -i :0.0 out.mkv
|
||||
|
||||
Get screensize with
|
||||
|
||||
> xrandr -q
|
||||
|
||||
or maybe just...
|
||||
|
||||
> ffmpeg -f x11grab -s "$(xdpyinfo | grep dimensions | awk '{print $2}')" -i :1.0 out.mkv
|
||||
|
||||
#Add default pulse audio
|
||||
> ffmpeg -f x11grab -s [screensize] -i :0.0 -f alsa -i default out.mkv
|
||||
|
||||
For problems, see pavucontrol.
|
||||
|
||||
# Random online suggestion
|
||||
ffmpeg -video_size "$(xdpyinfo | grep dimensions | awk '{print $2}')" -f x11grab -i :0.0 -f pulse -ac 2 -i default ~/out.mkv
|
||||
|
||||
# Rotate
|
||||
|
||||
> ffmpeg -i in.mov -vf "transpose=1" out.mov
|
||||
|
||||
0 = 90 Counterclockwise and verfical flip (default)
|
||||
1 = 90 Clockwise
|
||||
2 = 90 CounterClockwise
|
||||
3 = 90Clockwise and vertical flip
|
||||
|
||||
# Lower Video Quality
|
||||
A crf quality of 18 is high, while 24 is low quality.
|
||||
|
||||
ffmpeg -i input.mp4 -vcodec libx264 -crf 20 output.mp4
|
||||
|
||||
# convert
|
||||
|
||||
Check for supported formats:
|
||||
|
||||
> ffmpeg -formats
|
||||
|
||||
To convert from mkv to mp4 we can use a codec rather than proper conversion. Both are wrappers around other formats, so this conversion loses less quality than other conversion types.
|
||||
|
||||
> ffmpeg -i LostInTranslation.mkv -codec copy LostInTranslation.mp4
|
||||
|
||||
Opus to mp3
|
||||
|
||||
> ffmpeg -i song.opus song.mp3
|
||||
|
||||
> ffmpeg -i video.flv video.mpeg
|
||||
|
||||
> ffmpeg -i input.webm -qscale 0 output.mp4
|
||||
|
||||
# Video to Audio
|
||||
|
||||
> ffmpeg -i input.mp4 -vn output.mp3
|
||||
|
||||
|
||||
# Convert all mkv files to mp4
|
||||
|
||||
> for i in *.mkv; do
|
||||
|
||||
> ffmpeg -i "$i" -codec copy "${i%.*}.mp4"
|
||||
|
||||
> done
|
||||
|
||||
|
||||
# Change resolution
|
||||
|
||||
> ffmpeg -i input.mp4 -filter:v scale=1280:720 -c:a copy output.mp4
|
||||
|
||||
Or just crop:
|
||||
|
||||
> ffmpeg -i input.mp4 -filter:v "crop=w:h:x:y" output.mp4
|
||||
|
||||
Or aspect ratio:
|
||||
|
||||
> ffmpeg -i input.mp4 -aspect 16:9 output.mp4
|
||||
|
||||
Or trim to start and stop times:
|
||||
|
||||
> ffmpeg -i input.mp4 -ss 00:00:50 -codec copy -t 50 output.mp4
|
||||
|
||||
Indicate start times with -ss and time with -t in seconds.
|
||||
|
||||
Or split a video into parts:
|
||||
|
||||
> ffmpeg -i input.mp4 -t 00:00:30 -c copy part1.mp4 -ss 00:00:30 -codec copy part2.mp4
|
||||
|
||||
|
||||
# Compress Video
|
||||
|
||||
> ffmpeg -i input.mp4 -vf scale=1280:-1 -c:v libx264 -preset veryslow -crf 24 output.mp4
|
||||
|
||||
# Extract Images from Video
|
||||
|
||||
-r sets the frame rate, and -f selects the format.
|
||||
|
||||
> ffmpeg -i input.mp4 -r 1 -f image2 image-%2d.png
|
||||
|
||||
# Add Images to Audio
|
||||
|
||||
> $ ffmpeg -loop 1 -i inputimage.jpg -i inputaudio.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4
|
||||
|
||||
# Create a Video from Multiple Parts
|
||||
|
||||
First make a text file indicating all the parts, e.g.
|
||||
|
||||
```
|
||||
|
||||
file /home/sk/myvideos/part1.mp4
|
||||
file /home/sk/myvideos/part2.mp4
|
||||
file /home/sk/myvideos/part3.mp4
|
||||
file /home/sk/myvideos/part4.mp4
|
||||
|
||||
```
|
||||
|
||||
Then join with:
|
||||
|
||||
> ffmpeg -f concat -i join.txt -c copy output.mp4
|
||||
|
||||
# Add Subtitles
|
||||
|
||||
> fmpeg -i input.mp4 -i subtitle.srt -map 0 -map 1 -c copy -c:v libx264 -crf 23 -preset veryfast output.mp4
|
||||
|
54
sound/mpd.md
Normal file
54
sound/mpd.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# Setup
|
||||
|
||||
## Configuration
|
||||
|
||||
This is a minimum configuration file for /etc/mpd.conf
|
||||
|
||||
```
|
||||
|
||||
music_directory "/var/lib/mpd/music"
|
||||
|
||||
playlist_directory "/var/lib/mpd/playlists"
|
||||
|
||||
db_file "/var/lib/mpd/mpd.db"
|
||||
|
||||
|
||||
pid_file "/run/mpd/mpd.pid"
|
||||
|
||||
state_file "/var/lib/mpd/mpdstate"
|
||||
|
||||
|
||||
user "mpd"
|
||||
|
||||
audio_output {
|
||||
type "pulse"
|
||||
name "My Pulse Output"
|
||||
}
|
||||
|
||||
audio_output {
|
||||
type "fifo"
|
||||
name "my_fifo"
|
||||
path "/tmp/mpd.fifo"
|
||||
format "44100:16:2"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
You can use alsa instead of pulse, but don't unless you're on a Pi.
|
||||
|
||||
Since this is run as the mpd user, you'll need to grant that user pulse acceess, often with the user-group `pulse` or `pulse-access`, but your distro may vary.
|
||||
|
||||
> sudo usermod -aG pulse-access mpd
|
||||
|
||||
Working with mpd will be easier if you have access to its files, so maybe:
|
||||
|
||||
> sudo usermod -aG mpd $USER
|
||||
|
||||
|
||||
|
||||
# Notifications (AUR)
|
||||
|
||||
Install `mpd-notification` and then start the service:
|
||||
|
||||
> systemctl --user enable mpd-notification
|
||||
|
21
sound/ncmpcpp.md
Normal file
21
sound/ncmpcpp.md
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
# Music Player Daemon
|
||||
|
||||
Install, then run as user with all configuration files in ~/.config/mpd/.
|
||||
|
||||
Go down config list, copied from /usr/share/docs/mpd/ or something.
|
||||
|
||||
mpd-configure
|
||||
|
||||
# Problem solving
|
||||
|
||||
I couldn't change volume, so in mpd.conf I uncommented the pulse audio lines and restarted mpd. This allowed pulse audio output, which allows volume change via mpc.
|
||||
|
||||
Also, make sure the user mpd is part of the group pulse:
|
||||
|
||||
> sudo adduser mpd pulse
|
||||
|
||||
In the audio_output section, try setting the mix_type to "software", not "hardware".
|
||||
|
||||
|
||||
If you're using alsa, check if the mpd user is part of the group 'audio'.
|
14
sound/youtube-dl.md
Normal file
14
sound/youtube-dl.md
Normal file
@@ -0,0 +1,14 @@
|
||||
> youtube-dl --write-auto-sub <URL>
|
||||
|
||||
It will default to English, but you can specify another language with the flag --sub-lang:
|
||||
|
||||
> youtube-dl --sub-lang sv --write-auto-sub <URL>
|
||||
|
||||
You can list all available subtitles with:
|
||||
|
||||
> youtube-dl --list-subs <URL>
|
||||
|
||||
It’s also possible to skip the video and only download the subtitle if you add the flag --skip-download:
|
||||
|
||||
> youtube-dl --sub-lang sv --write-auto-sub --skip-download <URL>
|
||||
|
Reference in New Issue
Block a user