FFCreator
FFCreator copied to clipboard
M1 Mac 下无法正确生成内嵌视频
你好,在 M1 Pro 的 Mac 电脑下,按以下代码,能生成视频没报错。但里面通过 FFVideo
引入的视频是空白的,有什么办法可以解决呢?
同样的代码,在 windows 和 intel mac 都正常。
依赖版本:
- ffcreator - 6.3.3
- ffmpeg - 4.4.1
- node - 16.13.0
const { FFScene, FFCreator, FFVideo, FFText } = require('ffcreator')
const path = require('path')
const width = 540 * 2
const height = 960 * 2
const cacheDir = path.join(__dirname, './cache/')
const outputDir = path.join(__dirname, './output/')
const outputFilePath = outputDir + `output.mp4`
const creator = new FFCreator({
cacheDir, // 缓存目录
outputDir, // 输出目录
width, // 影片宽
height, // 影片高
fps: 30, // fps
threads: 20, // 多线程(伪造)并行渲染
defaultOutputOptions: null, // ffmpeg输出选项配置
})
const scene = new FFScene()
scene.setBgColor('#000000') // 设置背景色
scene.setDuration(20) // 设置停留时长
const newText = new FFText({
text: '这是一个标题',
x: width / 2,
y: 400,
color: '#ffffff',
})
newText.setColor('#ffffff')
scene.addChild(newText)
const video = new FFVideo({
path: path.join(__dirname, './videos/output.mp4'),
width,
height: 600,
x: width / 2,
y: height / 2,
})
video.setAudio(false)
video.setLoop(true)
scene.addChild(video)
creator.addChild(scene)
scene.start()
creator.start()
creator.output(outputFilePath)
creator.on('complete', res => console.log(res))
creator.on('error', err => console.log(err))
creator.on('progress', e => {
console.log(`FFCreator progress: ${(e.percent * 100) >> 0}% - output`)
})
我的电脑是MacBook pro max 合成examples/image.js没有背景图也没有报错
Same issue :(
Please upload your project
When I generate the video.js from the examples project it doesn't display the video but the sound from the video is there.
When I launch the example ( Number 8 ). This is the log:
[FF] FFVideo Audio preProcessing completed!
[FF] FFVideo Video preProcessing start: ffmpeg -i /Projects/FFCreator/examples/assets/video/video1.mp4 -y -loglevel info -pix_fmt rgba -start_number 0 -vf fps=30 -qscale:v 2 -ss 00:00:03 -to 00:00:11 /Projects/FFCreator/examples/cache/g8ctl1qp1jlejnas/video_1_%d.jpg
[FF] FFVideo Video preProcessing completed: images:240-/Projects/FFCreator/examples/cache/g8ctl1qp1jlejnas/video_1_%d.jpg
[FF] Synthesis synthesis start: ffmpeg -f rawvideo -framerate 30 -s 800x600 -vcodec rawvideo -pixel_format bgra -video_size 800x600 -i pipe:0 -i /Projects/FFCreator/examples/cache/g8ctl1qp1jlejnas/video_1_audio.mp3 -y -filter_complex [1]adelay=0|0[audio0];[audio0]amix=1 -hide_banner -map_metadata -1 -map_chapters -1 -c:v libx264 -profile:v main -preset medium -crf 20 -movflags faststart -pix_fmt yuv420p -r 30 -c:a aac -t 11.5 /Projects/FFCreator/examples/output/0ir70yx5vysctsag.mp4
... (I remove the progress log)
[FF] renderFrame current frame - 342
[FF] renderFrame current frame - 343
[FF] renderFrame current frame - 344
FFCreator progress: 100%
[FF] Synthesis synthesis progress: 100% done.
------------------------------------------------------
Perf 0 2901 31106512 70729728 331726848 43.9% 41.7%
------------------------------------------------------
FFCreator completed:
USEAGE: time 2901 memory 31120840 70729728 331759616 43.9% cpu 41.7%
PATH: /ProjectsFFCreator/examples/output/0ir70yx5vysctsag.mp4
arch -arm64 brew install pkg-config cairo pango jpeg giflib librsvg