在 Android 上使用 Ffmpeg 从与音频文件合并的单个图像制作视频,它可以工作,但输出视频不寻找任何时间戳
ex - 总是从 0:00 开始,在寻找前面的视频时,它只是从头开始重新启动整个视频。
我使用的命令是 -
-y -framerate 30 -i "+ImagePath+" -i "+AudioPath+" -vsync vfr -c:v libx264 -codec:a copy -pix_fmt yuv420p -crf 23 "+OutputVideoPath
这可能是由于单帧吗? (视频中的一张图片)
如果是这样,可以使用什么将单个图像转换为可搜索的视频。
最佳答案
此命令将用于制作可搜索的 MP4(使用来自图像文件和 MP3 音频的输入)。
ffmpeg -y -i AUDIO.file -f image2 -loop 1 -r 2 -i IMAGE.file -shortest -c:a copy -c:v libx264 -crf 18 -framerate 30 -preset veryfast -movflags +faststart OUTPUT.mp4
只需更换
AUDIO.file
和 IMAGE.file
和 OUTPUT.mp4
使用您的自定义文件名。在你的 Android 代码中试试这个:
-y -i "+AudioPath+" -f image2 -loop 1 -r 2 -i "+ImagePath+" -shortest -c:a copy -c:v libx264 -crf 18 -framerate 30 -preset veryfast -movflags +faststart "+OutputVideoPath+"
尝试像这样设置您的代码:
"-y -i "+AudioPath+" -f image2 -loop 1 -r 2 -i "+ImagePath+" -shortest -c:a copy -c:v libx264 -crf 18 -framerate 30 -preset veryfast -movflags +faststart "+OutputVideoPath
关于android - ffmpeg 使用单个图像和音频文件,但输出视频不可搜索(即使提前搜索也只能从 0 :00, 恢复),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46032646/