简体   繁体   中英

Make images to video using FFMPEG on android not working

I built ffmpeg 2.5.4 with libx264 and am using these commands but they are giving error...
On previous version of ffmpeg they were working fine...

Here is the command i am using to convert images to video

          String[] ffmpegCommand = {
                    "/data/data/uk.org.humanfocus.hfi/ffmpeg",
                    "-r",
                    Fps,
                    "-i",
                    Environment.getExternalStorageDirectory().getPath()
                            + "/HumanFocus/MarkerFrame/frame%05d.jpg",
                    "-qscale", "0",
                    mFilePathMarker };

Here is my ffmpeg Log

03-06 10:00:12.579: V/asd(10011): ***Input #0, image2, from '/storage/emulated/0/HumanFocus/MarkerFrame/frame%05d.jpg':***
03-06 10:00:12.579: V/asd(10011): ***  Duration: 00:00:02.32, start: 0.000000, bitrate: N/A***
03-06 10:00:12.584: V/asd(10011): ***    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1279x719 [SAR 1:1 DAR 1279:719], 25 fps, 25 tbr, 25 tbn, 25 tbc***
03-06 10:00:12.584: V/asd(10011): ***Please use -q:a or -q:v, -qscale is ambiguous***
03-06 10:00:12.589: V/asd(10011): ***No pixel format specified, yuvj420p for H.264 encoding chosen.***
03-06 10:00:12.589: V/asd(10011): ***Use -pix_fmt yuv420p for compatibility with outdated media players.***
03-06 10:00:12.594: V/asd(10011): ***[libx264 @ 0x52e80] width not divisible by 2 (1279x719)***
03-06 10:00:12.594: V/asd(10011): ***Output #0, mp4, to '/storage/emulated/0/HumanFocus/WPOvideos/TEMP/20150306050004.mp4':***
03-06 10:00:12.594: V/asd(10011): ***    Stream #0:0: Video: h264, none, q=2-31, 128 kb/s, SAR 1:1 DAR 0:0, 11.40 fps***
03-06 10:00:12.594: V/asd(10011): ***    Metadata:***
03-06 10:00:12.594: V/asd(10011): ***      encoder         : Lavc56.13.100 libx264***
03-06 10:00:12.594: V/asd(10011): ***Stream mapping:***
03-06 10:00:12.594: V/asd(10011): ***  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))***
03-06 10:00:12.594: V/asd(10011): ***Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height***

Please help me out...
Where is the issue?

Solution

Change this:

scale=-1:576

To this:

scale=-2:576

Why

Here's the relevant message in console output:

[libx264 @ 0x52e80] width not divisible by 2 (1279x719)

When encoding with libx264, with outputs using YUV 4:2:0 chroma subsampling, the width and height must be divisible by 2.

Try a set of images that has a width and height that are divisible by two. At least, that is what your error log says to try.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM