fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)
MIT License
7.62k stars 872 forks source link

fix parsing of ffmpeg 7 "is a device" formats #1276

Open alexger opened 1 month ago

alexger commented 1 month ago

when running with ffmpeg 7, some formats are not properly parsed by getAvailableFormats and thus can not be used.

ffmpeg 7 adds a new column to the output of -formats command:

..d = Is a device

https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/pull/1274 partially addressed that issue, but only for formats where the new column is a space.

Formats that have d do not match the existing regex and are silently ignored.

One example is lavfi format which right now can not be used due to this issue.

The fix is to ammend the parsing regex to expect an optional space or 'd'. This way both new and old versions of ffmpeg are supported.

I've added a test for lavfi which fails without this fix when run with ffmpeg 7.