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

Why not transcoding videos other than 16:9 #40

Open
Shanki070 opened this issue Feb 6, 2017 · 2 comments
Open

Why not transcoding videos other than 16:9 #40

Shanki070 opened this issue Feb 6, 2017 · 2 comments

Comments

@Shanki070
Copy link

I was looking at your code, I found that in Android720pFormatStrategy.java

if (longer * 9 != shorter * 16) { throw new OutputFormatUnavailableException("This video is not 16:9, and is not able to transcode. (" + width + "x" + height + ")"); }

So, why are you not transcoding videos other than 16:9?

@ypresto
Copy link
Owner

ypresto commented Feb 6, 2017

CTS contains encoding test for 1280x720 and it is listed in Supported Media Formats. But other resolution like 960x540 (iOS can encode in this res) causes broken video at least Nexus 4. It perhaps limitation or bug of hardware codec. So we cannot use something like 1280x600 for output resolution to adapt to aspect ratio of input video.

So if input file is other than 16:9, we should crop it and fit into 16:9, but currently cropping is not supported by this library.

Perhaps it can be done by manipulating vertex shader and etc. in TextureRender.java.

@edwardotis
Copy link
Contributor

edwardotis commented Aug 17, 2018

In my tests, you can use this library to encode videos of arbitrary aspect ratio, as long as you maintain that aspect ratio in your strategy. >= API23
I've successfully tested downsizing video bitrate and dimensions with input ratios of: 16x9, 4x3, 1x1, 18.5x9 with no issues.
https://en.wikipedia.org/wiki/Aspect_ratio_(image)#Current_video_standards

Just provide a single, target minimum dimension (width or height), and calculate the other dimension to maintain the aspect ratio.

Update:
But as ypresto mentioned above, these output resolutions may not be playable on older devices and api versions.

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