ffmpeg
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ffmpeg [2021/05/22 16:54] – [Converting] flac > mp3 rjt | ffmpeg [2025/04/14 16:40] (current) – more info on 'copy' ... mb don't need to bang on so much ... 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. '' | + | For converting a directory of .FLAC files to .MP3. '' |
+ | |||
+ | < | ||
- | < | ||
==== Editing ==== | ==== Editing ==== | ||
=== Concatenation === | === Concatenation === | ||
Line 38: | 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 49: | Line 95: | ||
=== 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 61: | Line 107: | ||
* 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 75: | Line 137: | ||
* 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.1621666440.txt.gz · Last modified: 2021/05/22 16:54 by rjt