lalongooo / video-compressor

Video compressor based in the Telegram for Android app source code.
GNU General Public License v2.0
262 stars 88 forks source link

video compression #24

Closed SangeetaChinthapalli closed 8 years ago

SangeetaChinthapalli commented 8 years ago

Hi, I have code for video compression . that is not working for marsh mallow. it is adding some extra colour on video. help me for modification

int colorFormat; int processorType = PROCESSOR_TYPE_OTHER; String manufacturer = Build.MANUFACTURER.toLowerCase(); if (Build.VERSION.SDK_INT < 18) { MediaCodecInfo codecInfo = selectCodec(MIME_TYPE); colorFormat = selectColorFormat(codecInfo, MIME_TYPE); if (colorFormat == 0) { throw new RuntimeException("no supported color format"); } String codecName = codecInfo.getName(); if (codecName.contains("OMX.qcom.")) { processorType = PROCESSOR_TYPE_QCOM; if (Build.VERSION.SDK_INT == 16) { if (manufacturer.equals("lge") || manufacturer.equals("nokia")) { swapUV = 1; } } } else if (codecName.contains("OMX.Intel.")) { processorType = PROCESSOR_TYPE_INTEL; } else if (codecName.equals("OMX.MTK.VIDEO.ENCODER.AVC")) { processorType = PROCESSOR_TYPE_MTK; } else if (codecName.equals("OMX.SEC.AVC.Encoder")) { processorType = PROCESSOR_TYPE_SEC; swapUV = 1; } else if (codecName.equals("OMX.TI.DUCATI1.VIDEO.H264E")) { processorType = PROCESSOR_TYPE_TI; } Log.d("tmessages", "codec = " + codecInfo.getName() + " manufacturer = " + manufacturer + "device = " + Build.MODEL); } else { colorFormat = MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface; Log.d(TAG, "convertVideo: colorFormat "+colorFormat); }

lalongooo commented 8 years ago

The code is supposed to work on API 17+, however it has not yet been optimized or tested against Marshmallow.

This project is based in an older version of the Telegram app, at that time, it was not tested against Marshmallow. So, I'd need to take a look to the newest version of telegram and update this project, but that will require some tome and there is not ETA at this time.

One thing you can do is to install the Telegram app in your Android device and compress your video.

If the video is compressed correctly, then this project needs to be updated according the newest version of Telegram. Otherwise, the problem is with the original code of Telegram, in that case I can't update this project.

Thanks!

SangeetaChinthapalli commented 8 years ago

thank you.

any alternate solution for video compression ?

lalongooo commented 8 years ago

Not at this time, this was a side project I worked on and found interesting to share with the community.

I found this but it's kind of expensive for Android, that's why I decided to "extract" the video compression module from Telegram.