change ``bash headers to ``sh
				
					
				
			This commit is contained in:
		| @@ -14,25 +14,25 @@ The input file might be a device, such as a camera. | ||||
|  | ||||
| Take the format as 'grab the x11 screen'. | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| ffmpeg -f x11grab -s [screensize] -i :0.0 out.mkv | ||||
| ``` | ||||
|  | ||||
| Get screensize with | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| xrandr -q | ||||
| ``` | ||||
|  | ||||
| or maybe just... | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| ffmpeg -f x11grab -s "$(xdpyinfo | grep dimensions | awk '{print $2}')" -i :1.0 out.mkv | ||||
| ``` | ||||
|  | ||||
| # Add default pulse audio | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| ffmpeg -f x11grab -s [screensize] -i :0.0 -f alsa -i default out.mkv | ||||
| ``` | ||||
|  | ||||
| @@ -43,7 +43,7 @@ For problems, see pavucontrol. | ||||
|  | ||||
| # Rotate | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| ffmpeg -i in.mov -vf "transpose=1" out.mov | ||||
| ``` | ||||
|  | ||||
| @@ -62,71 +62,71 @@ ffmpeg -i input.mp4 -vcodec libx264 -crf 20 output.mp4 | ||||
|  | ||||
| Check for supported formats: | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| 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. | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| ffmpeg -i LostInTranslation.mkv -codec copy LostInTranslation.mp4 | ||||
| ``` | ||||
|  | ||||
| Opus to mp3 | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| ffmpeg -i song.opus song.mp3 | ||||
| ``` | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| ffmpeg -i video.flv video.mpeg | ||||
| ``` | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| ffmpeg -i input.webm -qscale 0 output.mp4 | ||||
| ``` | ||||
|  | ||||
| # Video to Audio | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| ffmpeg -i input.mp4 -vn output.mp3 | ||||
| ``` | ||||
|  | ||||
|  | ||||
| # Convert all mkv files to mp4 | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| for i in *.mkv; do | ||||
| ``` | ||||
|  | ||||
|     > ffmpeg -i "$i" -codec copy "${i%.*}.mp4" | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| done | ||||
| ``` | ||||
|  | ||||
|  | ||||
| # Change resolution | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| ffmpeg -i input.mp4 -filter:v scale=1280:720 -c:a copy output.mp4 | ||||
| ``` | ||||
|  | ||||
| Or just crop: | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| ffmpeg -i input.mp4 -filter:v "crop=w:h:x:y" output.mp4 | ||||
| ``` | ||||
|  | ||||
| Or aspect ratio: | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| ffmpeg -i input.mp4 -aspect 16:9 output.mp4 | ||||
| ``` | ||||
|  | ||||
| Or trim to start and stop times: | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| ffmpeg -i input.mp4 -ss 00:00:50 -codec copy -t 50 output.mp4 | ||||
| ``` | ||||
|  | ||||
| @@ -134,14 +134,14 @@ Indicate start times with -ss and time with -t in seconds. | ||||
|  | ||||
| Or split a video into parts: | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| ffmpeg -i input.mp4 -t 00:00:30 -c copy part1.mp4 -ss 00:00:30 -codec copy part2.mp4 | ||||
| ``` | ||||
|  | ||||
|  | ||||
| # Compress Video | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| ffmpeg -i input.mp4 -vf scale=1280:-1 -c:v libx264 -preset veryslow -crf 24 output.mp4 | ||||
| ``` | ||||
|  | ||||
| @@ -149,19 +149,19 @@ ffmpeg -i input.mp4 -vf scale=1280:-1 -c:v libx264 -preset veryslow -crf 24 outp | ||||
|  | ||||
| -r sets the frame rate, and -f selects the format. | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| ffmpeg -i input.mp4 -r 1 -f image2 image-%2d.png | ||||
| ``` | ||||
|  | ||||
| # Add Images to Audio | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| $ ffmpeg -loop 1 -i inputimage.jpg -i inputaudio.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest output.mp4 | ||||
| ``` | ||||
|  | ||||
| # Add Subtitles | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| fmpeg -i input.mp4 -i subtitle.srt -map 0 -map 1 -c copy -c:v libx264 -crf 23 -preset veryfast output.mp4 | ||||
| ``` | ||||
|  | ||||
|   | ||||
| @@ -5,35 +5,35 @@ tags: [ "vision" ] | ||||
|  | ||||
| Convert jpg to png. | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| magick image.jpg image.png | ||||
| ``` | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| magick image.jpg -quality 50 image.jpg | ||||
| ``` | ||||
|  | ||||
| 'Quality' must be from 1 to 100. | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| magick -resize 50% image.jpg image2.jpg | ||||
| ``` | ||||
|  | ||||
| Resizing only changes jpegs.  Change a png with: | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| magick input.png png8:out.png | ||||
| ``` | ||||
|  | ||||
| # Invert Colours | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| magick input.jpg output.jpg -negate | ||||
| ``` | ||||
|  | ||||
| # Make Images Smaller | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| magick image.jpg -resize 25% output.jpg | ||||
| ``` | ||||
|  | ||||
| @@ -42,13 +42,13 @@ magick image.jpg -resize 25% output.jpg | ||||
|  | ||||
| This is generally used for transparent images. | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| magick -trim image.png output.png | ||||
| ``` | ||||
|  | ||||
| Make the white of an image transparent. | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| magick -transparent white -fuzz 10% input.png output.png | ||||
| ``` | ||||
|  | ||||
| @@ -57,14 +57,14 @@ The 'fuzz' option tells the computer that 'close to white' is fine.  You might w | ||||
|  | ||||
| ## Dropshadow | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| `magick <input file> \( +clone -background black -shadow 50x8+0+5 \) +swap -background none -layers merge +repage <output file>` | ||||
| ``` | ||||
|  | ||||
|  | ||||
| # Convert every jpg in directory to png | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| mogrify -format png *.jpg | ||||
| ``` | ||||
|  | ||||
| @@ -96,20 +96,20 @@ $potrace -s output.ppm -o svgout.svg | ||||
|  | ||||
| See your installed fonts: | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| magick -list font | ||||
| ``` | ||||
|  | ||||
| Make an image showing day of the week: | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| magick -fill blue -font Sauce-Code-Pro-Semibold-Nerd-Font-Complete-Mono -gravity center -pointsize 79 label:$(date +%A) day.png | ||||
| ``` | ||||
|  | ||||
|  | ||||
| Make a meme: | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| magick 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 | ||||
| ``` | ||||
|  | ||||
|   | ||||
| @@ -5,24 +5,24 @@ tags: [ "qrencode", "zbar" ] | ||||
|  | ||||
| Make a QR Code image: | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| qrencode 'https://play.google.com/store/apps/details?id=org.briarproject.briar.android' -o "$FILE".png | ||||
| ``` | ||||
|  | ||||
| Make a QR Coded message in the terminal: | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| qrencode -t ansi "Hello World" | ||||
| ``` | ||||
|  | ||||
| Read a QR Code image: | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| zbarimg $FILE | ||||
| ``` | ||||
|  | ||||
| Show wifi QR code (only with Network Manager): | ||||
|  | ||||
| ```bash | ||||
| ```sh | ||||
| nmcli device wifi show-password | ||||
| ``` | ||||
|   | ||||
		Reference in New Issue
	
	Block a user