Skip to content

Conversation

vmstan
Copy link
Contributor

@vmstan vmstan commented Jul 24, 2024

The static builds linked off of ffmpeg.org use a non-X.Y.Z format that the previous regex was failing on. This looks for number format or the next block of text instead of matching the number format. If neither function it'll return 0.0.0.

image

@ClearlyClaire
Copy link
Contributor

I'm not sure why we should ignore anything that isn't strictly point-separated numerics, n7.0.1 is still a ffmpeg version number as far as ffmpeg is concerned.

https://superuser.com/a/1609819 gives an interesting reply regarding how to cleanly parse

There are also things that I'm not sure how I missed when reviewing #30710:

  • I believe those are the only places where we are shelling out using the backticks; we normally use terrapin
  • we allow specifying custom ffmpeg binaries through FFMPEG_BINARY and FFPROBE_BINARY (see e.g. app/lib/video_metadata_extractor.rb using ffprobe_binary) and this code ignores that

@vmstan vmstan force-pushed the improve-ffmpeg-version-detection branch from 4b9873e to d2dfded Compare July 26, 2024 03:31
Copy link
Contributor

@ClearlyClaire ClearlyClaire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the improvements!

I think you also need to update the rescue statement to something like rescue Terrapin::CommandNotFoundError, Terrapin::ExitStatusError.

And I again think nightly and such versions should be reported instead of displaying 0.0.0. The code suggestion should do it. If you accept it, you should also add Oj:ParseErrorto the rescue line.

@vmstan vmstan force-pushed the improve-ffmpeg-version-detection branch from 9275ce4 to 56d15a7 Compare July 26, 2024 13:39
Copy link
Contributor

@ClearlyClaire ClearlyClaire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rescue statement a few lines below still needs to be changed to rescue Terrapin::CommandNotFoundError, Terrapin::ExitStatusError, Oj::ParseError

@vmstan
Copy link
Contributor Author

vmstan commented Jul 26, 2024

The rescue statement a few lines below still needs to be changed to rescue Terrapin::CommandNotFoundError, Terrapin::ExitStatusError, Oj::ParseError

Perfect, I was literally about to message you and ask if this was the appropriate rescue block 🤣

@ClearlyClaire ClearlyClaire added this pull request to the merge queue Jul 26, 2024
Merged via the queue into mastodon:main with commit b120792 Jul 26, 2024
29 checks passed
@vmstan vmstan deleted the improve-ffmpeg-version-detection branch July 26, 2024 17:20
justinwritescode pushed a commit to justinwritescode/mastodon that referenced this pull request Sep 15, 2024
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants