Last active
December 11, 2024 00:43
-
-
Save seamonkey420/e3694a9cd4d0aa6362aa19724db3c544 to your computer and use it in GitHub Desktop.
FFMPEG Example Commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :: Dec 2024, Seamonkey420 | |
| :: This is just a note for myself on some common ffmpeg commands i use for scripting. | |
| :: Used in my .cmd/.bat script files on mkv files. | |
| :: change %~1 to a proper variable, otherwise you can add commands to a batch file and then drag files to file to run! | |
| :: add this to top of batch files!!: | |
| :: setlocal EnableExtensions DisableDelayedExpansion | |
| ::----------------------------------------------------- | |
| ::Convert original audio streams to AAC 6 Channel, retains original video and subtitles streams | |
| ffmpeg -i "%~1" -map 0:v -c:v copy -map 0:a -c:a aac -ac 6 -b:a 640k -map 0:s -c:s copy "%~1"new.mkv | |
| ::---------------------------------------- | |
| ::Copies only english audio tracks and subtitles track | |
| ffmpeg -i "%~1" -map 0:v -c:v copy -map 0:a:m:language:eng -c:a aac -ac 6 -b:a 640k -map 0:s:m:language:eng -c:s copy "%~1"new.mkv | |
| ::---------------------------------------- | |
| ::Keeps only English subtitles and copies original video and audio streams (mkv) | |
| ffmpeg -i "%~1" -map 0:v -c:v copy -map 0:a -c:a copy -map 0:s:m:language:eng -c:s copy "%~1"new.mkv | |
| ::---------------------------------------- | |
| ::Add an AC3 audio stream while keeping original video, audio and subtitles | |
| ffmpeg -i "%~1" -map 0:v -c:v copy -map 0:a:0 -c:a:0 copy -map 0:a:0 -c:a:1 ac3 -b:a:1 512k -c copy -map 0:s -c:s copy "%~1"new.mkv | |
| ::---------------------------------------- | |
| :: Remove all subtitles, keep all video and audio streams (mkv) | |
| ffmpeg -i "%~1" -map 0:v -c:v copy -map 0:a -c:a copy -map -0:s -c copy "%~1"new.mkv | |
| ::---------------------------------------- | |
| ::Convert all files in folder to mp4 formats while copying video and audio streams (create batch file, move batch file to folder and run to convert all files in folder to mp4) | |
| for %%a in (%*) do ffmpeg -fflags +genpts -i %%a -c copy -map 0 %%a.mp4 | |
| ::---------------------------------------- | |
| :: Remove colorspace viau MKVToolNIX to set color space to 0 | |
| :: Fixes oversaturated movies in plex that use h265 codes | |
| "C:\Program Files\MKVToolNix\mkvpropedit.exe" "%~1" --edit track:v1 --set colour-transfer-characteristics=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment