我尝试使用ffmpeg
从一组.mp4
文件中创建.JPG
。这是我使用的ffmpeg
行:
ffmpeg -framerate 1/5 -i image-%03d.JPG output.mp4
返回:
ffmpeg version 2.8.4 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.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-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[mjpeg @ 04ee8ca0] Changeing bps to 8
Input #0, image2, from 'image-%03d.JPG':
Duration: 00:01:05.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 4608x3072, 0.20 tbr, 0.20 tbn, 0.20 tbc
File 'output.mp4' already exists. Overwrite ? [y/N] y
No pixel format specified, yuvj422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 04ef4a40] frame MB size (288x192) > level limit (36864)
[libx264 @ 04ef4a40] DPB size (4 frames, 221184 mbs) > level limit (3 frames, 184320 mbs)
[libx264 @ 04ef4a40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 04ef4a40] profile High 4:2:2, level 5.2, 4:2:2 8-bit
[libx264 @ 04ef4a40] 264 - core 148 r2638 7599210 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=6 lookahead_threads=1 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
Output #0, mp4, to 'output.mp4':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj422p(pc), 4608x3072, q=-1--1, 0.20 fps, 16384 tbn, 0.20 tbc
Metadata:
encoder : Lavc56.60.100 libx264
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 13 fps=0.9 q=-1.0 Lsize= 18249kB time=00:00:55.00 bitrate=2718.2kbits/s
video:18249kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.005057%
[libx264 @ 04ef4a40] frame I:1 Avg QP:13.94 size:1564617
[libx264 @ 04ef4a40] frame P:12 Avg QP:13.68 size:1426766
[libx264 @ 04ef4a40] mb I I16..4: 2.6% 79.2% 18.2%
[libx264 @ 04ef4a40] mb P I16..4: 2.2% 82.9% 14.6% P16..4: 0.1% 0.0% 0.0% 0.0% 0.0% skip: 0.2%
[libx264 @ 04ef4a40] 8x8 transform intra:82.9% inter:79.9%
[libx264 @ 04ef4a40] coded y,uvDC,uvAC intra: 95.0% 80.5% 67.2% inter: 33.6% 27.6% 11.4%
[libx264 @ 04ef4a40] i16 v,h,dc,p: 16% 9% 5% 69%
[libx264 @ 04ef4a40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 20% 24% 6% 8% 6% 8% 6% 10%
[libx264 @ 04ef4a40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 22% 10% 8% 11% 8% 11% 6% 9%
[libx264 @ 04ef4a40] i8c dc,h,v,p: 52% 20% 20% 7%
[libx264 @ 04ef4a40] Weighted P-Frames: Y:8.3% UV:8.3%
[libx264 @ 04ef4a40] ref P L0: 64.6% 9.0% 11.8% 5.8% 8.8%
[libx264 @ 04ef4a40] kb/s:2299.79
和output.mp4
。当我运行此文件时,它立即结束而不显示任何图像。我没有在代码中看到任何错误或问题,所以我不确定我做错了什么。我是否需要增加视频帧率或其他内容?
答案 0 :(得分:1)
有些玩家在低帧率时会遇到麻烦。此外,播放器可能不支持像素格式。
使用
ffmpeg -framerate 1/5 -i image-%03d.JPG -r 5 -pix_fmt yuv420p output.mp4