Может кто-нибудь посоветовать.
import ffmpeg
import subprocess
def find_corrupt_frames(mxf_file_path):
corrupt_frames = []
command = [
'ffmpeg',
'-v', 'error', # Показать только сообщения об ошибках
'-i', mxf_file_path, # Входной файл
'-f', 'null', # Формат вывода (null для отсутствия фактический вывод)
'-' # Используйте тире, чтобы указать отсутствие выходного файла
]
Код: Выделить всё
try:
# Execute the ffmpeg command
process = subprocess.run(command, capture_output=True, text=True)
# Parse the error messages to find corrupt frames
if process.stderr:
for line in process.stderr.split('\n'):
if 'error' in line.lower():
print(f"Error found: {line}")
# Extract frame information from the error message
if 'fr ame=' in line:
frame_info = line.split('frame=')[1].split()[0]
corrupt_frames.append(int(frame_info))
except Exception as e:
print(f"Failed to process MXF file: {e}")
return corrupt_frames
corrupt_frames = find_corrupt_frames(mxf_file_path)
если поврежденные_фреймы:
print(f"Поврежденные кадры найдены по индексам: {corrupt_frames}")
else:
print("Поврежденных кадров не обнаружено.")
Подробнее здесь: https://stackoverflow.com/questions/793 ... -input-ffm
Мобильная версия