0

I'm trying to trim an audio file and then merge it with my video file on android.

I can merge them together with the command below

String command[] = {"-i", mOutputFile.getAbsolutePath(), " -i", mOutputAudioFile.getAbsolutePath(), "-c:v", "copy", "-c:a", "aac","-shortest", dest.getAbsolutePath()};

But i need to trim the beginning (half-second for example) of my audio file before (for synchronization issue). So if you can help me with a single command it would be perfect but maybe i can just run two ffmpeg commands successively but i don't know how to do that as well. Thanks!

falary
  • 33
  • 1
  • 8

2 Answers2

0

Apply a seek option to the audio:

String command[] = {"-i", mOutputFile.getAbsolutePath(), " -ss 0.5", " -i", mOutputAudioFile.getAbsolutePath(), "-c:v", "copy", "-c:a", "aac","-shortest", dest.getAbsolutePath()};

This will start the audio feed from 0.5 seconds.

Gyan
  • 85,394
  • 9
  • 169
  • 201
0

ok, i solved the problem, it was just about syntax, i had to write

{"-i", mOutputFile.getAbsolutePath(), "-ss", "0.5", "-i", mOutputAudioFile.getAbsolutePath(), "-c:v", "copy", "-c:a", "aac", "-shortest", dest.getAbsolutePath()};

thanks

falary
  • 33
  • 1
  • 8