Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am working on a social media app where the users can upload their videos and watch them in the app. But it takes lots of time to retrieve videos from firebase due to its large size (like 13 seconds video size is 5mb). So I thought to compress video size but after compressing the size ,the video quality gets low. How can I compress video without loosing its quality?


mVideoView = findViewById(R.id.videoView)
    val intent = Intent(MediaStore.ACTION_VIDEO_CAPTURE)
    intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY,-1)
    intent.putExtra(MediaStore.EXTRA_BRIGHTNESS,1);
    startActivityForResult(intent, REQUEST_CODE)


What I have tried:

I have tried to compress video without loosing its quality?
Posted
Updated 16-Nov-20 3:03am
Comments
David Crow 16-Nov-20 8:40am    
Have you tried FFMPEG?

https://github.com/WritingMinds/ffmpeg-android-java

https://github.com/bravobit/FFmpeg-Android
Member 14883729 16-Nov-20 9:12am    
FFMPEG is very complex to understand and also it increases the size of the app

1 solution

Pretty much, you can't, and certainly not significantly - unless the source video is an unbelievably low compression video format and modern video codecs are most definitely not that!

Most video codecs compress video, to the point where it can't be significantly compressed further (in fact, ZIPing a video file often makes the result bigger not smaller!) without reducing resolution, frame rate, or data rate (where applicable). And if you alter any of those three, video quality will suffer. In fact, it'll almost certainly degrade at least slightly no matter what you do to it other than a straight copy!

Think about it: if you could make video files half the size without any loss of quality, they would have started out with that size in the first place because they would already be stored in the "smaller format"!
 
Share this answer
 
Comments
Member 14883729 16-Nov-20 9:14am    
Can u tell me how video platform like tiktok , reels load video very fast despite of having high quality videos
OriginalGriff 16-Nov-20 9:41am    
No - I don't use tiktok, so I have no idea what it does or how it works.
And probably, they aren't going to tell anybody how it works either - it's their IP and they will probably want to protect it.
Member 14883729 16-Nov-20 10:32am    
How YouTube loads video fast. Can't I load and upload video fast without compressing them
OriginalGriff 16-Nov-20 10:39am    
It doesn't.
It streams it, with buffering.
Member 14883729 16-Nov-20 11:52am    
Can I stream fast

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900