Open pritesh25 opened 6 years ago
what are you using firebase or what as your backend
i am using php and MySQL as backend
did you solved or still facing error
what do you want to compress video or image ...I can I help you
still im facing error , I'm compressing video
are you compressing image
no , not now because images size is not too much if i compared with video
use this to compress image it is very use full....
private Bitmap decodeFile(File f) {
Bitmap b = null;
//Decode image size
BitmapFactory.Options o = new BitmapFactory.Options();
o.inJustDecodeBounds = true;
FileInputStream fis = null;
try {
fis = new FileInputStream(f);
BitmapFactory.decodeStream(fis, null, o);
fis.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
int IMAGE_MAX_SIZE = 1024;
int scale = 1;
if (o.outHeight > IMAGE_MAX_SIZE || o.outWidth > IMAGE_MAX_SIZE) {
scale = (int) Math.pow(2, (int) Math.ceil(Math.log(IMAGE_MAX_SIZE /
(double) Math.max(o.outHeight, o.outWidth)) / Math.log(0.5)));
}
//Decode with inSampleSize
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inSampleSize = scale;
try {
fis = new FileInputStream(f);
b = BitmapFactory.decodeStream(fis, null, o2);
fis.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Log.d(TAG, "Width :" + b.getWidth() + " Height :" + b.getHeight());
try {
FileOutputStream out = new FileOutputStream(thumb_filePath);
b.compress(Bitmap.CompressFormat.JPEG, 50, out);
out.flush();
out.close();
} catch (Exception e) {
e.printStackTrace();
}
return b;
}
but of i want to compress video then what would you recommend me ?
for video
yes for video
wait these types of libraries does not work as you expected I will give you the code....just be calm
ok sure , I'll wait for your response.
ok good !!
yo !!! the file is very big how can I send you.... I have the code...how can I send it to you ..it has 7 class
upload the file on Google drive and share the link here or else you can mail me link personally too.
do u have facebook or Gmail or WhatsApp like thing
yes here i my email priteshvishwakarma@gmail.com mail me on this email id
okkk done I will send you now
are you facing this problem
like your video cannot be played through download url
yes video is not playing from the URL specially when the video is compressed and uploaded to the web server , file is completely uploaded to the web server I check the file size and everything , everything is working perfectly. but compressed video file is not playing through the URL
how did you get that compressed file from compress video()
i use this compression technique (sillicompression)
this link helps you see this if there is problem just come here we will talk about that
or https://github.com/lalongooo/VideoCompressor this library by telegram
SiliCompressor.with(Context).compressVideo(sourceVideoUri, destionationDirPath);
what should I pass here i am getting error ...he said that I should pass videouri, and file path but see
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT); mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4); mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); mediaRecorder.setVideoEncodingBitRate(690000); mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264); mediaRecorder.setVideoFrameRate(30); mediaRecorder.setVideoSize(640, 480); this code will hep to compress even crappy but you can set quality of video
why am I getting this error UrisyntexException() wtf
i already used this https://github.com/lalongooo/VideoCompressor library also but after using any compression technique to compress video file. that compressed video file not stream from the live web server (it work perfectly work in localhost).
Hi @pritesh25, i don't think the problem is with SilliCompressor, because the video plays locally. Please check your file upload method. Also, try to upload the video file without compressing and see if it will play from the web server.
I know video is playing locally but it is not playing when it is uploaded on the live server.
compressed video file is not playing through the URL when i use ijk player, when i use default player video url is playing ok。
you mean default player as a [VideoView ](https://developer.android.com/reference/android/widget/VideoView)
???
Hi @pritesh25, i don't think the problem is with SilliCompressor, because the video plays locally. Please check your file upload method. Also, try to upload the video file without compressing and see if it will play from the web server.
Can you guys please help me? my video is not playing locally after compression @Tourenathan-G5organisation @pritesh25
Hi @pritesh25, i don't think the problem is with SilliCompressor, because the video plays locally. Please check your file upload method. Also, try to upload the video file without compressing and see if it will play from the web server.
Can you guys please help me? my video is not playing locally after compression @Tourenathan-G5organisation @pritesh25
@SaadShafiq did you resolved that issue? Even the sample project's compressed video is not playable nither on the device not pc.
Hi, Did anyone resolve this issue...?.."Video not streaming from web url after compression."
Does anyone have a suggested solution for this ?
private Bitmap decodeFile(File f) { Bitmap b = null; //Decode image size BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true; FileInputStream fis = null; try { fis = new FileInputStream(f); BitmapFactory.decodeStream(fis, null, o); fis.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } int IMAGE_MAX_SIZE = 1024; int scale = 1; if (o.outHeight > IMAGE_MAX_SIZE || o.outWidth > IMAGE_MAX_SIZE) { scale = (int) Math.pow(2, (int) Math.ceil(Math.log(IMAGE_MAX_SIZE / (double) Math.max(o.outHeight, o.outWidth)) / Math.log(0.5))); } //Decode with inSampleSize BitmapFactory.Options o2 = new BitmapFactory.Options(); o2.inSampleSize = scale; try { fis = new FileInputStream(f); b = BitmapFactory.decodeStream(fis, null, o2); fis.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } Log.d(TAG, "Width :" + b.getWidth() + " Height :" + b.getHeight()); try { FileOutputStream out = new FileOutputStream(thumb_filePath); b.compress(Bitmap.CompressFormat.JPEG, 50, out); out.flush(); out.close();
} catch (Exception e) { e.printStackTrace(); } return b;
}
Code working perfectly
i'm developing application which record the video and save to web server, and since recorded video have too much size i use compression technique SiliCompressor in order to reduce size of original video.
after applying compression technique, video size reduces and i also play that compressed video file into my VideoView and till here working perfectly.
when i upload compressed video file to my live webserver and try to play video from url in VideoView, it's not playing.
However it work in my localhost server well.
can u help me what is problem ?
here is my code to play video from my live web server