change formatting

input examples are now given as

```bash
input $ARG1
```

While outputs use md's '> ' sign as a quote.
This commit is contained in:
2023-06-17 21:28:20 +02:00
parent 1ba3010b81
commit ba8026e0c3
102 changed files with 2388 additions and 3211 deletions

View File

@@ -14,18 +14,26 @@ The input file might be a device, such as a camera.
Take the format as 'grab the x11 screen'.
> ffmpeg -f x11grab -s [screensize] -i :0.0 out.mkv
```bash
ffmpeg -f x11grab -s [screensize] -i :0.0 out.mkv
```
Get screensize with
> xrandr -q
```bash
xrandr -q
```
or maybe just...
> ffmpeg -f x11grab -s "$(xdpyinfo | grep dimensions | awk '{print $2}')" -i :1.0 out.mkv
```bash
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
```bash
ffmpeg -f x11grab -s [screensize] -i :0.0 -f alsa -i default out.mkv
```
For problems, see pavucontrol.
@@ -34,7 +42,9 @@ For problems, see pavucontrol.
# Rotate
> ffmpeg -i in.mov -vf "transpose=1" out.mov
```bash
ffmpeg -i in.mov -vf "transpose=1" out.mov
```
0 = 90 Counterclockwise and verfical flip (default)
1 = 90 Clockwise
@@ -51,89 +61,106 @@ ffmpeg -i input.mp4 -vcodec libx264 -crf 20 output.mp4
Check for supported formats:
> ffmpeg -formats
```bash
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
```bash
ffmpeg -i LostInTranslation.mkv -codec copy LostInTranslation.mp4
```
Opus to mp3
> ffmpeg -i song.opus song.mp3
```bash
ffmpeg -i song.opus song.mp3
```
> ffmpeg -i video.flv video.mpeg
```bash
ffmpeg -i video.flv video.mpeg
```
> ffmpeg -i input.webm -qscale 0 output.mp4
```bash
ffmpeg -i input.webm -qscale 0 output.mp4
```
# Video to Audio
> ffmpeg -i input.mp4 -vn output.mp3
```bash
ffmpeg -i input.mp4 -vn output.mp3
```
# Convert all mkv files to mp4
> for i in *.mkv; do
```bash
for i in *.mkv; do
```
> ffmpeg -i "$i" -codec copy "${i%.*}.mp4"
> done
```bash
done
```
# Change resolution
> ffmpeg -i input.mp4 -filter:v scale=1280:720 -c:a copy output.mp4
```bash
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
```bash
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
```bash
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
```bash
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
```bash
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
```bash
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
```bash
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.
```bash
$ ffmpeg -loop 1 -i inputimage.jpg -i inputaudio.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4
```
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
```bash
fmpeg -i input.mp4 -i subtitle.srt -map 0 -map 1 -c copy -c:v libx264 -crf 23 -preset veryfast output.mp4
```

View File

@@ -6,48 +6,68 @@ tags: [ "Documentation", "Vision" ]
Convert jpg to png.
> convert image.jpg image.png
```bash
convert image.jpg image.png
```
> convert image.jpg -quality 50 image.jpg
```bash
convert image.jpg -quality 50 image.jpg
```
'Quality' must be from 1 to 100.
> convert -resize 50% image.jpg image2.jpg
```bash
convert -resize 50% image.jpg image2.jpg
```
Resizing only changes jpegs. Change a png with:
> convert input.png png8:out.png
```bash
convert input.png png8:out.png
```
# Invert Colours
> convert input.jpg output.jpg -negate
```bash
convert input.jpg output.jpg -negate
```
# Make Images Smaller
> convert image.jpg -resize 25% output.jpg
```bash
convert image.jpg -resize 25% output.jpg
```
# Trim images to border
This is generally used for transparrent images.
> convert -trim image.png output.png
```bash
convert -trim image.png output.png
```
Make the white of an image transparrent.
> convert -transparent white -fuzz 10% input.png output.png
```bash
convert -transparent white -fuzz 10% input.png output.png
```
The 'fuzz' option tells the computer that 'close to white' is fine. You might want to use 20% or higher fuzz.
## Dropshadow
> `convert <input file> \( +clone -background black -shadow 50x8+0+5 \) +swap -background none -layers merge +repage <output file>`
```bash
`convert <input file> \( +clone -background black -shadow 50x8+0+5 \) +swap -background none -layers merge +repage <output file>`
```
# Convert every jpg in directory to png
> mogrify -format png *.jpg
```bash
mogrify -format png *.jpg
```
# Printing Words
@@ -77,14 +97,20 @@ $potrace -s output.ppm -o svgout.svg
See your installed fonts:
> convert -list font
```bash
convert -list font
```
Make na image showing day of the week:
> convert -fill blue -font Sauce-Code-Pro-Semibold-Nerd-Font-Complete-Mono -gravity center -pointsize 79 label:$(date +%A) day.png
```bash
convert -fill blue -font Sauce-Code-Pro-Semibold-Nerd-Font-Complete-Mono -gravity center -pointsize 79 label:$(date +%A) day.png
```
Make a meme:
> convert inputmemeimage.png -font impact -fill white -pointsize 84 -stroke black -strokewidth 3 -gravity north -annotate +0+20 'TOP MEME TEXT' -gravity south -annotate +0+20 'BOTTOM MEME TEXT' outputmemeimage.png
```bash
convert inputmemeimage.png -font impact -fill white -pointsize 84 -stroke black -strokewidth 3 -gravity north -annotate +0+20 'TOP MEME TEXT' -gravity south -annotate +0+20 'BOTTOM MEME TEXT' outputmemeimage.png
```

View File

@@ -5,9 +5,13 @@ tags: [ "Documentation", "vision" ]
Make a QR Code image:
> qrencode 'https://play.google.com/store/apps/details?id=org.briarproject.briar.android' -o qr_briar.png
```bash
qrencode 'https://play.google.com/store/apps/details?id=org.briarproject.briar.android' -o qr_briar.png
```
Make a QR Coded message in the terminal:
> qrencode -t ansi "Hello World"
```bash
qrencode -t ansi "Hello World"
```