我正在尝试将视频转换为在iOS中的WebView中的标记中播放。我已经尝试了this link的选项,但它似乎仍然无法播放。我找到了成功播放的视频,所以我确信这是可能的,我似乎无法正常工作。这是有效的东西的ffmpeg -i输出。
这是我在维基上尝试的内容:
ffmpeg -i {filename} -acodec aac -ac 2 -strict experimental -ab 160k -vcodec libx264 -preset slow -profile:v baseline -level 30 -maxrate 10000000 -bufsize 10000000 -b 1200k -f mp4 -threads 0 {filename}.ipad.mp4
但该文件无法在WebView中播放。
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.m4v': Metadata: major_brand : M4V minor_version : 1 compatible_brands: M4V M4A mp42isom creation_time : 2005-12-20 20:20:15 Duration: 00:01:25.50, start: 0.000000, bitrate: 209 kb/s Stream #0:0(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 115 kb/s Metadata: creation_time : 2005-12-20 20:20:15 handler_name : Apple Sound Media Handler Stream #0:1(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x240, 90 kb/s, 10 fps, 10 tbr, 1k tbn, 2k tbc Metadata: creation_time : 2005-12-20 20:20:15 handler_name : Apple Video Media Handler
这是输入文件的输出:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'cheerfulness.mov': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt creation_time : 2013-07-31 00:47:22 Duration: 00:00:06.00, start: 0.000000, bitrate: 120849 kb/s Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1200x1920, 120823 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 60k tbc Metadata: creation_time : 2013-07-31 00:48:33 handler_name : Apple Alias Data Handler
编辑:这是命令的完整输出:
wlue:$ ffmpeg -i cheerfulness.mov -acodec aac -ac 2 -strict experimental -ab 160k -vcodec libx264 -preset slow -profile:v baseline -level 30 -maxrate 10000000 -bufsize 10000000 -b 1200k -f mp4 -threads 0 output.ipad.mp4 ffmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers built on Sep 18 2013 18:44:15 with Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn) configuration: --prefix=/usr/local/Cellar/ffmpeg/1.2.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid libavutil 52. 18.100 / 52. 18.100 libavcodec 54. 92.100 / 54. 92.100 libavformat 54. 63.104 / 54. 63.104 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 42.103 / 3. 42.103 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'cheerfulness.mov': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt creation_time : 2013-07-31 00:47:22 Duration: 00:00:06.01, start: 0.000000, bitrate: 120849 kb/s Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1200x1920, 120823 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 60k tbc Metadata: creation_time : 2013-07-31 00:48:33 handler_name : Apple Alias Data Handler Please use -b:a or -b:v, -b is ambiguous [libx264 @ 0x7fa67401fa00] frame MB size (75x120) > level limit (1620) [libx264 @ 0x7fa67401fa00] DPB size (5 frames, 17280000 bytes) > level limit (0 frames, 3110400 bytes) [libx264 @ 0x7fa67401fa00] MB rate (269730) > level limit (40500) [libx264 @ 0x7fa67401fa00] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX [libx264 @ 0x7fa67401fa00] profile Constrained Baseline, level 3.0 [libx264 @ 0x7fa67401fa00] 264 - core 125 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=0 ref=5 deblock=1:0:0 analyse=0x1:0x111 me=umh subme=8 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=25 scenecut=40 intra_refresh=0 rc_lookahead=50 rc=abr mbtree=1 bitrate=1200 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=10000 vbv_bufsize=10000 nal_hrd=none ip_ratio=1.40 aq=1:1.00 Output #0, mp4, to 'output.ipad.mp4': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt encoder : Lavf54.63.104 Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1200x1920, q=-1--1, 1200 kb/s, 30k tbn, 29.97 tbc Metadata: creation_time : 2013-07-31 00:48:33 handler_name : Apple Alias Data Handler Stream mapping: Stream #0:0 -> #0:0 (h264 -> libx264) Press [q] to stop, [?] for help frame= 180 fps= 16 q=-1.0 Lsize= 828kB time=00:00:06.00 bitrate=1129.2kbits/s video:826kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.177851% [libx264 @ 0x7fa67401fa00] frame I:2 Avg QP:32.23 size: 20942 [libx264 @ 0x7fa67401fa00] frame P:178 Avg QP:41.03 size: 4515 [libx264 @ 0x7fa67401fa00] mb I I16..4: 90.1% 0.0% 9.9% [libx264 @ 0x7fa67401fa00] mb P I16..4: 6.8% 0.0% 0.0% P16..4: 16.8% 0.6% 0.2% 0.0% 0.0% skip:75.5% [libx264 @ 0x7fa67401fa00] final ratefactor: 37.56 [libx264 @ 0x7fa67401fa00] coded y,uvDC,uvAC intra: 1.2% 16.4% 2.1% inter: 0.1% 3.4% 0.1% [libx264 @ 0x7fa67401fa00] i16 v,h,dc,p: 49% 23% 4% 24% [libx264 @ 0x7fa67401fa00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 8% 36% 8% 12% 9% 8% 4% 2% [libx264 @ 0x7fa67401fa00] i8c dc,h,v,p: 88% 6% 5% 1% [libx264 @ 0x7fa67401fa00] ref P L0: 47.7% 22.0% 16.7% 5.7% 7.9% [libx264 @ 0x7fa67401fa00] kb/s:1126.21