Print input frame rate, and default to every_n_video_frames=2 which

gives better quality without compromising frame rate too much.
This commit is contained in:
kris 2019-03-21 23:25:51 +00:00
parent eebbccf711
commit f37d07914d
2 changed files with 5 additions and 3 deletions

View File

@ -19,7 +19,7 @@ parser.add_argument(
help='Override auto-detected multiplier for audio normalization.' help='Override auto-detected multiplier for audio normalization.'
) )
parser.add_argument( parser.add_argument(
'--every_n_video_frames', type=int, default=1, '--every_n_video_frames', type=int, default=2,
help='Allows skipping frames of input video to lower effective output ' help='Allows skipping frames of input video to lower effective output '
'frame rate, which may give better quality for some videos.' 'frame rate, which may give better quality for some videos.'
) )
@ -31,6 +31,8 @@ def main(args):
every_n_video_frames=args.every_n_video_frames, every_n_video_frames=args.every_n_video_frames,
audio_normalization=args.audio_normalization) audio_normalization=args.audio_normalization)
print("Input frame rate = %f" % m.video.input_frame_rate)
max_bytes_out = 1024. * 1024 * args.max_output_mb max_bytes_out = 1024. * 1024 * args.max_output_mb
if args.output: if args.output:

View File

@ -35,11 +35,11 @@ class Video:
# TODO: possible to compute time offset for each frame instead? # TODO: possible to compute time offset for each frame instead?
data = skvideo.io.ffprobe(self.filename)['video'] data = skvideo.io.ffprobe(self.filename)['video']
rate_data = data['@r_frame_rate'].split("/") # e.g. 12000/1001 rate_data = data['@r_frame_rate'].split("/") # e.g. 12000/1001
self._input_frame_rate = float( self.input_frame_rate = float(
rate_data[0]) / float(rate_data[1]) # type: float rate_data[0]) / float(rate_data[1]) # type: float
self.cycles_per_frame = ( self.cycles_per_frame = (
self.CLOCK_SPEED / self._input_frame_rate) # type: float self.CLOCK_SPEED / self.input_frame_rate) # type: float
self.frame_number = 0 # type: int self.frame_number = 0 # type: int
# Initialize empty screen # Initialize empty screen