Tourenathan-G5organisation / SiliCompressor

A powerful, flexible and easy to use Video and Image compression library for Android.
Apache License 2.0
1.38k stars 292 forks source link

Samsung device not working #124

Open enesb08 opened 4 years ago

enesb08 commented 4 years ago

After the video compres taken on the Samsung device video showing black and not play.

rohitsharma181589 commented 4 years ago

I am also facing this issue after this line of code: String convertedVideoFilePath = SiliCompressor.with(this).compressVideo(recordedVideoPath, getMediaDirectory()); Device screen just goes black and nothing happens with the applcation. Log prints this repeteadly: E/tmessages: Surface frame wait timed out I/MediaCodec: setCodecState state : 1 I/MediaCodec: setCodecState state : 0

I need this fix urgently please suggest.

enesb08 commented 4 years ago

I am also facing this issue after this line of code: String convertedVideoFilePath = SiliCompressor.with(this).compressVideo(recordedVideoPath, getMediaDirectory()); Device screen just goes black and nothing happens with the applcation. Log prints this repeteadly: E/tmessages: Surface frame wait timed out I/MediaCodec: setCodecState state : 1 I/MediaCodec: setCodecState state : 0

I need this fix urgently please suggest.

I dint find solition my question.I m use other library now. I m use now this library. implementation 'com.writingminds:FFmpegAndroid:0.3.2'

surabhiverma1 commented 4 years ago

But this library implementation 'com.writingminds:FFmpegAndroid:0.3.2' is not 64 bit architecture supported. Did you implement any change for same

enesb08 commented 4 years ago

@surabhiverma1
I did not make any changes in the library. When I analyze the Apk, I see that it supports 64bit. It works fine now.İf you want ı can send compress command code for this library.

rajugautam commented 4 years ago

Compression using com.writingminds:FFmpegAndroid:0.3.2 is pretty slow. Is it faster for you? Can you please send your compress command if it works better?

enesb08 commented 4 years ago

Compression using com.writingminds:FFmpegAndroid:0.3.2 is pretty slow. Is it faster for you? Can you please send your compress command if it works better?

İt is my compress command.I hope that will be useful

public static String[] getCompressCommand(String path, String newFileName,String w,String h) { return new String[]{"-y", "-i", path,"-vf", "scale='if(gt(asar,16/9),'"+w+"','"+h+"'iwsar/ih)':'if(gt(asar,16/9),'"+w+"'*ih/iw/sar,'"+h+"')',pad='"+w+"':'"+h+"':(ow-iw)/2:(oh-ih)/2,setsar=1" ,"-c:v", "libx264", "-bufsize", "3968k", "-ac", "1", "-g", "60", "-c:a", "aac", "-b:a", "128k", "-level", "3.0", "-crf", "30", "-preset", "ultrafast", "-strict", "-2", newFileName}; }

abkoradiya commented 4 years ago

Compression using com.writingminds:FFmpegAndroid:0.3.2 is pretty slow. Is it faster for you? Can you please send your compress command if it works better?

İt is my compress command.I hope that will be useful

public static String[] getCompressCommand(String path, String newFileName,String w,String h) { return new String[]{"-y", "-i", path,"-vf", "scale='if(gt(a_sar,16/9),'"+w+"','"+h+"'_iw_sar/ih)':'if(gt(a_sar,16/9),'"+w+"'*ih/iw/sar,'"+h+"')',pad='"+w+"':'"+h+"':(ow-iw)/2:(oh-ih)/2,setsar=1" ,"-c:v", "libx264", "-bufsize", "3968k", "-ac", "1", "-g", "60", "-c:a", "aac", "-b:a", "128k", "-level", "3.0", "-crf", "30", "-preset", "ultrafast", "-strict", "-2", newFileName}; }

Hello, what is 'w' and 'h' is here? and what value you are using?

enesb08 commented 4 years ago

Compression using com.writingminds:FFmpegAndroid:0.3.2 is pretty slow. Is it faster for you? Can you please send your compress command if it works better?

İt is my compress command.I hope that will be useful public static String[] getCompressCommand(String path, String newFileName,String w,String h) { return new String[]{"-y", "-i", path,"-vf", "scale='if(gt(a_sar,16/9),'"+w+"','"+h+"'_iw_sar/ih)':'if(gt(a_sar,16/9),'"+w+"'*ih/iw/sar,'"+h+"')',pad='"+w+"':'"+h+"':(ow-iw)/2:(oh-ih)/2,setsar=1" ,"-c:v", "libx264", "-bufsize", "3968k", "-ac", "1", "-g", "60", "-c:a", "aac", "-b:a", "128k", "-level", "3.0", "-crf", "30", "-preset", "ultrafast", "-strict", "-2", newFileName}; }

Hello, what is 'w' and 'h' is here? and what value you are using?

Hi .w and h values ​​ are Width and height of the video frame image.

`

  MediaMetadataRetriever mRetriever = new MediaMetadataRetriever();
    mRetriever.setDataSource(filePath);
    Bitmap frame = mRetriever.getFrameAtTime();
      int iw = frame.getWidth();
    int ih = frame.getHeight();

    int evenIw= (int) Math.ceil(iw/2)*2;
    int evenIh= (int) Math.ceil(ih/2)*2;

    try {
        ffmpeg.execute( Util.getCompressCommand(filePath,outPath,evenIw+"",evenIh+""), new ExecuteBinaryResponseHandler() {

            @Override
            public void onStart() {

                Log.e("VIDEO","START");

            }

            @Override
            public void onProgress(String message) {
                Log.e("VIDEO","onProgress"+message);

            }

            @Override
            public void onFailure(String message) {
                Log.e("VIDEO","onFailure"+message);

            }

            @Override
            public void onSuccess(String message) {
                Log.e("VIDEO","onSuccess"+message);

            }

            @Override
            public void onFinish() {

            }
        });
    } catch (FFmpegCommandAlreadyRunningException ex) {
        ex.printStackTrace();
    }`
abkoradiya commented 4 years ago

@enes08 enes08What version of ffmpeg you have used? Because I am getting error with same command.

enesb08 commented 4 years ago

@enes08 enes08What version of ffmpeg you have used? Because I am getting error with same command. @abkoradiya I used this library

implementation 'com.writingminds:FFmpegAndroid:0.3.2'