Skip to main content
  1. Notes/

ffmpeg

# Cuts video from 1:00 -> 2:00
# ffmpeg -ss 00:01:00.000 -t 00:00:10.000 -i INFILE.mp4 -vcodec copy -acodec copy OUTFILE.mp4
ffmpeg -ss 01:00 -to 02:00 -i INFILE.mp4 -vcodec copy -acodec copy OUTFILE.mp4

HowTo: Cut a video directly with ffmpeg, without re-encoding – vollnixx


# Insert subtitles into mp4
ffmpeg -i infile.mp4 -i infile.srt -c copy -c:s mov_text outfile.mp4

https://stackoverflow.com/a/17584272


# Quickly extract a single frame from a video at time mm:ss and save it as a 128x128 resolution image:
ffmpeg -ss mm:ss -i video.mp4 -frames 1 -s 128x128 -f image2 image.png

# Trim a video from a given start time mm:ss to an end time mm2:ss2 (omit the -to flag to trim till the end):
ffmpeg -ss mm:ss -to mm2:ss2 -i video.mp4 -codec copy output.mp4

# Remux MKV video to MP4 without re-encoding audio or video streams:
ffmpeg -i input_video.mkv -codec copy output_video.mp4

https://gist.github.com/44213/15268195992e85c976e42d36781c75a0