Skip to content

Instantly share code, notes, and snippets.

@suntong
Created August 2, 2015 13:54
Show Gist options
  • Save suntong/841d82361405e924ed55 to your computer and use it in GitHub Desktop.
Save suntong/841d82361405e924ed55 to your computer and use it in GitHub Desktop.
$ ffcvt
Usage:
ffcvt [flags]
Flags:
-aes audio encoding method set (FFCVT_AES)
-ves video encoding method set (FFCVT_VES)
-aea audio encoding method append (FFCVT_AEA)
-vea video encoding method append (FFCVT_VEA)
-abr audio bitrate (64k for opus, 256k for mp3) (FFCVT_ABR)
-crf the CRF value: 0-51. Higher CRF gives lower quality
(28 for x265, ~ 23 for x264) (FFCVT_CRF)
-t target type: x265-opus/x264-mp3 (FFCVT_T)
-d directory that hold input files (FFCVT_D)
-f input file name (either -d or -f must be specified) (FFCVT_F)
-suf suffix to the output file names (FFCVT_SUF)
-ac copy audio codec (FFCVT_AC)
-vc copy video codec (FFCVT_VC)
-an no audio, output video only (FFCVT_AN)
-vn no video, output audio only (FFCVT_VN)
-vss video: same size (FFCVT_VSS)
-o more options that will pass to ffmpeg program (FFCVT_O)
-ato-opus audio encode to opus, using -abr (FFCVT_ATO_OPUS)
-vto-x265 video video encode to x265, using -crf (FFCVT_VTO_X265)
-force overwrite any existing none-empty file (FFCVT_FORCE)
-debug debugging level (FFCVT_DEBUG)
-ffmpeg ffmpeg program executable name (FFCVT_FFMPEG)
Details:
-abr="": audio bitrate (64k for opus, 256k for mp3)
-ac=false: copy audio codec
-aea="": audio encoding method append
-aes="": audio encoding method set
-an=false: no audio, output video only
-ato-opus=false: audio encode to opus, using -abr
-crf="": the CRF value: 0-51. Higher CRF gives lower quality
(28 for x265, ~ 23 for x264)
-d="": directory that hold input files
-debug=0: debugging level
-f="": input file name (either -d or -f must be specified)
-ffmpeg="ffmpeg": ffmpeg program executable name
-force=false: overwrite any existing none-empty file
-o="": more options that will pass to ffmpeg program
-suf="": suffix to the output file names
-t="x265-opus": target type: x265-opus/x264-mp3
-vc=false: copy video codec
-vea="": video encoding method append
-ves="": video encoding method set
-vn=false: no video, output audio only
-vss=true: video: same size
-vto-x265=false: video video encode to x265, using -crf
The `ffcvt -f testf.mp4 -debug 1 -force` will invoke
ffmpeg -i testf.mp4 -c:a libopus -b:a 64k -c:v libx265 -x265-params crf=28 -y testf_.mkv
To use `preset`, do the following or set it in env var FFCVT_O
cm=medium
ffcvt -f testf.mp4 -debug 1 -force -suf $cm -- -preset $cm
Which will invoke
ffmpeg -i testf.mp4 -c:a libopus -b:a 64k -c:v libx265 -x265-params crf=28 -y -preset medium testf_medium_.mkv
Here are the final sizes and the conversion time (in seconds):
2916841 testf.mp4
1807513 testf_.mkv
1743701 testf_veryfast_.mkv 41
2111667 testf_faster_.mkv 44
1793216 testf_fast_.mkv 85
1807513 testf_medium_.mkv 120
1628502 testf_slow_.mkv 366
1521889 testf_slower_.mkv 964
1531154 testf_veryslow_.mkv 1413
I.e., if `preset` is not used, the default is `medium`.
Here is another set of results, sizes and the conversion time (in minutes):
171019470 testf.avi
55114663 testf_veryfast_.mkv 39.2
57287586 testf_faster_.mkv 51.07
52950504 testf_fast_.mkv 147.11
55641838 testf_medium_.mkv 174.25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment