Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pytranscoder/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def fetch_details(self, _path: str) -> MediaInfo:
:return: Instance of MediaInfo
"""
with subprocess.Popen([self.path, '-i', _path], stderr=subprocess.PIPE) as proc:
output = proc.stderr.read().decode(encoding='utf8')
output = proc.stderr.read().decode(encoding='utf8', errors='replace')
mi = MediaInfo.parse_ffmpeg_details(_path, output)
if mi.valid:
return mi
Expand All @@ -53,7 +53,7 @@ def fetch_details_ffprobe(self, _path: str) -> MediaInfo:

args = [ffprobe_path, '-v', '1', '-show_streams', '-print_format', 'json', '-i', _path]
with subprocess.Popen(args, stdout=subprocess.PIPE) as proc:
output = proc.stdout.read().decode(encoding='utf8')
output = proc.stdout.read().decode(encoding='utf8', errors='replace')
info = json.loads(output)
return MediaInfo.parse_ffmpeg_details_json(_path, info)

Expand Down
2 changes: 1 addition & 1 deletion pytranscoder/handbrake.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def fetch_details(self, _path: str) -> MediaInfo:
:return: Instance of MediaInfo
"""
with subprocess.Popen([self.path, '--scan', '-i', _path], stderr=subprocess.PIPE) as proc:
output = proc.stderr.read().decode(encoding='utf8')
output = proc.stderr.read().decode(encoding='utf8', errors='replace')
mi = MediaInfo.parse_handbrake_details(_path, output)
if mi.valid:
return mi
Expand Down
2 changes: 1 addition & 1 deletion pytranscoder/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def calculate_progress(info: MediaInfo, stats: Dict) -> (int, int):

def run(cmd):
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False)
output = p.communicate()[0].decode('utf-8')
output = p.communicate()[0].decode('utf-8', errors='replace')
return p.returncode, output


Expand Down