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

Video stretched after trimming #46

Closed
braver-tool opened this issue Apr 28, 2021 · 7 comments
Closed

Video stretched after trimming #46

braver-tool opened this issue Apr 28, 2021 · 7 comments

Comments

@braver-tool
Copy link

I facing a video stretch issue after trimming the video. It does not occur for all video files, only occurs on some videos. I found one thing for the issue, that is height and width of the video are interchanged, also rotation is changed, after executing the below lines.
I've attached a sample video file. The actual width and height are 352 and 640, after trimming the changed as 640 and 340. Please help to fix the issue.

   `MediaMetadataRetriever metaRetriever = new MediaMetadataRetriever();
    metaRetriever.setDataSource(String.valueOf(uri));
    String height = metaRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT);
    String width = metaRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH);
    String rotation = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION);
    int w = TrimmerUtils.clearNull(width).isEmpty() ? 0 : Integer.parseInt(width);
    int h = Integer.parseInt(height);`
VID-20210428-WA0007.mp4
@a914-gowtham
Copy link
Owner

Can you share the trimOption that you used

@braver-tool
Copy link
Author

Am not using any compressOption, TrimOption for that. I just use default options for all like below,
TrimVideo.activity(data).setCompressOption(new CompressOption()).start(this);

@a914-gowtham
Copy link
Owner

Thanks for creating a good issue. It occurs when we try to trim a video that has rotation 90 || 360. I was passing width and height in the ffmpeg command and that's where had to make changes. It has been fixed in the latest release. you could use the implementation 'com.github.a914-gowtham:Android-video-trimmer:1.6.4'

@a914-gowtham
Copy link
Owner

@braver-tool feel free to open this issue if it does happen again.

@VivekThummar52
Copy link

i just want to ask you one question, don't you think that rotation check will be for 90 and 270, if i'm wrong than please explain me why 90 and 360?

@a914-gowtham
Copy link
Owner

My bad. that should be 270.

@a914-gowtham a914-gowtham reopened this May 4, 2021
@a914-gowtham
Copy link
Owner

@braver-tool @VivekThummar52 thanks for mentioning it. I don't know how I was careless. Use this latest version

implementation 'com.github.a914-gowtham:Android-video-trimmer:1.6.5'

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

3 participants