Skip to content

Improved Profiles (400+ Export Profiles, New Profile UI, and more) #5116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 45 commits into from
Feb 2, 2023

Conversation

jonoomph
Copy link
Member

@jonoomph jonoomph commented Jan 27, 2023

This is a big PR, with a new approach to managing Export Profiles. Since most of OpenShot's profiles were inherited from our old 1.x code base, and not personally sourced by myself, I thought it would be a fun exercise to research common video sizes and frame rates, and compile a comprehensive list of useful ones. And since this type of work can be easy to make mistakes, I based all my work around the concept of a simple manage.py script, which could read in simple JSON definitions, and output a variety of things, including verifying my math, and verifying we have no duplicates, etc...

New Profile UI:

Filterable-Profiles

Instead of a long dropdown which is difficult to search (especially with 400+ profiles), we now have a filterable / searchable UI for selecting a new Project Profile. These profiles affect the video size (width, height), frame rate, display aspect ratio, sample aspect ratio (i.e. anamorphic), and include some common phrases often associated with it, for example 1920x1080 is FHD, etc... You can simply double click on the profile you want, or click the "Okay" button after making a selection.

New Export UI:

Similarly, when exporting your project, you can click the small "Profile" icon next to the drop down, and it will display the same Profile UI displayed above, which is filterable and searchable.

Export-Profile-Button

Backwards Compatibility:
We continue to support our Legacy profiles (now found in src/profiles/legacy/), however OpenShot will now automatically switch you to a new matching profile when you open existing projects. These are basically identical matches (perhaps with a modified name), so it should not cause any issues, but I wanted to mention it here.

Profile manage.py script:

 - "generate": Generate a new set of profile files for OpenShot (1 text file per profile)
 - "validate": Parse through all definitions and validate the math (aspect ratios, sample ratios, etc...)
 - "update": Update all JSON definition sample ratios
 - "preview": Using only JSON definitions, display all profiles to the screen
 - "display": Print all existing profiles to the screen
 - "doc": Print documentation markdown (used for manually updating our docs)

The JSON definition files following the following syntax:

{
    "name": "National Television System Committee",
    "abbreviation": "NTSC",
    "description": "American standard for analog television broadcast",
    "category": "broadcast",
    "profiles": [
        { "width": 704, "height": 480, "notes": "NTSC SD", "fps": [
                {"num": 30000, "den": 1001, "progressive": false, "dar": {"num": 4, "den": 3}, "notes": "Anamorphic", "sar": {"num": 10, "den": 11}},
                {"num": 30000, "den": 1001, "progressive": false, "dar": {"num": 16, "den": 9}, "notes": "Anamorphic", "sar": {"num": 40, "den": 33}}
            ]
        },
        { "width": 320, "height": 240, "notes": "NTSC SD 1/4", "fps": [
                {"num": 30000, "den": 1001, "progressive": true, "dar": {"num": 4, "den": 3}, "notes": "", "sar": {"num": 1, "den": 1}}
            ]
        }
    ]
}

The manage.py "generate" command will parse all these JSON definitions, validate them, de-dupe them, try and normalize the text description formatting and capitalization, and will output hundreds of unique profile files (same format as before, and the format we load at runtime - compatible with previous versions of OpenShot):

Example profile generated: 01920x1080p2398_16:09

description=FHD 1080p 23.98 fps
frame_rate_num=24000
frame_rate_den=1001
width=1920
height=1080
progressive=1
sample_aspect_num=1
sample_aspect_den=1
display_aspect_num=16
display_aspect_den=9

…er 400 unique profile resolution + frame rates. These include the ATSC standards, Sony D1, CIF, Blu-ray, DVD, DVB, HDV, VCD/SVCD, Facebook/Instagram, NTSC, PAL, and VGA.
…orphic sizes, and initial checkin of manage.py script to help parse, test, and update these formats for the future.
…generate valid export presets from our JSON definitions
…ameWithDesc() function - standardizing profile names
…e Key() from libopenshot::Profile class. Re-generating all profiles.
…so, adding initial Presets update logic into manage.py script.
…f Anamorphic formats (and adding Note automatically), and better generation of profiles with a more uniform description.
…ngle definition, and regenerate affected profiles
…e.py script, to move NTSC/PAL/SD/HD to the front of the description, and Anamorphic to the end of the description.
…le names, and correctly order FHD, UHD, and other labels to the front of the description
… ratio, and fixed vertical resolutiosn to use the original width (i.e. 720p Vertical instead of 1280p Vertical), and regenerating all profiles
…esolutions, and regenerating affected profiles
…archable. Now requires user to click "Ok" button to prevent accidental changes to Profile.
… TimelineSync object (where the JSON is applied or loaded in libopenshot)

- Add playback caching setting when Profile dialog changes profile in accept() method
- separate Profile UI from default project id, and allow it to be more generic
- Allow profile to initially select any profile by description or Key()
- Correctly apply the profile of a loaded project, and fallback to a default if not found
…ll as 0 sample rate and 0 channels (indicating missing video or audio tracks)

- Allow up to 384000 sample rate (and 0)
- Update GIF preset to remove audio info
- Update MP3 preset to remove video info
- Improve manage.py profile script, to auto-generate our *.rst profile documenation (list of presets and profiles)
- Update profiles documentation (presets list and profiles list)
@jonoomph jonoomph changed the title Improved profiles Improved Profiles (400+ Export Profiles, New Profile UI, manage script for automation) Jan 27, 2023
@jonoomph jonoomph changed the title Improved Profiles (400+ Export Profiles, New Profile UI, manage script for automation) Improved Profiles (400+ Export Profiles, New Profile UI, and more) Jan 27, 2023
- Removing unused variables
- Removing unreachable code
- Wrapping some long code lines
- Removing unneeded elif
- Replaced minidomxml with defusedxml (safer)
- Removed unneeded else's
- Removed unneeded overloaded method
- Removed unused key in dict loop
- Fixed some long lines that needed to wrap
@jonoomph
Copy link
Member Author

- Avoid using built-in variable
- Removing unneeded elif
- Reduce complexity of Exception string
… and profiles.rst file - to help demonstrate how SAR is applied to the final display resolution
…d - related to our new Profiles UI. Also tweaking the column widths of the generated profile list syntax.
@jonoomph
Copy link
Member Author

…de the ":" character, since Windows has issues with this character in file paths.
- Fixing bug when rescaling FPS to a new FPS, to prevent undo/redo history from being erased
@jonoomph jonoomph merged commit d46346f into develop Feb 2, 2023
@jonoomph jonoomph deleted the improved-profiles branch February 2, 2023 22:30
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.

1 participant