Android: ffmpeg with filenames containing spaces

后端 未结 2 1542
一个人的身影
一个人的身影 2021-01-26 00:49

I want to execute ffmpeg from an Android app, very much as described here: Using FFmpeg with Android-NDK.

Executing the following commands work fine:

Pro         


        
相关标签:
2条回答
  • 2021-01-26 01:30

    Wild guess , but you may want the java process to pass "\ " read "backslash space" to the underlying OS when you want ffmpeg to open a file with a name containing a space.

    Its not what the java does with the string fileName. Its what the underlying OS and ffmpeg process receives that it will use as 'filename'. There you want "foo bar.input" to be

    "foo\ bar.input"

    So, the underlying expression "ffmpeg -i foo\ bar.input" should work.

    you just need to figure out how to construct your java strings so that the process feeds the above expression to the NDK / process layer running the "ffmpeg" command.

    more here

    0 讨论(0)
  • 2021-01-26 01:39

    I finally got it. I forgot one possibility, and exactly this one is working:

    Process p = Runtime.getRuntime().exec(new String[]{"/data/data/yourpackagename/ffmpeg", "-i", "in space file.mp4", "outfile.mp4"); //OK
    
    0 讨论(0)
提交回复
热议问题