Last active
October 11, 2022 20:15
-
-
Save ofTheo/0784930c829d8cae8e1dca1f618227a9 to your computer and use it in GitHub Desktop.
pseudo code for adding audio to a video file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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