본문 바로가기

카테고리 없음

c++에서 mp4파일을 ffmpeg를 이용해 wav파일 추출하기

해당 내용을 main함수에 넣어보자

string path(argv[2]);
std::string outputFilePath = "output_audio.wav";
std::string command = "ffmpeg -y -i "+path+" -vn -acodec pcm_s16le -ar 44100 -ac 2 -f wav "+ outputFilePath;

int result = system(command.c_str());

if (result == 0) {
printf("Extraction successful.");
}
else {
printf("Extraction failed.");
}
return 0;