Skip to content

Instantly share code, notes, and snippets.

@hieuns
Last active January 31, 2020 14:46
Show Gist options
  • Save hieuns/19783de9d1b098b24c7457fe01340391 to your computer and use it in GitHub Desktop.
Save hieuns/19783de9d1b098b24c7457fe01340391 to your computer and use it in GitHub Desktop.
ffmpeg commands collection
$ cat files.txt
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
$ ffmpeg -f concat -safe 0 -i files.txt -c copy output.mp4
ffmpeg -i input.mp4 -ss 00:01:06.65 -to 00:01:08:10 -c:v copy -c:a copy -c:s copy out.mp4
# Edit file resolution and quality
# -crf value from 0 to 51, the higher the value, the lower quantity of output file (recommended value: 23)
ffmpeg -i MyMovie.mkv -vf scale=-1:720 -c:v libx264 -crf 0 -preset veryslow -c:a copy MyMovie_720p.mkv
# or
ffmpeg -i input.mkv -map 0:1 [-map 0:x] -c:v libx264 -crf 23 -preset veryslow -c:a copy -c:s copy output.mkv
# or using x265 encoder with main10 profile (crf 28, default value)
ffmpeg -i input.mkv -map 0:1 [-map 0:x] -c:v libx265 -preset veryslow -c:a copy -c:s copy -pix_fmt yuv420p10le output.mkv
# Convert soft sub to hard sub
# Source: https://superuser.com/questions/1024850/how-can-i-convert-a-mkv-to-mp4-using-ffmpeg-and-hardsub-the-subtitles
ffmpeg -i old_video.mkv -vf subtitles=old_video.mkv -acodec copy new_video.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment