question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Video is not compressed

See original GitHub issue

Here is my code: `public class MainActivity extends AppCompatActivity {

private static final String TAG = "Video Compressor";
Button button;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    button = (Button) findViewById(R.id.button);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            File sourcePath = new File("/storage/emulated/0/Video/sample.MP4");
            Log.d(TAG, "onClick: sourcepath==== " +sourcePath);
            Uri sourceURI = Uri.fromFile(sourcePath);
            File desPath = new File("/storage/emulated/0/","");
            Uri desURI = Uri.fromFile(desPath);

            try {
                String path = SiliCompressor.with(getApplicationContext()).compressVideo(sourceURI.toString(), desURI.toString());
                Log.d(TAG, "onClick: gfsdgfsg=== "+ Uri.parse(path.substring(5)));
                File file = new File(path.substring(5));
                FileOutputStream fos = new FileOutputStream(file);
                fos.flush();
                fos.close();

                float length = file.length() / 1024f; // Size in KB
                String value;
                if(length >= 1024)
                    value = length/1024f+" MB";
                else
                    value = length+" KB";
                Log.i("Silicompressor", "Path: "+value);
            } catch (URISyntaxException e) {
                e.printStackTrace();
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    });
}

}`

Here is the log: 08-03 15:19:21.575 5653-5653/com.solo.vinay.videocompression D/Video Compressor: onClick: sourcepath==== /storage/emulated/0/Video/sample.MP4 08-03 15:19:21.615 5653-5653/com.solo.vinay.videocompression W/HTCLOG: use specified tag [MediaMetadataRetriever], func [0]. 08-03 15:19:21.615 5653-5653/com.solo.vinay.videocompression W/HTCLOG: mask=0x18 08-03 15:19:21.685 5653-5653/com.solo.vinay.videocompression E/tmessages: file:/storage/emulated/0/VIDEO_20170803_151921.mp4: open failed: ENOENT (No such file or directory) 08-03 15:19:21.685 5653-5653/com.solo.vinay.videocompression E/tmessages: time = 29 08-03 15:19:21.685 5653-5653/com.solo.vinay.videocompression E/ViratPath: /storage/emulated/0/Video/sample.MP4 08-03 15:19:21.685 5653-5653/com.solo.vinay.videocompression E/ViratPath: file:/storage/emulated/0/VIDEO_20170803_151921.mp4 08-03 15:19:21.685 5653-5653/com.solo.vinay.videocompression E/ViratPath: /storage/emulated/0/Video/sample.MP4 08-03 15:19:21.685 5653-5653/com.solo.vinay.videocompression V/SiliCompressor: Video Conversion Complete 08-03 15:19:21.685 5653-5653/com.solo.vinay.videocompression D/Video Compressor: onClick: gfsdgfsg=== /storage/emulated/0/VIDEO_20170803_151921.mp4 08-03 15:19:21.685 5653-5653/com.solo.vinay.videocompression I/Silicompressor: Path: 0.0 KB

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
josinaldobarbosacommented, Sep 7, 2017

your path does not exist, you must create it after desPath

desPath.mkdirs();

0reactions
Tourenathan-G5organisationcommented, Oct 11, 2018

Do you have this error? which library version are you using?

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Easy Ways to Compress Video Files? (Without Losing Quality!)
1. Download VLC Player here if you do not already have it. Once downloaded, install and open the VLC player. 2. Click Media...
Read more >
3 Easy Ways to Compress Video Files? (Without Losing Quality)
1) Go to veed.io/video-compressor 2) Upload your video 3) Adjust the compression settings 4) Click compress and then download.
Read more >
How to compress a video on iPhone, Android, Windows, and ...
Video compression is the process of reducing the overall file size of a video file or clip. This is done by using a...
Read more >
How to Compress a Video and Reduce the File Size
1. Compress a Video by Zipping It · To compress multiple videos, put them all in a single folder on your PC. ·...
Read more >
How to Compress a Video File for E-mail | Parallels
The most common way to compress a video is to convert it into a zip file. The file will be reduced in size,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found