使用 FFMpeg 命令组合多个 filter_complex 和叠加函数
Combine multiple filter_complex and overlay functions with FFMpeg Commands
我无法将 ffmpeg 中的这 4 个通道合并到一个进程中。
第一个
exec("$this->ffmpeg -i ".storage_path('/app/public_html/uploads/job.mp4')." -codec:a libmp3lame -b:a 128k -vf scale=".$res_dimension->res_width."x".$res_dimension->res_height.",setsar=1:1 ".storage_path('2.mp4'));
第二
exec("$this->ffmpeg -i ".storage_path($original_file_path)." -codec:a libmp3lame -b:a 128k -vf scale=".$res_dimension->res_width."x".$res_dimension->res_height.",setsar=1:1 ".storage_path('3.mp4'));
第三
exec("$this->ffmpeg -i ".storage_path('3.mp4')." -i ".storage_path('/app/public_html/uploads/images/index2.png')." -filter_complex 'overlay=20:20' ".storage_path('4.mp4'));
第四
exec("$this->ffmpeg -i ".storage_path('2.mp4')." -i ".storage_path('3.mp4')." -filter_complex '[0:v] [0:a] [1:v] [1:a] concat=n=2:v=1:a=1 [v] [a]' -map '[v]' -map '[a]' ".storage_path('out4.mp4'));
你的未定义变量让人很难理解你想要什么。实际执行的 ffmpeg 命令会更容易理解。但据我所知,您想做这样的事情:
ffmpeg -i input0.mp4 -i input1.mp4 -i image.png -filter_complex "[0:v]scale=1280:720,setsar=1[v0];[1:v]scale=1280:720,setsar=1[bg];[bg][2]overlay=20:20[v1];[v0][0:a][v1][1:a]concat=n=2:v=1:a=1" output.mp4
我无法将 ffmpeg 中的这 4 个通道合并到一个进程中。
第一个
exec("$this->ffmpeg -i ".storage_path('/app/public_html/uploads/job.mp4')." -codec:a libmp3lame -b:a 128k -vf scale=".$res_dimension->res_width."x".$res_dimension->res_height.",setsar=1:1 ".storage_path('2.mp4'));
第二
exec("$this->ffmpeg -i ".storage_path($original_file_path)." -codec:a libmp3lame -b:a 128k -vf scale=".$res_dimension->res_width."x".$res_dimension->res_height.",setsar=1:1 ".storage_path('3.mp4'));
第三
exec("$this->ffmpeg -i ".storage_path('3.mp4')." -i ".storage_path('/app/public_html/uploads/images/index2.png')." -filter_complex 'overlay=20:20' ".storage_path('4.mp4'));
第四
exec("$this->ffmpeg -i ".storage_path('2.mp4')." -i ".storage_path('3.mp4')." -filter_complex '[0:v] [0:a] [1:v] [1:a] concat=n=2:v=1:a=1 [v] [a]' -map '[v]' -map '[a]' ".storage_path('out4.mp4'));
你的未定义变量让人很难理解你想要什么。实际执行的 ffmpeg 命令会更容易理解。但据我所知,您想做这样的事情:
ffmpeg -i input0.mp4 -i input1.mp4 -i image.png -filter_complex "[0:v]scale=1280:720,setsar=1[v0];[1:v]scale=1280:720,setsar=1[bg];[bg][2]overlay=20:20[v1];[v0][0:a][v1][1:a]concat=n=2:v=1:a=1" output.mp4