Question

I am playing with video compression by using ffmpeg. I can compress the video e.g. with this line:

String commandStr = "ffmpeg -y -i /sdcard/videokit3/Dani.mp4 -strict experimental -s 320x240-r 30 -aspect 4:3 -ab 48000 -ac 2 -ar 22050 -b 512k /sdcard/videokit3/Dani2.mp4";

In this line the path is hardcoded, so I did

String path = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "videokit3/Dani.mp4";

which results in /mnt/sdcard/videokit3/Dani.mp4

This seems to be different from /sdcard/videokit3/Dani.mp4 so this line runs to error (I see the difference, I just don't get it):

String commandStr = "ffmpeg -y -i " + path + " -strict experimental -s 320x240 -r 30 -ab 48000 -ac 2 -ar 22050 -b 512k /sdcard/videokit3/Dani4.mp4";

Can you help?

Was it helpful?

Solution

The easiest way to get around would be replace the string and trim "/mnt" out before inserting into the statement. The reason why the external SDcard absolute path returns as "mounted" drive is available here on SO: stackoverflow.com/a/5695129/2777098

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top