| | |
| | | newFileName2 // 输出文件名 |
| | | ); |
| | | } else if ("2".equals(scene.getHasPerson())) { |
| | | //cover1放在substring1的,让cover1挡住substring1,背景图ppt内容和人像视频不变,只是层级关系修改一下 |
| | | // 当没有人像时,视频放在 cover 的下层 |
| | | builder = new ProcessBuilder( |
| | | "ffmpeg", |
| | | "-i", cover1, // 背景图 |
| | | "-i", cover1, // 背景图 1 |
| | | "-i", substring1, // 视频 |
| | | "-i", cover1, // 背景图 2 |
| | | "-i", cover, // PPT内容 |
| | | "-i", substring1, // 人像视频 |
| | | "-filter_complex", |
| | | "[0:v]scale=" + Math.round(scene.getBackground().getWidth()) + ":" + Math.round(scene.getBackground().getHeight()) + "[bg];" + |
| | | "[1:v]scale=" + Math.round(scene.getComponents().get(1).getWidth()) + ":" + Math.round(scene.getComponents().get(1).getHeight()) + "[v1];" + |
| | | "[bg][v1]overlay=x=" + Math.round(scene.getComponents().get(1).getMarginLeft()) + ":y=" + Math.round(scene.getComponents().get(1).getTop()) + "[img];" + |
| | | "[2:v]scale=" + Math.round(scene.getComponents().get(0).getWidth()) + ":" + Math.round(scene.getComponents().get(0).getHeight()) + "[v2];" + |
| | | "[v2][img]overlay=x=" + Math.round(scene.getComponents().get(0).getMarginLeft()) + ":y=" + Math.round(scene.getComponents().get(0).getTop()), |
| | | newFileName2 |
| | | "[0:v]scale=" + Math.round(scene.getBackground().getWidth()) + ":" + Math.round(scene.getBackground().getHeight()) + "[bg1];" + |
| | | "[1:v]scale=" + Math.round(scene.getComponents().get(0).getWidth()) + ":" + Math.round(scene.getComponents().get(0).getHeight()) + "[v1];" + |
| | | "[bg1][v1]overlay=x=" + Math.round(scene.getComponents().get(0).getMarginLeft()) + ":y=" + Math.round(scene.getComponents().get(0).getTop()) + "[img1];" + |
| | | "[2:v]scale=" + Math.round(scene.getBackground().getWidth()) + ":" + Math.round(scene.getBackground().getHeight()) + "[bg2];" + |
| | | "[img1][bg2]overlay=shortest=1[v2];" + |
| | | "[3:v]scale=" + Math.round(scene.getComponents().get(1).getWidth()) + ":" + Math.round(scene.getComponents().get(1).getHeight()) + "[v3];" + |
| | | "[v2][v3]overlay=x=" + Math.round(scene.getComponents().get(1).getMarginLeft()) + ":y=" + Math.round(scene.getComponents().get(1).getTop()), |
| | | newFileName2 // 输出文件名 |
| | | ); |
| | | } |
| | | System.out.println(newFileName2); |