android 中的 Ffmpeg 将图像转换为视频错误

Ffmpeg convert images to video error in android

我的主要目标是使用一系列图像创建视频文件。然后我使用 Roman10 Tutorial.

将 Ffmpeg 库构建为 android

创建 android 应用程序时,我将 .so 文件和 ffmpeg 文件添加到 assert 文件夹。

然后执行命令,

ffmpeg -f image2 -i img%d.jpg a.mov

然后在我的LogCat,

中显示以下错误

04-20 09:47:16.133: V/MJPEG_FFMPEG(1095): * libavutil 55. 17.103 / 55. 17.103*** 04-20 09:47:16.133: V/MJPEG_FFMPEG(1095): * libavcodec 57. 24.102 / 57. 24.102*** 04-20 09:47:16.133: V/MJPEG_FFMPEG(1095): * libavformat 57. 25.100 / 57. 25.100*** 04-20 09:47:16.133: V/MJPEG_FFMPEG(1095): * libavfilter 6. 31.100 / 6. 31.100*** 04-20 09:47:16.133: V/MJPEG_FFMPEG(1095): * libswscale 4. 0.100 / 4. 0.100*** 04-20 09:47:16.133: V/MJPEG_FFMPEG(1095): * libswresample 2. 0.101 / 2. 0.101*** 04-20 09:47:16.143: V/MJPEG_FFMPEG(1095): * [mjpeg @ 0x1fffc0] bits 222 is invalid*** 04-20 09:47:16.163: V/MJPEG_FFMPEG(1095): * Last message repeated 25 times*** 04-20 09:47:16.163: V/MJPEG_FFMPEG(1095): * [image2 @ 0x1ff180] decoding for stream 0 failed*** 04-20 09:47:16.163: V/MJPEG_FFMPEG(1095): * [image2 @ 0x1ff180] Could not find codec parameters for stream 0 (Video: mjpeg, none(bt470bg/unknown/unknown)): unspecified size***

04-20 09:47:16.163: V/MJPEG_FFMPEG(1095): *nConsider increasing the value for the 'analyzeduration' and 'probesize' options***

04-20 09:47:16.163: V/MJPEG_FFMPEG(1095): */storage/emulated/0/com.example.createvideo/frame_%05d.jpg: could not find codec parameters***

04-20 09:47:16.163: V/MJPEG_FFMPEG(1095): *Input #0, image2, from '/storage/emulated/0/com.example.createvideo/frame_%05d.jpg':***

04-20 09:47:16.163: V/MJPEG_FFMPEG(1095): * Duration: 00:00:01.04, start: 0.000000, bitrate: N/A***

04-20 09:47:16.163: V/MJPEG_FFMPEG(1095): * Stream #0:0: Video: mjpeg, none(bt470bg/unknown/unknown), 25 fps, 25 tbr, 25 tbn, 25 tbc***

04-20 09:47:16.163: V/MJPEG_FFMPEG(1095): *[buffer @ 0x1ff020] Unable to parse option value "0x0" as image size***

04-20 09:47:16.163: V/MJPEG_FFMPEG(1095): *[buffer @ 0x1ff020] Unable to parse option value "-1" as pixel format***

04-20 09:47:16.163: V/MJPEG_FFMPEG(1095): *[buffer @ 0x1ff020] Unable to parse option value "0x0" as image size***

04-20 09:47:16.163: V/MJPEG_FFMPEG(1095): *[buffer @ 0x1ff020] Error setting option video_size to value 0x0.***

04-20 09:47:16.163: V/MJPEG_FFMPEG(1095): *[graph 0 input from stream 0:0 @ 0x1ff100] Error applying options to the filter.***

04-20 09:47:16.163: V/MJPEG_FFMPEG(1095): *Error opening filters!***

04-20 09:47:16.163: V/MJPEG_FFMPEG(1095): *Ending FFMPEG***

我设置了 -analyzeduration 和 -probesize,但显示的 LogCat 相同。

请有人帮我做这件事。

谢谢你的时间..

您没有针对要放置它们的容器对图像进行编码。对于 mov 文件,您可以使用 qtrle 对图像进行编码。

所以试试这个命令:

ffmpeg -framerate 1 -f image2 -i img%1d.png -r 25 -vcodec qtrle output.mov