Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

视频加水印后没有声音了。 #27

Open
712163 opened this issue Sep 4, 2022 · 2 comments
Open

视频加水印后没有声音了。 #27

712163 opened this issue Sep 4, 2022 · 2 comments

Comments

@712163
Copy link

712163 commented Sep 4, 2022

FFCreator start
single: ffmpeg -loop 1 -i c:\NIJI\project\cms\EmailCMS\node_modules\ffcreatorlite\lib\assets\blank.png -i C:/Users/71216/OneDrive/Desktop/files/外访云谷.mp4 -loop 1 -i C:/Users/71216/OneDrive/Desktop/files/filesLOGO视频.png -y -filter_complex color=c=#ffffff:d=10:size=1920*1080[background2-0];[background2-0][0:v]overlay=x=-10:y=0[image1-1];[image1-1][1:v]overlay=x=0:y=0[video1-1];[video1-1][2:v]overlay=x=0:y=0[image4-1] -map [image4-1] -r 24 -threads 2 -t 10 -hide_banner -map_metadata -1 -map_chapters -1 -c:v libx264 -profile:v main -preset medium -crf 20 -movflags faststart -pix_fmt yuv420p -map 0 c:\NIJI\project\cms\EmailCMS/temp/ou5fu8jqpxmndnq6/scene1.mp4

single: ffmpeg -loop 1 -i c:\NIJI\project\cms\EmailCMS\node_modules\ffcreatorlite\lib\assets\blank.png -loop 1 -i C:/Users/71216/OneDrive/Desktop/files/业务表.png -y -filter_complex color=c=#000000:d=3:size=1920*1080[background4-0];[background4-0][0:v]overlay=x=-10:y=0[image2-1];[image2-1][1:v]overlay=x=0:y=0[image5-1] -map [image5-1] -r 24 -threads 2 -t 3 -hide_banner -map_metadata -1 -map_chapters -1 -c:v libx264 -profile:v main -preset medium -crf 20 -movflags faststart -pix_fmt yuv420p -map 0 c:\NIJI\project\cms\EmailCMS/temp/2uenhoyn2tlhs8hr/scene2.mp4

single: ffmpeg -loop 1 -i c:\NIJI\project\cms\EmailCMS\node_modules\ffcreatorlite\lib\assets\blank.png -loop 1 -i C:/Users/71216/OneDrive/Desktop/files/尾图.png -y -filter_complex color=c=#000000:d=2:size=1920*1080[background6-0];[background6-0][0:v]overlay=x=-10:y=0[image3-1];[image3-1][1:v]overlay=x=0:y=0[image6-1] -map [image6-1] -r 24 -threads 2 -t 2 -hide_banner -map_metadata -1 -map_chapters -1 -c:v libx264 -profile:v main -preset medium -crf 20 -movflags faststart -pix_fmt yuv420p -map 0 c:\NIJI\project\cms\EmailCMS/temp/tv33r1wgixu3unj8/scene3.mp4

ffmpeg -i c:\NIJI\project\cms\EmailCMS/temp/ou5fu8jqpxmndnq6/scene1.mp4 -i c:\NIJI\project\cms\EmailCMS/temp/2uenhoyn2tlhs8hr/scene2.mp4 -i c:\NIJI\project\cms\EmailCMS/temp/tv33r1wgixu3unj8/scene3.mp4 -y -filter_complex [0:v][1:v]xfade=transition=rectcrop:duration=1.5:offset=8.5[scene-0];[scene-0][2:v]xfade=transition=wipedown:duration=1.5:offset=10[scene-1] -map [scene-1] -hide_banner -map_metadata -1 -map_chapters -1 -c copy -c:v libx264 -profile:v main -preset medium -crf 20 -movflags faststart -pix_fmt yuv420p -r 24 wj.mp4

@712163
Copy link
Author

712163 commented Sep 4, 2022

const { FFCreatorCenter, FFScene, FFImage, FFVideo, FFText, FFCreator } = require(__dirname + '/node_modules/ffcreatorlite');

async function init() {

FFCreator.setFFmpegPath(systemConfig.systemPath + '/libs/ffmpeg-master-latest-win64-gpl-shared/bin/ffmpeg.exe');
const creator = new FFCreator({
    cacheDir: systemConfig.systemPath + '/temp/', // 缓存目录
    outputDir: systemConfig.systemPath + '/temp/', // 输出目录
    output: 'wj.mp4', // 输出文件名(FFCreatorCenter中可以不设)
    width: 1920, // 影片宽
    height: 1080, // 影片高
    // cover: 'a.jpg', // 设置封面
    // audioLoop: true, // 音乐循环
    fps: 24, // fps
    threads: 2, // 多线程(伪造)并行渲染
    debug: true, // 开启测试模式
    log: true,
    defaultOutputOptions: null, // ffmpeg输出选项配置
});

// create FFScene
const scene1 = new FFScene();
scene1.setBgColor('#ffffff'); // 设置背景色
scene1.setDuration(10); // 设置停留时长
scene1.setTransition('rectcrop', 1.5); // 设置过渡动画(类型, 时间)
scene1.addAudio('C:/Users/71216/OneDrive/Desktop/files/1.mp3');

const scene2 = new FFScene();
scene2.setBgColor('#000000');
scene2.setDuration(3); // 设置停留时长
scene2.setTransition('wipedown', 1.5); // 设置过渡动画(类型, 时间)

const scene3 = new FFScene();
scene3.setBgColor('#000000');
scene3.setDuration(2); // 设置停留时长

// scene1
// setAudio、setTimes LITE版本不存在
const video1 = new FFVideo({
    path: 'C:/Users/71216/OneDrive/Desktop/files/外访云谷.mp4',
    x: 0,
    y: 0,
    width: 1920,
    height: 1080,
});
scene1.addChild(video1);

// 添加LOGO
const logoImg = new FFImage({ path: 'C:/Users/71216/OneDrive/Desktop/files/filesLOGO视频.png' });
logoImg.setXY(0, 0); // 设置位置
logoImg.setWH(1920, 1080); // 设置宽高
logoImg.addEffect('slideInDown', 2, 2);
scene1.addChild(logoImg);

// scene2
const img2 = new FFImage({ path: 'C:/Users/71216/OneDrive/Desktop/files/业务表.png' });
img2.setXY(0, 0); // 设置位置
img2.setWH(1920, 1080); // 设置宽高
scene2.addChild(img2);

// scene3
const img3 = new FFImage({ path: 'C:/Users/71216/OneDrive/Desktop/files/尾图.png' });
img3.setXY(0, 0); // 设置位置
img3.setWH(1920, 1080); // 设置宽高
scene3.addChild(img3);

creator.addChild(scene1);
creator.addChild(scene2);
creator.addChild(scene3);
// creator.addAudio(audio);
creator.start();
creator.openLog();

creator.on('start', () => {
    console.log(`FFCreator start`);
});
creator.on('error', e => {
    console.log(`FFCreator error: ${JSON.stringify(e)}`);
});
creator.on('progress', e => {
    // console.log(console.log(`FFCreator progress: ${e.state} ${(e.percent * 100) >> 0}%`));
});
creator.on('complete', e => {
    console.log(console.log(`FFCreator completed: \n USEAGE: ${e.useage} \n PATH: ${e.output} `));
});

}
init().then(console.log('test.js 执行完毕'));

@712163
Copy link
Author

712163 commented Sep 4, 2022

场景加不上背景音乐 scene1.addAudio('C:/Users/71216/OneDrive/Desktop/files/1.mp3');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant