add --fps

This commit is contained in:
Martinez 2016-08-08 00:21:28 +02:00
parent aa564e5eee
commit 7326f5be69
2 changed files with 6 additions and 3 deletions

View file

@ -23,7 +23,7 @@ X264_BANNED_PIXFMTS = {"bgr24", "yuv422p"}
command = over.types.ndict()
command.identify = Command("ffprobe", "-v", "quiet", "-print_format", "json", "-show_format", "-show_streams", "INFILE")
command.normalize_prepass = Command("ffmpeg", "-i", "INFILE", "-filter:a", "volumedetect", "-f", "null", "/dev/null")
command.encode_generic = Command("ffmpeg", "CUT_FROM", "-i", "INFILE", "CUT_TO", "MAP", "VIDEO", "AUDIO", "-sn", "OUTFILE")
command.encode_generic = Command("ffmpeg", "FPS", "CUT_FROM", "-i", "INFILE", "CUT_TO", "MAP", "VIDEO", "AUDIO", "-sn", "OUTFILE")
command.sub_vorbis = Command("-codec:a", "libvorbis", "-qscale:a", "QUALITY", "NORMALIZE")
command.sub_pcm = Command("-codec:a", "pcm_s16le", "NORMALIZE")
command.sub_theora = Command("-codec:v", "libtheora", "-qscale:v", "QUALITY", "VFILTER")
@ -51,6 +51,7 @@ if __name__ == "__main__":
main.add_option("ffmpeg-vfilter", 'Raw ffmpeg -filter:v options, e.g. "<M>scale=1280:trunc(ow/a/2)*2,transpose=dir=1<.>"', str, [""], abbr="F", count=1)
main.add_option("ffmpeg-map", "Raw ffmpeg <c>-map<.> options, e.g. <W>--<g>map<.> <M>0:1<.> <W>--<g>map<.> <M>0:2<.>. This is a drop-in fix until we get proper stream selection.", str, abbr="M", overwrite=False, count=1)
main.add_option("cut", "Start and end timestamps of the portion to cut out. Uses native ffmpeg <c>-ss<.> and <c>-to<.> format, so it's either seconds from start or <M>[<HH>:]<MM>:<SS>[.<<m>...]<.>. Example: <W>--<g>cut<.> <M>25 35<.> uses 10 seconds of video starting at 25s, <W>--<g>cut<.> <M>1:10:45 1:23:54.5<.> uses video from 4245s to 5034.5s.", over.callback.strings, abbr="X", count=2)
main.add_option("fps", "Override input framerate.", float, abbr="f", count=1)
main.add_option("move-source", "Move source file to this directory after conversion. Use an empty string to disable.", str, ["processed"], count=1)
main.add_option("dump-commands", "Print ffmpeg commands that would be executed. If <W>--<g>normalize<.> is in effect, the normalization pre-pass will still be performed so that the proper volume correction can be computed.", bool, [False], abbr="D", in_cfg_file=False)
main.add_option("probe", "Print the raw JSON output of ffprobe and exit.", bool, [False], abbr="p", in_cfg_file=False)
@ -293,6 +294,8 @@ if __name__ == "__main__":
encode_cmd.INFILE = "file:" + str(files.infile)
encode_cmd.OUTFILE = files.tmpfile
encode_cmd.FPS = ["-r", main.cfg.fps] if main.cfg.fps else None
encode_cmd.CUT_FROM = ["-ss", main.cfg.cut[0]] if main.cfg.cut else None
encode_cmd.CUT_TO = ["-to", main.cfg.cut[1]] if main.cfg.cut else None