@@ -36,7 +36,7 @@ def __init__(self, file, args):
3636 metadata = json .loads (metadata )["streams" ][0 ]
3737
3838 # Populate metadata-based attributes
39- self .path = {"source" : file }
39+ self .path = {"source" : os . path . relpath ( file ) }
4040 self .source = {"height" : int (metadata ["height" ]), "width" : int (metadata ["width" ]), "duration" : float (metadata ["duration" ]), "filename" : os .path .splitext (os .path .relpath (self .path ["source" ], "source" ))[0 ], "filesize" : os .path .getsize (self .path ["source" ]), "bitrate" : int (metadata ["bit_rate" ]), "frames" : int (metadata ["nb_frames" ]), "codec" : metadata ["codec_name" ]}
4141 height = self .source ["height" ]
4242 if height < 720 :
@@ -60,14 +60,14 @@ def __init__(self, file, args):
6060 self .map_options ()
6161
6262 self .output ["filename" ] = self .source ["filename" ] + self .output ["file_decorator" ]
63- self .path ["output" ] = "hevc/" + self .output ["filename" ] + ".mp4"
64- self .path ["log" ] = "performance/" + self .output ["filename" ] + ".log"
63+ self .path ["output" ] = os . path . join ( "hevc" , self .output ["filename" ] + ".mp4" )
64+ self .path ["log" ] = os . path . join ( "performance" , self .output ["filename" ] + ".log" )
6565
6666 # Verify no attributes are None
6767 self .validate ()
6868
6969 # Build HandBrakeCLI command
70- self .command = "HandBrakeCLI --encoder-preset {encoder_preset} --preset-import-file {json_path} --preset {preset_name} --quality {quality} --encopts {encopts} --input {source_path} --output {output_path}" .format (encoder_preset = self .encoder_preset , json_path = os .path .join (sys .path [0 ], "src/ presets.json" ), preset_name = self .preset_name , quality = str (self .encoder_quality ), encopts = self .encoder_options , source_path = self .path ["source" ], output_path = self .path ["output" ])
70+ self .command = "HandBrakeCLI --encoder-preset {encoder_preset} --preset-import-file {json_path} --preset {preset_name} --quality {quality} --encopts {encopts} --input {source_path} --output {output_path}" .format (encoder_preset = self .encoder_preset , json_path = os .path .join (sys .path [0 ], "src" , " presets.json" ), preset_name = self .preset_name , quality = str (self .encoder_quality ), encopts = self .encoder_options , source_path = self .path ["source" ], output_path = self .path ["output" ])
7171
7272 def signal_handler (self , sig , frame ):
7373 """ Delete output file if ctrl+c is caught, since file will be corrupt
0 commit comments