Whole file
imageio/imageio-ffmpeg
The author described this change as “Fix pix_format parser to capture formats that have commas within strings (#79)”. It counts as a record because the check below fails on the code as it stood at 906a95e39 and passes on b517123b8, with nothing else changed between the two runs.
Projectimageio/imageio-ffmpeg
Fix saved2023-01-03
Sharing licenceBSD-2-Clause · LICENSE
Change size+10 −1
What the code was meant to do, written into the code itself as a save note
Fix pix_format parser to capture formats that have commas within strings (#79)
The change
| 135 | 135 | # Codec and pix_fmt hint | |
| 136 | 136 | line = videolines[0] | |
| 137 | 137 | meta["codec"] = line.split("Video: ", 1)[-1].lstrip().split(" ", 1)[0].strip() | |
| 138 | - | meta["pix_fmt"] = line.split("Video: ", 1)[-1].split(",")[1].strip() | |
| 138 | + | meta["pix_fmt"] = re.split( | |
| 139 | + | # use a negative lookahead regexp to ignore commas that are contained | |
| 140 | + | # within a parenthesis | |
| 141 | + | # this helps consider a pix_fmt of the kind | |
| 142 | + | # yuv420p(tv, progressive) | |
| 143 | + | # as what it is, instead of erroneously reporting as | |
| 144 | + | # yuv420p(tv | |
| 145 | + | r",\s*(?![^()]*\))", | |
| 146 | + | line.split("Video: ", 1)[-1], | |
| 147 | + | )[1].strip() | |
| 139 | 148 | ||
| 140 | 149 | # get the output line that speaks about audio | |
| 141 | 150 | audiolines = [ |
The check that tells the two apart
fail→pass·tests/test_parsing.py::test_comma_in_pixel_format
Check file tests/test_parsing.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it906a95e39ddc4d9383f71344baa8b5c321afc771
Broken version dated2023-01-03
Moduleimageio_ffmpeg._parsing
Units changedparse_ffmpeg_header
Fingerprintf73b228e7e9e2ece
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.