feat: Introduce new transcoding options in settings#1471
Open
mrjoshuap wants to merge 3 commits intomediacms-io:mainfrom
Open
feat: Introduce new transcoding options in settings#1471mrjoshuap wants to merge 3 commits intomediacms-io:mainfrom
mrjoshuap wants to merge 3 commits intomediacms-io:mainfrom
Conversation
- Added TRANSCODING_OPTIONS to control video transcoding behavior with options: 'always', 'never', 'file_size_gt', 'file_size_lt', and 'non_mp4_only'. - Introduced TRANSCODING_OPTIONS_FILESIZE to set file size thresholds for transcoding. - Updated should_transcode_video function to utilize new settings for improved transcoding logic. - Modified Media model to check transcoding options before processing videos, ensuring backward compatibility with DO_NOT_TRANSCODE_VIDEO.
- Introduced DELETE_ORIGINAL_VIDEO_IF_TRANSCODED setting to control deletion of original video files post-transcoding. - Updated Media model to implement logic for deleting original files based on transcoding success and completion of all encodings. - Enhanced documentation to reflect the new setting and its implications for storage management.
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.
Conditional Transcoding Options
Description
Summary
This PR implements conditional video transcoding options as discussed in #1375. The feature allows administrators to configure when videos should be transcoded based on file size or format, rather than transcoding all videos or none.
Problem
Previously, MediaCMS only supported two transcoding modes:
DO_NOT_TRANSCODE_VIDEO = False: Transcode all videos (wastes storage on small videos that play fine)DO_NOT_TRANSCODE_VIDEO = True: Transcode no videos (larger files cause playback issues)This binary approach doesn't accommodate scenarios where:
Solution
Introduces a flexible
TRANSCODING_OPTIONSsetting with multiple modes:'always'(default): Always transcode videos (maintains backward compatibility)'never': Never transcode videos (same asDO_NOT_TRANSCODE_VIDEO = True)'file_size_gt': Only transcode videos larger thanTRANSCODING_OPTIONS_FILESIZEthreshold'file_size_lt': Only transcode videos smaller thanTRANSCODING_OPTIONS_FILESIZEthreshold'non_mp4_only': Only transcode videos that are not in MP4 formatChanges
TRANSCODING_OPTIONSsetting with default value'always'TRANSCODING_OPTIONS_FILESIZEsetting (default: 1000 MB) for size-based conditionsshould_transcode_video()helper function with conditional logicMediamodel to check transcoding options before processingDO_NOT_TRANSCODE_VIDEOsettingdocs/transcoding.mdConfiguration Example
Backward Compatibility
'always'behaviorDO_NOT_TRANSCODE_VIDEOsetting is still respected and takes precedenceTesting
'always'option are transcoded'never'option skip transcoding'file_size_gt'are transcoded'file_size_gt'skip transcoding'non_mp4_only'are transcoded'non_mp4_only'skip transcodingDO_NOT_TRANSCODE_VIDEOmaintained