ffmpeg
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| ffmpeg [2020/10/30 05:10] – [See Also] tags rjt | ffmpeg [2025/07/22 01:10] (current) – [Editing] Rotation rjt | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== FFmpeg ====== | ====== FFmpeg ====== | ||
| + | |||
| + | Super handy [[terminal_emulator|terminal]]-based tool for working with video. | ||
| ===== Use ===== | ===== Use ===== | ||
| Line 7: | Line 9: | ||
| Most of the time I just use--- | Most of the time I just use--- | ||
| - | < | + | < |
| ---and it usually works fine leaving it to just use defaults. | ---and it usually works fine leaving it to just use defaults. | ||
| + | |||
| + | This gives good results (and a smaller file size) converting MP3 to OGG though: | ||
| + | |||
| + | < | ||
| + | |||
| + | Fuck-off those .WEBMs. '' | ||
| + | |||
| + | < | ||
| + | |||
| + | A more compact way is to use '' | ||
| + | |||
| + | < | ||
| + | |||
| + | So if you wanted to copy the video stream and just reencode/ | ||
| + | |||
| + | < | ||
| === Multiple === | === Multiple === | ||
| Line 15: | Line 33: | ||
| For doing a whole directory I use this one-liner I got from Stack Exchange. | For doing a whole directory I use this one-liner I got from Stack Exchange. | ||
| - | < | + | < |
| + | |||
| + | For converting files for my [[m-u-s-u-c]] blog I also strip out the cover images: '' | ||
| + | |||
| + | < | ||
| - | You can use the wildcard '' | + | You can use the wildcard '' |
| < | < | ||
| Line 23: | Line 45: | ||
| If you want to put the new videos into a subdirectory, | If you want to put the new videos into a subdirectory, | ||
| - | < | + | < |
| + | |||
| + | For converting a directory of .FLAC files to .MP3. '' | ||
| + | |||
| + | < | ||
| ==== Editing ==== | ==== Editing ==== | ||
| Line 35: | Line 61: | ||
| < | < | ||
| - | nbjp Todo: use bash to generate | + | [[https:// |
| + | |||
| + | < | ||
| + | # with a bash for loop | ||
| + | for f in *.wav; do echo "file ' | ||
| + | # or with printf | ||
| + | printf "file ' | ||
| + | </ | ||
| + | |||
| + | If you have a movie in two parts and want to stick them together with less fuss, or you just want to save yourself the trouble of making | ||
| + | |||
| + | < | ||
| + | |||
| + | |||
| + | NB: Some older codecs let you stick files together with just [[cat]]!: https:// | ||
| + | |||
| + | === Cropping === | ||
| + | To crop a 16:9 video to 4:3, add: | ||
| + | |||
| + | < | ||
| + | |||
| + | Full example, with copied audio stream: | ||
| + | |||
| + | < | ||
| === Remove Audio === | === Remove Audio === | ||
| Line 41: | Line 90: | ||
| === Rotation === | === Rotation === | ||
| - | Rotate 90°. | + | Rotate 90°. This will reencode the video. |
| < | < | ||
| + | |||
| + | To rotate -90° is '' | ||
| + | |||
| + | (The easiest, tidiest way to rotate a phone video is to just edit the metadata with [[exiftool]]) | ||
| === Trimming === | === Trimming === | ||
| - | You can pretty easily make a video file smaller. The only caveat is that if you don't want to re-encode you're limited by where keyframes are placed. | + | You can pretty easily make a video shorter. The only caveat is that if you don't want to re-encode you're limited by where keyframes are placed. |
| < | < | ||
| Line 58: | Line 111: | ||
| * If you leave out the '' | * If you leave out the '' | ||
| + | ==== Images ==== | ||
| + | === Extract each frame as an image === | ||
| + | < | ||
| + | |||
| + | === Create video from images === | ||
| + | < | ||
| + | |||
| + | == GIF == | ||
| + | Default loops. Add '' | ||
| + | |||
| + | < | ||
| + | |||
| + | == APNG == | ||
| + | Default doesn' | ||
| + | |||
| + | < | ||
| ==== Lowering the file size ==== | ==== Lowering the file size ==== | ||
| Slow, but compresses better: | Slow, but compresses better: | ||
| Line 72: | Line 141: | ||
| * https:// | * https:// | ||
| + | |||
| + | ==== Repairing ==== | ||
| + | |||
| + | Just had an .AVI file throwing error messages about a busted index. Copying the file seemed to fix it. | ||
| + | < | ||
| + | |||
| + | ===== Frontends ===== | ||
| + | |||
| + | * [[https:// | ||
| ===== See Also ===== | ===== See Also ===== | ||
| * [[https:// | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[gifsicle]] - Similar tool, specifically for working with [[gif|GIFs]] | ||
| {{tag> | {{tag> | ||
ffmpeg.1603995046.txt.gz · Last modified: 2020/10/30 05:10 by rjt
