File tree Expand file tree Collapse file tree 3 files changed +20
-10
lines changed Expand file tree Collapse file tree 3 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -178,7 +178,6 @@ def read_v1(tl: Any, log: Log) -> v3:
178
178
if type (chunks ) is not list :
179
179
log .error ("chunks key must be an array" )
180
180
181
- do_bonk_chunk = False
182
181
for i , chunk in enumerate (chunks ):
183
182
if type (chunk ) is not list or len (chunk ) != 3 :
184
183
log .error (f"Invalid chunk at chunk { i } " )
Original file line number Diff line number Diff line change @@ -110,6 +110,17 @@ def run_interpreter_for_edit_option(
110
110
return result
111
111
112
112
113
+ def make_sane_timebase (fps : Fraction ) -> Fraction :
114
+ tb = round (fps , 2 )
115
+ ntsc = Fraction (30_000 , 1001 )
116
+ film_ntsc = Fraction (24_000 , 1001 )
117
+ if tb == round (ntsc , 2 ):
118
+ return ntsc
119
+ if tb == round (film_ntsc , 2 ):
120
+ return film_ntsc
121
+ return tb
122
+
123
+
113
124
def make_timeline (
114
125
sources : list [FileInfo ],
115
126
ffmpeg : FFmpeg ,
@@ -125,16 +136,10 @@ def make_timeline(
125
136
if inp is None :
126
137
tb , res = Fraction (30 ), (1920 , 1080 )
127
138
else :
128
- tb = round (inp .get_fps () if args .frame_rate is None else args .frame_rate , 2 )
129
- ntsc = Fraction (30_000 , 1001 )
130
- film_ntsc = Fraction (24_000 , 1001 )
131
- if tb == round (ntsc , 2 ):
132
- tb = ntsc
133
- elif tb == round (film_ntsc , 2 ):
134
- tb = film_ntsc
135
-
139
+ tb = make_sane_timebase (
140
+ inp .get_fps () if args .frame_rate is None else args .frame_rate
141
+ )
136
142
res = inp .get_res () if args .resolution is None else args .resolution
137
-
138
143
try :
139
144
start_margin = time (args .margin [0 ], tb )
140
145
end_margin = time (args .margin [1 ], tb )
Original file line number Diff line number Diff line change 11
11
from auto_editor .utils .func import aspect_ratio
12
12
from auto_editor .utils .log import Log
13
13
from auto_editor .vanparse import ArgumentParser
14
+ from auto_editor .make_layers import make_sane_timebase
14
15
15
16
16
17
@dataclass (slots = True )
@@ -108,6 +109,7 @@ def main(sys_args: list[str] = sys.argv[1:]) -> None:
108
109
109
110
file_info [file ] = {
110
111
"type" : "media" ,
112
+ "recommendedTimebase" : "30/1" ,
111
113
"video" : [],
112
114
"audio" : [],
113
115
"subtitle" : [],
@@ -117,6 +119,10 @@ def main(sys_args: list[str] = sys.argv[1:]) -> None:
117
119
},
118
120
}
119
121
122
+ if src .videos :
123
+ recTb = make_sane_timebase (src .videos [0 ].fps )
124
+ file_info [file ]["recommendedTimebase" ] = f"{ recTb .numerator } /{ recTb .denominator } "
125
+
120
126
for track , v in enumerate (src .videos ):
121
127
w , h = v .width , v .height
122
128
You can’t perform that action at this time.
0 commit comments