Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling spaces in filenames of ffmpeg command #16

Open
bkjbkjbnkj687698698 opened this issue Aug 3, 2015 · 0 comments
Open

Handling spaces in filenames of ffmpeg command #16

bkjbkjbnkj687698698 opened this issue Aug 3, 2015 · 0 comments

Comments

@bkjbkjbnkj687698698
Copy link

I am using below ffmpeg command to cut videos.It works fine for video file names which doesn't have spaces but didn't worked for filenames having spaces..

execFFmpegBinary("-i " + path + " -ss " + startMs / 1000 + " -to " + endMs / 1000 + " -strict -2 -async 1 " + dest.getAbsolutePath());

where path is the path of original video.

startMs is the initial time of video form where you want to cut(start time of cropped video)

endMs is the time of video upto which you want to cut(end time of cropped video)

dest is the path where you want to save the cut/cropped video

The problem is with source path(path).I have seen this answer.But here i don't know the complete path since I am fetching paths of all the videos from storage. I need to handle spaces in filenames.
For resolving that i tried using string formatter as shown in below code .But with that it didn't worked in both cases.Where am i going wrong and how can i resolve the issue?

String command = String.format("-i \"%s\" -ss %d -to %d -strict -2 -async 1 \"%s\" ",path,startMs / 1000 , endMs / 1000, dest.getAbsolutePath());
execFFmpegBinary(command);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant