问题描述:

I'm working with ffmpeg command in android. Now my need is to merge all image and audio files to a single video file. It means image to mp4 and audio to mp4, and finally those mp4's to a single mp4. Both are working separately but I could not merge image and audio mp4 files to a single mp4 file.

Below are the commands I used.

For audio to mp4:

ffmpegCmd = new String[]{"ffmpeg", "-i", inputpath,

"-c:v", "libx264",

"-c:a", "aac",

"-strict", "experimental",

"-shortest", output_path};

For image to mp4:

ffmpegCmd = new String[]{"ffmpeg", "-loop", "1",

"-i", inputpath,

"-s", "640x480",

"-c:v", "libx264",

"-t", "3", outputpath};

Finally merging the two mp4's:

ffmpegCmd = new String[]{"ffmpeg", "-f", "concat",

"-i", filesList,

"-vcodec", "copy",

"-acodec", "copy",

"-strict", "experimental",

"-shortest", tempStr};

相关阅读:
Top