-
-
Couldn't load subscription status.
- Fork 1.3k
remotion.dev/convert: Add compression option to ConvertUi component #5853
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
Open
JonnyBurger
wants to merge
6
commits into
main
Choose a base branch
from
claude/review-convert-ui-011CUPhaLqiydqDcFkFaDefZ
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f7ae991
Add compression option to ConvertUi component
claude 3a32329
Use mediabunny quality constants instead of bitrate values
claude 4ccf650
Update ConvertUi.tsx
JonnyBurger 451946e
Update turbo.json
JonnyBurger a2cceca
Update CompressUi.tsx
JonnyBurger 7a0a020
Merge branch 'main' into claude/review-convert-ui-011CUPhaLqiydqDcFkF…
JonnyBurger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| import React from 'react'; | ||
| import {Label} from './ui/label'; | ||
| import { | ||
| Select, | ||
| SelectContent, | ||
| SelectItem, | ||
| SelectTrigger, | ||
| SelectValue, | ||
| } from './ui/select'; | ||
|
|
||
| const formatBitrate = (bitrate: number): string => { | ||
| if (bitrate >= 1000000) { | ||
| return `${(bitrate / 1000000).toFixed(1)} Mbps`; | ||
| } | ||
| return `${(bitrate / 1000).toFixed(0)} Kbps`; | ||
| }; | ||
|
|
||
| export const CompressUi: React.FC<{ | ||
| videoBitrate: number | null; | ||
| setVideoBitrate: (bitrate: number | null) => void; | ||
| audioBitrate: number | null; | ||
| setAudioBitrate: (bitrate: number | null) => void; | ||
| hasVideo: boolean; | ||
| hasAudio: boolean; | ||
| }> = ({ | ||
| videoBitrate, | ||
| setVideoBitrate, | ||
| audioBitrate, | ||
| setAudioBitrate, | ||
| hasVideo, | ||
| hasAudio, | ||
| }) => { | ||
| return ( | ||
| <div> | ||
| <div className="h-4" /> | ||
| {hasVideo ? ( | ||
| <> | ||
| <Label htmlFor="video-bitrate">Video bitrate</Label> | ||
| <Select | ||
| value={String(videoBitrate ?? 'none')} | ||
| onValueChange={(val) => | ||
| setVideoBitrate(val === 'none' ? null : Number(val)) | ||
| } | ||
| > | ||
| <SelectTrigger> | ||
| <SelectValue placeholder="Select video bitrate" /> | ||
| </SelectTrigger> | ||
| <SelectContent> | ||
| <SelectItem value="none">No compression</SelectItem> | ||
| <SelectItem value="500000">{formatBitrate(500000)}</SelectItem> | ||
| <SelectItem value="1000000">{formatBitrate(1000000)}</SelectItem> | ||
| <SelectItem value="2000000">{formatBitrate(2000000)}</SelectItem> | ||
| <SelectItem value="3000000">{formatBitrate(3000000)}</SelectItem> | ||
| <SelectItem value="5000000">{formatBitrate(5000000)}</SelectItem> | ||
| <SelectItem value="8000000">{formatBitrate(8000000)}</SelectItem> | ||
| <SelectItem value="10000000">{formatBitrate(10000000)}</SelectItem> | ||
| </SelectContent> | ||
| </Select> | ||
| <div className="text-sm mt-2 text-muted-foreground"> | ||
| Lower bitrate reduces file size but may affect quality. | ||
| </div> | ||
| </> | ||
| ) : null} | ||
| {hasVideo && hasAudio ? <div className="h-4" /> : null} | ||
| {hasAudio ? ( | ||
| <> | ||
| <Label htmlFor="audio-bitrate">Audio bitrate</Label> | ||
| <Select | ||
| value={String(audioBitrate ?? 'none')} | ||
| onValueChange={(val) => | ||
| setAudioBitrate(val === 'none' ? null : Number(val)) | ||
| } | ||
| > | ||
| <SelectTrigger> | ||
| <SelectValue placeholder="Select audio bitrate" /> | ||
| </SelectTrigger> | ||
| <SelectContent> | ||
| <SelectItem value="none">No compression</SelectItem> | ||
| <SelectItem value="64000">{formatBitrate(64000)}</SelectItem> | ||
| <SelectItem value="96000">{formatBitrate(96000)}</SelectItem> | ||
| <SelectItem value="128000">{formatBitrate(128000)}</SelectItem> | ||
| <SelectItem value="192000">{formatBitrate(192000)}</SelectItem> | ||
| <SelectItem value="256000">{formatBitrate(256000)}</SelectItem> | ||
| <SelectItem value="320000">{formatBitrate(320000)}</SelectItem> | ||
| </SelectContent> | ||
| </Select> | ||
| <div className="text-sm mt-2 text-muted-foreground"> | ||
| Lower bitrate reduces file size but may affect audio quality. | ||
| </div> | ||
| </> | ||
| ) : null} | ||
| </div> | ||
| ); | ||
| }; | ||
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SelectTrigger components are missing
idattributes that should match thehtmlForattributes on their corresponding labels, breaking the label-to-input association for accessibility.View Details
📝 Patch Details
Analysis
Missing id attributes break label-to-input accessibility association in CompressUi
What fails: SelectTrigger components in CompressUi.tsx lack
idattributes that match their LabelhtmlForattributes, breaking programmatic label-to-input associationHow to reproduce:
Result: Labels with
htmlFor="video-bitrate"andhtmlFor="audio-bitrate"have no matching elements, solabel.controlis null and accessibility features failExpected: Labels should programmatically associate with their inputs per HTML specification, enabling screen reader announcements and click-to-focus behavior
Pattern established: Other components (ConvertForm.tsx, downloadModel.tsx) correctly implement matching htmlFor/id pairs