Useful ffmpeg commands

Trim/Cut/Splitt Video

ffmpeg -i input.mp4 -c copy -ss 00:05:00 -to 00:10:00 output.mp4
-c copy Copy all streams
-ss Start time offset
-to Transcode stop time

(re)encode Video with h.254 and AAC

ffmpeg -i input.mp4 -vcodec h264 -acodec aac output.mp4
-vcodec h264 Encodes video to h264
-acodec aac Encodes audio to aac

Resize Video to 1280×720 with high quality settings

ffmpeg -i input.mp4 -vf scale=1280:720 -preset slow -crf 18 output.mp4
-vf scale=1280:720 Set video filter to resize to 1280×720
-crf 18 Constant Rate Factor. A lower value means higher quality

Convert only Audio. EAC3 to AC3 for Example

ffmpeg -i "input.mkv" -map 0 -c:s copy -c:v copy -c:a ac3 output.mkv
-map 0 Selects all streams. Otherwise only one stream per stream type will be selected.
-c:s copy Copy all subtitles.
-c:v copy Copy all video.
-c:a ac3 Encodes all audio to AC-3.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.