add --cut
This commit is contained in:
parent
da1f6972fb
commit
aa564e5eee
2 changed files with 8 additions and 4 deletions
|
@ -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", "-i", "INFILE", "MAP", "VIDEO", "AUDIO", "-sn", "OUTFILE")
|
||||
command.encode_generic = Command("ffmpeg", "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")
|
||||
|
@ -50,6 +50,7 @@ if __name__ == "__main__":
|
|||
main.add_option("normalize-override", "Volume correction to use instead of computing the required value in a (lengthy) pre-pass.", float, [0.0], abbr="N", count=1, in_cfg_file=False)
|
||||
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("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)
|
||||
|
@ -292,6 +293,9 @@ if __name__ == "__main__":
|
|||
encode_cmd.INFILE = "file:" + str(files.infile)
|
||||
encode_cmd.OUTFILE = files.tmpfile
|
||||
|
||||
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
|
||||
|
||||
if main.cfg.audio == "copy":
|
||||
encode_cmd.AUDIO = command.sub_copy_audio
|
||||
elif main.cfg.audio == "drop":
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# encoding: utf-8
|
||||
|
||||
major = 1 # VERSION_MAJOR_IDENTIFIER
|
||||
minor = 99 # VERSION_MINOR_IDENTIFIER
|
||||
# VERSION_LAST_MM 1.99
|
||||
patch = 2 # VERSION_PATCH_IDENTIFIER
|
||||
minor = 100 # VERSION_MINOR_IDENTIFIER
|
||||
# VERSION_LAST_MM 1.100
|
||||
patch = 0 # VERSION_PATCH_IDENTIFIER
|
||||
str = ".".join(str(v) for v in (major, minor, patch))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue