我有一大堆png,我想转换成mp4视频。
我使用以下命令将它们组合在一起:
ffmpeg -i _2016-04-20_14-51-00-500_%06d.png -pix_fmt yuv420p movie.mp4
我收到的文件有一个大小,所以它不是空的。但是当我在VLC或Quicktime中播放它时会显示时间,但它没有视频。知道我做错了什么吗? 我也尝试过:
ffmpeg -framerate 1/5 -i _2016-04-20_14-51-00-500_%06d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4
和
ffmpeg -r 45 -f image2 -s 1920x1080 -i _2016-04-20_14-51-00-500_%06d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p test.mp4
但仍然没有视频。 这是命令行输出:
>ffmpeg -i _2016-04-20_14-51-00-500_%06d.png -pix_fmt yuv420p movie.mp4
ffmpeg version N-79546-g13406b6 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil 55. 22.100 / 55. 22.100
libavcodec 57. 35.100 / 57. 35.100
libavformat 57. 34.102 / 57. 34.102
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 44.100 / 6. 44.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, image2, from '_2016-04-20_14-51-00-500_%06d.png':
Duration: 00:00:02.60, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 8192x4096 [SAR 3779:3779 DAR 2:1], 25 tbr, 25 tbn
[libx264 @ 00000000025851e0] using SAR=1/1
[libx264 @ 00000000025851e0] frame MB size (512x256) > level limit (36864)
[libx264 @ 00000000025851e0] DPB size (4 frames, 524288 mbs) > level limit (1 frames, 184320 mbs)
[libx264 @ 00000000025851e0] MB rate (3276800) > level limit (2073600)
[libx264 @ 00000000025851e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 00000000025851e0] profile High, level 5.2
[libx264 @ 00000000025851e0] 264 - core 148 r2665 a01e339 - 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=-2 threads=18 lookahead_threads=3 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=25 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
[mp4 @ 0000000002583fc0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, mp4, to 'movie.mp4':
Metadata:
encoder : Lavf57.34.102
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 8192x4096 [SAR 1:1 DAR 2:1], q=2-31, 25 fps, 12800 tbn
Metadata:
encoder : Lavc57.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 65 fps=3.2 q=-1.0 Lsize= 13498kB time=00:00:02.48 bitrate=44585.2kbits/s speed=0.123x 6x
video:13497kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.009971%
[libx264 @ 00000000025851e0] frame I:1 Avg QP:16.71 size:1373751
[libx264 @ 00000000025851e0] frame P:52 Avg QP:23.59 size:234822
[libx264 @ 00000000025851e0] frame B:12 Avg QP:21.17 size: 19609
[libx264 @ 00000000025851e0] consecutive B-frames: 73.8% 3.1% 4.6% 18.5%
[libx264 @ 00000000025851e0] mb I I16..4: 14.7% 73.8% 11.5%
[libx264 @ 00000000025851e0] mb P I16..4: 3.1% 5.9% 0.5% P16..4: 23.2% 7.7% 2.0% 0.0% 0.0% skip:57.5%
[libx264 @ 00000000025851e0] mb B I16..4: 0.1% 0.1% 0.0% B16..8: 9.0% 0.2% 0.0% direct: 0.2% skip:90.3% L0:33.0% L1:66.6% BI: 0.4%
[libx264 @ 00000000025851e0] 8x8 transform intra:63.5% inter:78.5%
[libx264 @ 00000000025851e0] coded y,uvDC,uvAC intra: 33.7% 3.1% 1.0% inter: 10.1% 0.4% 0.0%
[libx264 @ 00000000025851e0] i16 v,h,dc,p: 24% 57% 3% 17%
[libx264 @ 00000000025851e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 31% 38% 2% 3% 2% 5% 2% 4%
[libx264 @ 00000000025851e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 63% 10% 2% 2% 1% 5% 1% 4%
[libx264 @ 00000000025851e0] i8c dc,h,v,p: 94% 2% 3% 0%
[libx264 @ 00000000025851e0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 00000000025851e0] ref P L0: 71.6% 13.1% 10.8% 4.4%
[libx264 @ 00000000025851e0] ref B L0: 69.0% 30.6% 0.4%
[libx264 @ 00000000025851e0] ref B L1: 89.7% 10.3%
[libx264 @ 00000000025851e0] kb/s:42522.38
答案 0 :(得分:0)
我尝试使用以下命令并且它可以正常工作。命令是
ffmpeg -framerate 1 -f image2 -i img%06d.png -r 25 -vcodec libx264 -crf 25 -pix_fmt yuv420p output.mp4
-framerate 1:图像在结果视频中有1秒
-r 25:结果视频的帧率
-crf 25:所得视频的质量(如果你希望它变得更好,价值更低 - 但建议不要低于18)
确保您的图像编号良好(img000001.png,... img000009.png,img000010.png - > img%06d.png)