Repository navigation
Let apps check export settings before exporting - #1133
Merged
Merged
Conversation
Add static FFmpegWriter queries that report what an encoder accepts (sample rates, channel layouts, pixel formats, quality options, and whether it is lossless or hardware), describe output formats, list encoders a format can hold, and check format/codec compatibility. Formats are matched by file extension like the writer, then by name.
…failed header FFmpegWriter::Test() opens the encoders (including hardware encoders) and writes the header to memory, so the container rejects anything it would reject during a real export. FFmpeg's messages are returned as JSON instead of printed. Close() no longer writes a trailer when the header failed, which crashed.
GetFormats() returns one entry per file extension that selects its format (the way the writer picks one), with its default codecs. GetEncoderInfo() also reports whether an encoder writes single image files.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1133 +/- ##
===========================================
+ Coverage 73.91% 74.16% +0.24%
===========================================
Files 275 275
Lines 36995 37407 +412
===========================================
+ Hits 27344 27742 +398
- Misses 9651 9665 +14 ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a few ways for apps to ask libopenshot what FFmpeg can export, so OpenShot can catch invalid export settings before an export starts, instead of failing partway in.
GetEncoderInfo(),GetFormatInfo(),GetEncoders(), andIsCodecSupportedByFormat()return JSON about what each encoder accepts (sample rates, channel layouts, pixel formats, quality modes, hardware, lossless, intra-only, image) and which codecs a format can hold.GetFormats()returns one entry per file extension the writer can export to, matching how the writer picks a format from the file name.Test()is called instead ofOpen(), after the same options an export sets. It opens the encoders (including hardware encoders) and writes the header to memory, so the format and codecs reject exactly what a real export would. FFmpeg's own explanation is returned as JSON (i.e. "mp3: Exactly one MP3 audio stream is required") instead of printed.Close()no longer writes a trailer when the header failed, which crashed.Builds against FFmpeg 4.x through 7.x, with version guards for older APIs.
Used by OpenShot/openshot-qt#6217.