Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| computers:ffmpeg [2021/01/15 19:20] – [Muting specific spots in your video (or other audio manipulation] localadmin | computers:ffmpeg [2025/12/15 16:40] (current) – jon | ||
|---|---|---|---|
| Line 12: | Line 12: | ||
| https:// | https:// | ||
| + | |||
| + | ==== Mini DV Tapes ==== | ||
| + | |||
| + | * Use WinDV for ingestion. It will break out each stop/start on the tape into new files. | ||
| + | * Touch up for YT spec with all inclusive script, if audio is off, switch to mono. | ||
| ==== DVDs ==== | ==== DVDs ==== | ||
| Line 27: | Line 32: | ||
| === Template for YouTube Specs === | === Template for YouTube Specs === | ||
| https:// | https:// | ||
| + | https:// | ||
| < | < | ||
| ==== Scripting ==== | ==== Scripting ==== | ||
| + | |||
| + | === Bash Scripting === | ||
| + | When building out bash scripting, you will need to run your ffmpeg commands with -nostdin if you are piping in variables with paths((https:// | ||
| + | |||
| + | <note tip> | ||
| + | -stdin | ||
| + | |||
| + | Enable interaction on standard input. On by default unless standard input is used as an input. To explicitly disable interaction you need to specify -nostdin. | ||
| + | Disabling interaction on standard input is useful, for example, if ffmpeg is in the background process group. Roughly the same result can be achieved with ffmpeg ... < /dev/null but it requires a shell.</ | ||
| === Batch Filing === | === Batch Filing === | ||
| Line 58: | Line 73: | ||
| === Powershell Coding === | === Powershell Coding === | ||
| + | |||
| + | ==== Frequent Commands ==== | ||
| + | |||
| + | https:// | ||
| + | |||
| + | ==== Listing out features ==== | ||
| + | |||
| + | https:// | ||
| ==== Watermarking ==== | ==== Watermarking ==== | ||
| Line 75: | 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 80: | Line 123: | ||
| https:// | https:// | ||
| https:// | https:// | ||
| + | |||
| + | Make a text file in the same directory. Each video needs the word ' | ||
| + | < | ||
| + | file videofile.mp4 | ||
| + | file videfile2.mp4 | ||
| + | </ | ||
| + | |||
| + | 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 '' | ||
| + | </ | ||
| + | |||
| + | Then, reference the text file as your input. | ||
| + | < | ||
| + | ffmpeg -f concat -safe 0 -i concat.txt -c copy output.mp4 | ||
| + | </ | ||
| ==== Splitting a large video into smaller clips ==== | ==== Splitting a large video into smaller clips ==== | ||
| + | https:// | ||
| Example in Batch: | Example in Batch: | ||
| Line 103: | Line 163: | ||
| ffmpeg -i ' | ffmpeg -i ' | ||
| - | ==== Muting specific spots in your video (or other audio manipulation | + | ==== Muting specific spots in your video ==== |
| - | Example from the link: | + | Example from the link. This mutes audio at the 59 second mark down to 0 and then back up at 1:01 |
| - | < | + | < |
| https:// | https:// | ||
| When entering your time, it must be in seconds only. If you have a very long video, be sure to calculate out the exact seconds and enter that in. Example, four hours is 14400 seconds. | When entering your time, it must be in seconds only. If you have a very long video, be sure to calculate out the exact seconds and enter that in. Example, four hours is 14400 seconds. | ||
| + | |||
| + | ==== Fading out audio in a specific spot ==== | ||
| + | |||
| + | https:// | ||
| + | |||
| + | Use afade for audio, fade for video | ||
| + | * t=in -> in point | ||
| + | * t=out -> out point | ||
| + | * st=xx -> start at xx (seconds into video) | ||
| + | * d=x -> duration of fade (in seconds) | ||
| + | |||
| + | Below is an example of fading in audio at the 59 second mark, in 1 second, and fading out at 61 seconds for a second. Video remains un-encoded. | ||
| + | < | ||
| + | ffmpeg -i video.mp4 -vcodec copy -af " | ||
| + | </ | ||
| + | ==== Adjusting audio to broadcast spec ==== | ||
| + | |||
| + | https:// | ||
| ==== Converting from one file type to another ==== | ==== Converting from one file type to another ==== | ||
| Line 116: | Line 194: | ||
| Trying to adjust MKV files. Safe bet, do all adjustments to MP4 file first, then MKV when permanent. - https:// | Trying to adjust MKV files. Safe bet, do all adjustments to MP4 file first, then MKV when permanent. - https:// | ||
| + | |||
| + | ==== Limiting Cores/ | ||
| + | |||
| + | https:// | ||
| + | |||
| + | |||
| + | ==== Hardware Acceleration ==== | ||
| + | |||
| + | https:// | ||
| + | https:// | ||
| + | |||
| + | Each OS has its own Platform APIs of hardware acceleration and additionally, | ||
| + | |||
| + | Nvidia on Windows/ | ||
| + | Intel on Windows/ | ||
| + | |||
| + | macOS supports VideoToolBox for Intel QuickSync, such as h264_videotoolbox, | ||
| + | |||
| + | ==== Unorganized Links ==== | ||
| + | |||
| + | https:// | ||
| + | https:// | ||