您好iam使用以下c ++代码创建ffmpeg命令。当我使用linux popen在bash中运行此命令时,会发生以下错误。如果我将命令直接放在bash中,它可以正常工作,并且不会提供任何其他命令。请帮我弄清楚原因。
生成命令的C ++代码:
const string VideoCreator::GetFFMPEG_Silent_Audio_Merge_command()
{
stringstream command;
command << FFMPEG_BINARY << " -nostdin -loglevel error -y -threads 0 -f concat -safe 0 -i <(echo file /home/ec2-user/videoData/DnXptC4ld8/FADING_OUT_VOLUP_Blrt_Decrypt_1ed5c4d569d8a1f23428b65217f65eaf_audio.m4a; echo file /home/ec2-user/videocreation/temp/silence.m4a) -c copy " << _outputAudioWithSilence;// << " 2> " << _ffmpeg_log_file;
std::cout << "\n Command = " << command.str() << "\n";
return command.str();
}
Bash错误:
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `/opt/ffmpeg/ffmpeg -nostdin -loglevel error -y -threads 0 -f concat -safe 0 -i <(echo file /home/ec2-user/videoData/DnXptC4ld8/FADING_OUT_VOLUP_Blrt_Decrypt_1ed5c4d569d8a1f23428b65217f65eaf_audio.m4a; echo file /home/ec2-user/videocreation/temp/silence.m4a) -c copy /home/ec2-user/videoData/DnXptC4ld8/WITH_SILENCE_FADING_OUT_VOLUP_Blrt_Decrypt_1ed5c4d569d8a1f23428b65217f65eaf_audio.m4a'