0

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?

erdomester
  • 11,789
  • 32
  • 132
  • 234

1 Answers1

0

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

Community
  • 1
  • 1
display name
  • 4,165
  • 2
  • 27
  • 52
  • I thought about that but what's the guarantee it will work on all devices? – erdomester Apr 06 '14 at 13:03
  • It may not depending on the manufacturer and their implementation of "external storage". When I use ffmpeg, I temporarily make a copy of the video to a folder my program created and work from there. Hope this helps. – display name Apr 06 '14 at 13:43