2016-05-17 86 views
0

我从ffmpeg导出的视频不会播放任何内容。我正尝试从图像创建一个简单的幻灯片类型的视频。它会创建视频,视频将为我添加的每个图像添加5秒的持续时间,但它不会播放任何内容。这让我疯狂。ffmpeg视频不会播放Centos

/usr/local/bin/ffmpeg -y -f image2 -r 1/5 -i uploads/img%03d.jpg vid/video.mp4 

这里是输出:

Array ([0] => ffmpeg version n2.8.7 Copyright (c) 2000-2016 the FFmpeg developers [1] => built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16) [2] => configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-x11grab --enable-libvpx --enable-libmp3lame [3] => libavutil 54. 31.100/54. 31.100 [4] => libavcodec 56. 60.100/56. 60.100 [5] => libavformat 56. 40.101/56. 40.101 [6] => libavdevice 56. 4.100/56. 4.100 [7] => libavfilter 5. 40.101/5. 40.101 [8] => libswscale 3. 1.101/3. 1.101 [9] => libswresample 1. 2.101/1. 2.101 [10] => libpostproc 53. 3.100/53. 3.100 [11] => [mjpeg @ 0x4213ac0] Changeing bps to 8 [12] => Input #0, image2, from 'uploads/img%03d.jpg': [13] => Duration: 00:00:05.00, start: 0.000000, bitrate: N/A [14] => Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 2021x1117 [SAR 100:100 DAR 2021:1117], 0.20 tbr, 0.20 tbn, 0.20 tbc [15] => No pixel format specified, yuvj444p for H.264 encoding chosen. [16] => Use -pix_fmt yuv420p for compatibility with outdated media players. [17] => [libx264 @ 0x4214040] using SAR=1/1 [18] => [libx264 @ 0x4214040] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX [19] => [libx264 @ 0x4214040] profile High 4:4:4 Predictive, level 5.0, 4:4:4 8-bit [20] => [libx264 @ 0x4214040] 264 - core 148 r2694 3b70645 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 [21] => Output #0, mp4, to 'vid/video.mp4': [22] => Metadata: [23] => encoder : Lavf56.40.101 [24] => Stream #0:0: Video: h264 (libx264) ([33][0][0][0]/0x0021), yuvj444p(pc), 2021x1117 [SAR 100:100 DAR 2021:1117], q=-1--1, 0.20 fps, 16384 tbn, 0.20 tbc [25] => Metadata: [26] => encoder : Lavc56.60.100 libx264 [27] => Stream mapping: [28] => Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264)) [29] => Press [q] to stop, [?] for help [30] => frame= 1 fps=0.0 q=17.0 Lsize= 85kB time=00:00:05.00 bitrate= 139.4kbits/s [31] => video:84kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.931709% [32] => [libx264 @ 0x4214040] frame I:1 Avg QP:10.98 size: 85605 [33] => [libx264 @ 0x4214040] mb I I16..4: 25.7% 55.1% 19.2% [34] => [libx264 @ 0x4214040] 8x8 transform intra:55.1% [35] => [libx264 @ 0x4214040] coded y,u,v intra: 28.2% 25.3% 21.6% [36] => [libx264 @ 0x4214040] i16 v,h,dc,p: 20% 54% 11% 15% [37] => [libx264 @ 0x4214040] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 27% 24% 3% 4% 1% 3% 1% 2% [38] => [libx264 @ 0x4214040] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 40% 31% 12% 3% 4% 2% 3% 2% 3% [39] => [libx264 @ 0x4214040] kb/s:136.97) 

我读过,加入-pix_fmt YUV420P可能有帮助,但是当我这样做,我得到的错误。

Array ([0] => ffmpeg version n2.8.7 Copyright (c) 2000-2016 the FFmpeg developers [1] => built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16) [2] => configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-x11grab --enable-libvpx --enable-libmp3lame [3] => libavutil 54. 31.100/54. 31.100 [4] => libavcodec 56. 60.100/56. 60.100 [5] => libavformat 56. 40.101/56. 40.101 [6] => libavdevice 56. 4.100/56. 4.100 [7] => libavfilter 5. 40.101/5. 40.101 [8] => libswscale 3. 1.101/3. 1.101 [9] => libswresample 1. 2.101/1. 2.101 [10] => libpostproc 53. 3.100/53. 3.100 [11] => [mjpeg @ 0x27f9ae0] Changeing bps to 8 [12] => Input #0, image2, from 'uploads/img%03d.jpg': [13] => Duration: 00:00:05.00, start: 0.000000, bitrate: N/A [14] => Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 2021x1117 [SAR 100:100 DAR 2021:1117], 0.20 tbr, 0.20 tbn, 0.20 tbc [15] => [swscaler @ 0x28097c0] deprecated pixel format used, make sure you did set range correctly [16] => [libx264 @ 0x27fa060] width not divisible by 2 (2021x1117) [17] => Output #0, mp4, to 'vid/video.mp4': [18] => Stream #0:0: Video: h264, none, q=2-31, 128 kb/s, SAR 1:1 DAR 0:0, 0.20 fps [19] => Metadata: [20] => encoder : Lavc56.60.100 libx264 [21] => Stream mapping: [22] => Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264)) [23] => Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height) 

块引用

任何帮助深表感谢。

回答

1

您的图像是2021x1117,而对于YUV420P,尺寸需要均匀。

使用

ffmpeg -y -framerate 1/5 -i img%03d.jpg -vf "scale=2*trunc(iw/2):-2,format=yuv420p,setsar=1" video.mp4 
+0

非常完美的感谢! – Dan