Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| computers:ffmpeg [2024/09/14 03:24] – [Joining video files together (Concatenate)] jon | computers:ffmpeg [2025/12/15 16:40] (current) – jon | ||
|---|---|---|---|
| Line 98: | Line 98: | ||
| Example using Powershell: | Example using Powershell: | ||
| < | < | ||
| + | |||
| + | === Caveats to cropping === | ||
| + | |||
| + | When you do cut with -c copy (no re-encode), and the cut point is not exactly on a keyframe, and/or the video uses B-frames (re-ordered frames), ffmpeg can’t rewrite frames to make a clean boundary. It copies packets but the decode/ | ||
| + | |||
| + | Players often still play linearly, but seeking near the splice can fail hard (especially around the crop point). mp4 is particularly sensitive because it stores timing/ | ||
| + | |||
| + | Workaround is to use a copy-cut and regenerate timestamps | ||
| + | |||
| + | < | ||
| + | -map 0 -c copy \ | ||
| + | -fflags +genpts -avoid_negative_ts make_zero \ | ||
| + | croppedvid.mp4</ | ||
| + | |||
| + | Then, "remux normalize" | ||
| + | |||
| + | < | ||
| + | ffmpeg -i croppedvid.mp4 -map 0 -c copy -movflags +faststart fixed1.mp4 | ||
| + | </ | ||
| + | |||
| ==== Joining video files together (Concatenate) ==== | ==== Joining video files together (Concatenate) ==== | ||
| Line 110: | Line 130: | ||
| </ | </ | ||
| - | Here's how I've scripted this. Note, this pertains more to macOS with the sed statement since the '' | + | Here's how I've scripted this. Note, this pertains more to macOS with the sed statement since the single quotes are needed, but the tweak for linux is to just remove the single quotes and the -e |
| < | < | ||
| find . -type f > concat.txt && sed -i '' | find . -type f > concat.txt && sed -i '' | ||
| Line 117: | Line 137: | ||
| Then, reference the text file as your input. | Then, reference the text file as your input. | ||
| < | < | ||
| - | ffmpeg -f concat -i textfile.txt -c copy output.mp4 | + | ffmpeg -f concat |
| </ | </ | ||
| + | |||
| ==== Splitting a large video into smaller clips ==== | ==== Splitting a large video into smaller clips ==== | ||
| https:// | https:// | ||