File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,11 @@ def _calculate_frame_sizes(self) -> list[FrameEntry]:
219219 sys .exit (0 )
220220
221221 info = json .loads (stdout )["packets" ]
222+ # abort if nothing returned
223+ if not info :
224+ raise RuntimeError (
225+ "No frames returned, please check your input file and the ffprobe output. Run with -v to see the ffprobe command."
226+ )
222227
223228 ret : list [FrameEntry ] = []
224229 idx = 1
@@ -230,9 +235,7 @@ def _calculate_frame_sizes(self) -> list[FrameEntry]:
230235 for packet_info in info :
231236 frame_type : Literal ["I" , "Non-I" ] = (
232237 # key frames are marked with a capital K (K_ or K__) in packet flags
233- "I"
234- if "K" in packet_info ["flags" ]
235- else "Non-I"
238+ "I" if "K" in packet_info ["flags" ] else "Non-I"
236239 )
237240
238241 pts : float | Literal ["NaN" ] = (
@@ -265,10 +268,7 @@ def _calculate_frame_sizes(self) -> list[FrameEntry]:
265268 ret = self ._fix_durations (ret )
266269
267270 # fix missing data in first packet (occurs occassionally when reading streams)
268- if (
269- ret [0 ]["duration" ] == "NaN"
270- and isinstance (ret [1 ]["duration" ], float )
271- ):
271+ if ret [0 ]["duration" ] == "NaN" and isinstance (ret [1 ]["duration" ], float ):
272272 ret [0 ]["duration" ] = ret [1 ]["duration" ]
273273
274274 if (
You can’t perform that action at this time.
0 commit comments