如何使用 ffmpeg 将水印的宽度和高度设置为与视频的宽度和高度相同?

如何使用 ffmpeg 将水印的宽度和高度设置为与视频的宽度和高度相同?

我想将水印的宽度和高度设置为与视频的宽度和高度相同。

String[] cmd={"-i",margefilePath,"-ignore_loop","0","-i","/storage/emulated/0/Download/light2.gif","-i","/storage/emulated/0/Download/04 - Aa To Sahi - DownloadMing.LA.mp3","-filter_complex","[1:v]format=yuva444p,scale="+800+":"+720+",setsar=1,rotate="+angle+":c=black@0:ow=rotw("+angle+"):oh=roth("+angle+") [rotate];[0:v][rotate] overlay=0:0:shortest=1[v]","-map","[v]","-map","2:a:0","-c:a","aac","-shortest","-y","/storage/emulated/0/Movies/video_gif_light2.mp4"};

如果我尝试使用常量值进行缩放,它并不总是有效。请告诉我如何动态缩放水印?

答案1

使用

String[] cmd={"-i",margefilePath,"-ignore_loop","0","-i","/storage/emulated/0/Download/light2.gif","-i","/storage/emulated/0/Download/04 - Aa To Sahi - DownloadMing.LA.mp3","-filter_complex","[1:v][0:v]scale2ref[2nd][ref];[2nd]format=yuva444p[2nd];[ref][2nd]overlay=0:0:shortest=1[v]","-map","[v]","-map","2:a:0","-c:a","aac","-shortest","-y","/storage/emulated/0/Movies/video_gif_light22.mp4"};

相关内容