Skip to content
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

Not found resource to use video compress #233

Open
SETsachin opened this issue Dec 28, 2022 · 1 comment
Open

Not found resource to use video compress #233

SETsachin opened this issue Dec 28, 2022 · 1 comment

Comments

@SETsachin
Copy link

I am trying to use video compress by using Litr library i implement the library
i create obj for mediatranformer
use the method .transform implement the listner but didnt get how use listner and implement compression

please share any resources

@izzytwosheds
Copy link
Contributor

izzytwosheds commented Dec 29, 2022

I think demo app should be helpful.
Listener is a very standard listener that calls back with progress and status updates. Usually you would use it to display progress/status of transcoding in UI.

If you are simply compressing video, all you need is a target video format:

val videoFormat = MediaFormat.createVideoFormat(MimeType.VIDEO_AVC, 1280, 720)
    .apply {
        setInteger(MediaFormat.KEY_BIT_RATE, 5_000_000)
        setInteger(MediaFormat.KEY_FRAME_RATE, 30)
    }

mediaTransformer.transform(
    UUID.randomUUID.toString(),
    sourceUri,
    targetFilePath,
    videoFormat,
    null,
    transformationListener,
    null
)

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

No branches or pull requests

2 participants