Skip to content
/ vfr Public

Auto Chapter & QPFile creator and Audio cutter for VFR video

License

Notifications You must be signed in to change notification settings

wiiaboo/vfr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vfr.py
======

Inspired on: Daiz's AutoMKVChapters, TheFluff's split_aud, BD_Chapters

Needs: Python 3; MkvToolNix (for audio trimming)

What it does
------------

* Reads the first line of uncommented Trims from an .avs;
* Uses timecodes files to get each trim's frame's timestamp;
* Offsets the trims accordingly;
* Creates a basic xml with Matroska chapters, x264 chapters if ending in 'x264.txt' or OGM chapters if any other extension is used;
* Creates a qpfile to use with x264;
* Cuts and merges audio (as per split_aud, only using v2 timecodes instead of expecting cfr) (all options work as split_aud);
* No longer needs tcConv but converts v1 timecodes to v2 internally;
* If requested, can output v2 timecodes from v1 and fps parsing. If --ofps is being used, v2 timecodes will use it;
* Can output a qpfile with converted frames meant to be used for an ivtc'd encode using non-ivtc'd frames (feature inspired by automkvchapters) (not completely accurate, obviously);
* Using FFmpegsource's CorrectNTSCRationalFramerate, this is actually more precise in the v2 timecodes it produces than tcConv;
* Accepts AutoMKVChapters-like templates.

Only the .avs with trims is required for vfr.py to run. You can use -v and/or --test to debug the script. All other options and arguments are optional.

Usage
-----

vfr.py -i audio.aac -o audio.cut.mka -f 30/1.001 -l tRim -c chapters.xml -t template.txt \
-n chnames.txt -q qpfile.qpf -vmr --ofps 24/1.001 --timecodes v2.txt --test trims.avs outtrims.avs

Required:
trims.avs = Gets first uncommented line starting with trims from this Avisynth script

Optional:
-i = Audio to be cut (takes whatever mkvmerge takes)
-o = Cut audio inside .mka
     Default: input.cut.mka
-d = Manually set delay time for input audio (can be negative)
-b = Reverse parsing of .avs (from bottom to top)
-f = Frames per second or timecodes file if vfr input
     (takes "25", "24000/1001", "30000:1001", "24/1.001" and "30:1.001" as cfr input)
     Default: 30000/1001
-l = Look for a line starting with a case-sensitive trim() or case-insensitive comment succeeding the trims, interpreted as a regular expression.
     Default: case insensitive trim
-g = Specify directly the line used
-c = Chapters file. If extension is 'xml', outputs MKV Chapters;
     if extension is 'x264.txt', outputs x264 Chapters; else, outputs OGM Chapters
-n = Text file with chapter names, one per line; assumed to be UTF-8 without BOM
-q = QPFile for use in x264; will use --ofps frames
-t = Template file for advanced Matroska chapters
-v = Verbose mode
-m = Merge split audio files
-r = Remove split audio files after merging
--clip = Only pick trims that are using this clip name. Ex: ClipX.Trim(0,1) or Trim(ClipX,0,1)
--uid = Set base UID for --template/--chnames
--chnames = Path to basic text containing chapter titles separated by newlines
--ofps = Output FPS (used in qpfile, v2 timecodes and avs export)
         Default: -f
--timecodes = Output v2 timecodes (from fps and v1 parsing) (if using --ofps, outputs v2 timecodes using this)
--sbr = Set this if inputting an .aac and it's SBR/HE-AAC
--test = Test Mode (doesn't create new files)
outtrims.avs = If chapparse.py is present, outputs .avs with offset and converted trims

To do:
* Optimize code and/or improve its legibility

Known issues:
* Conversion from a different input fps to output fps is not accurate (probably no way it can ever be fixed)

About

Auto Chapter & QPFile creator and Audio cutter for VFR video

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages