#NEWLINE# def render_video( self ) : #NEWLINE# #INDENT# src_fname = os . path . splitext ( os . path . basename ( self . src ) ) [ 0 ] #NEWLINE# tempfile1 = os . path . join ( settings [ 'tempdir' ] , '~{}.{}' . format ( src_fname , settings [ 'v_container' ] ) . lower ( ) ) #NEWLINE# self . fr_source = OpenCvFrameSource ( self . src ) #NEWLINE# self . fr_source . open ( ) #NEWLINE# self . mk_render_pipe ( tempfile1 ) #NEWLINE# self . subs_to_render = 0 #NEWLINE# for sub in self . sequence . subregions : #NEWLINE# #INDENT# if ( self . trim_regions and sub . skip ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . subs_to_render += 1 #NEWLINE# #UNINDENT# #UNINDENT# if self . show_preview : #NEWLINE# #INDENT# cv2 . namedWindow ( self . preview_win_title , cv2 . WINDOW_OPENGL ) #NEWLINE# cv2 . resizeWindow ( self . preview_win_title , self . w , self . h ) #NEWLINE# #UNINDENT# for ( i , sub ) in enumerate ( self . sequence . subregions ) : #NEWLINE# #INDENT# if ( self . trim_regions and sub . skip ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . curr_sub_idx += 1 #NEWLINE# log . info ( 'Rendering: Sub {0:02d}...' . format ( i ) ) #NEWLINE# self . render_subregion ( sub ) #NEWLINE# #UNINDENT# #UNINDENT# if self . show_preview : #NEWLINE# #INDENT# cv2 . destroyAllWindows ( ) #NEWLINE# #UNINDENT# self . fr_source . close ( ) #NEWLINE# self . close_render_pipe ( ) #NEWLINE# if self . mux : #NEWLINE# #INDENT# self . mux_original_audio_with_rendered_video ( tempfile1 ) #NEWLINE# return #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# shutil . move ( tempfile1 , self . dst )