Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
pseudo code for adding audio to a video file
float audioDuration = (1.0/1000.0) * (float)(lastTimestampMillis-firstTimestampMillis);
string audioCommands;
if( audioPath.length() ){
audioCommands = " -ss "+ofToString(timelineOffset, 3)+" -t " + ofToString(audioDuration, 3)+ " -i "+ ofToDataPath(audioPath, true);
}
string addAudio = ffmpeg + " -i "+ofToDataPath(savefile, false)+" "+ audioCommands +" -codec copy -shortest " + ofToDataPath(ofFilePath::removeExt( savefile ) + "withAudio." + ofFilePath::getFileExt(savefile), false);
system(addAudio.c_str());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment