ffmpeg-python icon indicating copy to clipboard operation
ffmpeg-python copied to clipboard

Filelist reading problem when extracting frames using ffmpeg-python

Open jamie-reconlabs opened this issue 3 years ago • 0 comments

Hi,

We have a small workflow consisting of several steps. We read a file list from a txt file using a loop like the following:

while IFS= read -r FILE || [ -n "$FILE" ] 
do  
# Do some stuff, including frame extraction from a video
done < "$FILE_LIST"

However, the process stops after the first run of the loop, and we narrowed down the problem to our frame extraction procedure. We use the following code for frame extraction:

        try:
            (
            ffmpeg
            .input(filename, skip_frame='nokey')
            .filter("fps",desired_fps)
            .output(resolved_path, start_number = 0)
            .run(
                quiet=False,
                capture_stdout=False,
                capture_stderr=False) 
            )
            
        except ffmpeg.Error as e:
            print(e.stderr.decode(), file=sys.stderr)
            sys.exit(1)

We've read (one, two) that ffmpeg might "eat" stdin (whatever that means), and perhaps that's the cause of our issue. We tried to use the nostdin=True option in the input function, but the frame extraction failed with no errors.

Any help on how to solve this issue will be greatly appreciated.

jamie-reconlabs avatar Sep 08 '22 07:09 jamie-reconlabs