ffmpeg – Error submitting packet to decoder: Invalid data found when processing input FFMPG Python

My code outputs the following error while I read a .wav file using ffmpeg python.
Could someone please advise.

import ffmpeg
import subprocess
def find_corrupt_frames(mxf_file_path):
corrupt_frames = []
command = [
‘ffmpeg’,
‘-v’, ‘error’, # Show only error messages
‘-i’, mxf_file_path, # Input file
‘-f’, ‘null’, # Output format (null for no actual output)
‘-‘ # Use dash to indicate no output file
]

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

mxf_file_path = “\\X1\Users13$\ijayaram\Down\f1.wav’
corrupt_frames = find_corrupt_frames(mxf_file_path)
if corrupt_frames:
print(f”Corrupt frames found at indices: {corrupt_frames}”)
else:
print(“No corrupt frames found.”)

Read more here: Source link