我正在使用PHP运行ffmpeg(4.0.2)渲染出MP4文件。 MP4文件可以在所有iOS设备和大多数笔记本电脑上播放,但不能在android设备上播放。
这是我用来渲染视频的ffmpeg代码
/usr/local/bin/ffmpeg -filter_complex "[0]reverse[r];[0][r]concat, loop=1:65, setpts=N/15/TB" -r 15 -f image2 -i /Source/0001_CAM%02d.jpg -c:v libx264 -preset fast -crf 19 -profile:v baseline -movflags +faststart -pix_fmt yuv420p /Result/output.mp4
这是日志
[0] => ffmpeg version N-91590-geb1860e017-tessus Copyright (c) 2000-2018 the FFmpeg developers
[1] => built with Apple LLVM version 9.1.0 (clang-902.0.39.2)
[2] => configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
[3] => libavutil 56. 18.102 / 56. 18.102
[4] => libavcodec 58. 22.101 / 58. 22.101
[5] => libavformat 58. 17.101 / 58. 17.101
[6] => libavdevice 58. 4.101 / 58. 4.101
[7] => libavfilter 7. 26.100 / 7. 26.100
[8] => libswscale 5. 2.100 / 5. 2.100
[9] => libswresample 3. 2.100 / 3. 2.100
[10] => libpostproc 55. 2.100 / 55. 2.100
[11] => Input #0, image2, from '/Source/0001_CAM%02d.jpg':
[12] => Duration: 00:00:00.33, start: 0.000000, bitrate: N/A
[13] => Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 3456x2304, 15 tbr, 15 tbn, 15 tbc
[14] => Stream mapping:
[15] => Stream #0:0 (mjpeg) -> reverse
[16] => Stream #0:0 (mjpeg) -> concat:in0:v0
[17] => setpts -> Stream #0:0 (libx264)
[18] => Press [q] to stop, [?] for help
[19] => [swscaler @ 0x1077f9000] deprecated pixel format used, make sure you did set range correctly
[20] => [libx264 @ 0x7fd583800600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[21] => [libx264 @ 0x7fd583800600] profile Constrained Baseline, level 5.1, 4:2:0, 8-bit
[22] => [libx264 @ 0x7fd583800600] 264 - core 157 r2932 303c484 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=2 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=15 scenecut=40 intra_refresh=0 rc_lookahead=30 rc=crf mbtree=1 crf=19.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[23] => Output #0, mp4, to '/Result/output.mp4':
[24] => Metadata:
[25] => encoder : Lavf58.17.101
[26] => Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 3456x2304, q=-1--1, 15 fps, 15360 tbn, 15 tbc (default)
[27] => Metadata:
[28] => encoder : Lavc58.22.101 libx264
[29] => Side data:
[30] => cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
[31] => frame= 8 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x
[mp4 @ 0x7fd583804a00] Starting second pass: moving the moov atom to the beginning of the file
[32] => frame= 20 fps=5.1 q=-1.0 Lsize= 10642kB time=00:00:01.26 bitrate=68823.6kbits/s speed=0.322x
[33] => video:10641kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.009452%
[34] => [libx264 @ 0x7fd583800600] frame I:4 Avg QP:17.92 size:895006
[35] => [libx264 @ 0x7fd583800600] frame P:16 Avg QP:19.96 size:457246
[36] => [libx264 @ 0x7fd583800600] mb I I16..4: 11.5% 0.0% 88.5%
[37] => [libx264 @ 0x7fd583800600] mb P I16..4: 4.1% 0.0% 25.0% P16..4: 27.7% 19.0% 6.8% 0.0% 0.0% skip:17.3%
[38] => [libx264 @ 0x7fd583800600] coded y,uvDC,uvAC intra: 92.9% 89.0% 56.0% inter: 51.3% 65.2% 3.9%
[39] => [libx264 @ 0x7fd583800600] i16 v,h,dc,p: 28% 5% 14% 52%
[40] => [libx264 @ 0x7fd583800600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 12% 15% 8% 9% 10% 7% 8% 6%
[41] => [libx264 @ 0x7fd583800600] i8c dc,h,v,p: 47% 16% 29% 8%
[42] => [libx264 @ 0x7fd583800600] ref P L0: 81.6% 18.4%
[43] => [libx264 @ 0x7fd583800600] kb/s:65375.79