打开编码器时出错 - ffmpeg android(ffmpeg命令错误)

时间:2018-06-12 09:32:11

标签: android kotlin android-ffmpeg

我一直在研究android-ffmpeg将图像转换成视频,我找到了我正在寻找的代码(下面的链接),我试图执行这个命令

val cmd5 = arrayOf("-analyzeduration", "1M", "-probesize", "1M", "-y", "-framerate", "1/3.79", "-i", Utils.outputPath + "image%d.jpg", "-i", audio!!.path, "-c:v", "libx264", "-tune", "stillimage", "-c:a", "aac", "-strict", "experimental", "-b:a", "192k", "-pix_fmt", "yuv420p", "-shortest", outputLocation.path)

我说错误

Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

任何人都可以帮助我

我已从here -> KotlinFFmpeg获取代码,代码段来自here -> MovieMaker.kt,请提前解决,请提前解决

这是日志

    2018-06-12 18:22:24.000 25364-25664/photo.video.maker D/FFmpeg: Running publishing updates method
2018-06-12 18:22:24.096 25364-25364/photo.video.maker W/System.err: java.io.IOException: ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:   built with gcc 4.8 (GCC)
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:   configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:   libavutil      55. 17.103 / 55. 17.103
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:   libavcodec     57. 24.102 / 57. 24.102
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:   libavformat    57. 25.100 / 57. 25.100
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:   libavdevice    57.  0.101 / 57.  0.101
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:   libavfilter     6. 31.100 /  6. 31.100
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:   libswscale      4.  0.100 /  4.  0.100
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:   libswresample   2.  0.101 /  2.  0.101
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:   libpostproc    54.  0.100 / 54.  0.100
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err: [mjpeg @ 0xf193d000] Changing bps to 8
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err: Input #0, image2, from '/storage/emulated/0/Photo Video Maker/image%d.jpg':
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:   Duration: 00:02:35.39, start: 0.000000, bitrate: N/A
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1440x1919 [SAR 1:1 DAR 1440:1919], 0.26 tbr, 0.26 tbn, 0.26 tbc
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err: [mp3 @ 0xf192d600] Skipping 0 bytes of junk at 61264.
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err: [mjpeg @ 0xf193dc00] Changing bps to 8
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err: Input #1, mp3, from '/data/user/0/photo.video.maker/files/audio2.mp3':
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:   Metadata:
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     album_artist    : Various Artists
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     AccurateRipDiscID: 018-002fb7fe-0279b2d7-47111512-2
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     AccurateRipResult: AccurateRip: Accurate (confidence 10)   [0A38F342]
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     title           : Morning
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     encoded_by      : dBpoweramp Release 14.4
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     publisher       : EMI Classics
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     composer        : Edvard Grieg
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     TMED            : CD (Lossless)
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     genre           : Classical
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     compilation     : 1
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     album           : The Most Relaxing Classical Album in the World...Ever!
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     track           : 2/18
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     disc            : 1/2
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     artist          : Edvard Grieg
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     Encoder         : Lame 3.99.5
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     UPC             : 024356665027
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     date            : 1999
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:   Duration: 00:04:18.04, start: 0.025056, bitrate: 321 kb/s
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 320 kb/s
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     Metadata:
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:       encoder         : LAME3.99r
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     Stream #1:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 747x750 [SAR 1:1 DAR 249:250], 90k tbr, 90k tbn, 90k tbc
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     Metadata:
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:       comment         : Cover (front)
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err: [swscaler @ 0xf1125000] deprecated pixel format used, make sure you did set range correctly
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err: [libx264 @ 0xf193ec00] height not divisible by 2 (1440x1919)
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err: Output #0, mp4, to '/storage/emulated/0/Photo Video Maker/video/movie_1528807939616.mp4':
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     Stream #0:0: Video: h264, none, q=2-31, 128 kb/s, SAR 1:1 DAR 0:0, 0.26 fps
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     Metadata:
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:       encoder         : Lavc57.24.102 libx264
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     Stream #0:1: Audio: aac, 0 channels, 128 kb/s
2018-06-12 18:22:24.097 25364-25364/photo.video.maker W/System.err:     Metadata:
2018-06-12 18:22:24.098 25364-25364/photo.video.maker W/System.err:       encoder         : Lavc57.24.102 aac
2018-06-12 18:22:24.098 25364-25364/photo.video.maker W/System.err: Stream mapping:
2018-06-12 18:22:24.098 25364-25364/photo.video.maker W/System.err:   Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
2018-06-12 18:22:24.098 25364-25364/photo.video.maker W/System.err:   Stream #1:0 -> #0:1 (mp3 (native) -> aac (native))
2018-06-12 18:22:24.098 25364-25364/photo.video.maker W/System.err: Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
2018-06-12 18:22:24.098 25364-25364/photo.video.maker W/System.err:     at photo.video.maker.tools.video.MovieMaker$convert$1.onFailure(MovieMaker.kt:78)
2018-06-12 18:22:24.098 25364-25364/photo.video.maker W/System.err:     at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.onPostExecute(FFmpegExecuteAsyncTask.java:70)
2018-06-12 18:22:24.098 25364-25364/photo.video.maker W/System.err:     at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.onPostExecute(FFmpegExecuteAsyncTask.java:10)
2018-06-12 18:22:24.098 25364-25364/photo.video.maker W/System.err:     at android.os.AsyncTask.finish(AsyncTask.java:695)
2018-06-12 18:22:24.098 25364-25364/photo.video.maker W/System.err:     at android.os.AsyncTask.-wrap1(Unknown Source:0)
2018-06-12 18:22:24.098 25364-25364/photo.video.maker W/System.err:     at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:712)
2018-06-12 18:22:24.098 25364-25364/photo.video.maker W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
2018-06-12 18:22:24.098 25364-25364/photo.video.maker W/System.err:     at android.os.Looper.loop(Looper.java:164)
2018-06-12 18:22:24.098 25364-25364/photo.video.maker W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6494)
2018-06-12 18:22:24.098 25364-25364/photo.video.maker W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2018-06-12 18:22:24.098 25364-25364/photo.video.maker W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
2018-06-12 18:22:24.098 25364-25364/photo.video.maker W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

0 个答案:

没有答案