FFmpeg Cheat Sheet ================== ## Re-encode a movie Re-encode video while preserving audio, subtitles, chapters, etc. ### Regular movie ```sh ffmpeg -i input.mkv -map 0 -c:a copy -c:s copy -c:v libx264 -preset slow -tune film output.mkv ``` ### Animation movie ```sh ffmpeg -i input.mkv -map 0 -c:a copy -c:s copy -c:v libx264 -preset slow -tune animation output.mkv ``` ### Others `-tune` options - `grain`: preserves the grain structure in old, grainy film material - `stillimage`: good for slideshow-like content - `fastdecode`: allows faster decoding by disabling certain filters - `zerolatency`: good for fast encoding and low-latency streaming Read [Encode/H.264](https://trac.ffmpeg.org/wiki/Encode/H.264) for more details. ## Copy all tracks ```sh ffmpeg -i input.mkv -map 0 -c copy output.mkv ``` ### Without audio ```sh ffmpeg -i input.mkv -map 0 -c copy -an output-no-audio.mkv ``` ### Without video ```sh ffmpeg -i input.mkv -map 0 -c copy -vn output-no-video.mkv ```