2
1
I am trying to create an animation of a few images ("f_01.png", "f_02.png", ..., "f_08.png") that are each a different solid colour, but it always outputs a video entirely made up of black frames.
What, exactly, do I need to enter to get this to work? (again: images "f_01.png", "f_02.png", ..., "f_08.png")
More background:
I have read some questions on SuperUser about creating videos from images (and am trying to follow this: https://superuser.com/a/318412/219755 ...and this: https://superuser.com/a/53778/219755 ...and another answer I cannot track down again), I have read the FFMPEG help section on creating videos from image files (here: http://ffmpeg.org/faq.html#How-do-I-encode-single-pictures-into-movies_003f), and I have tried various sample command line strings from around the internet, but I cannot get FFMPEG to output anything but an all-black video.
In case it matters, I am playing the videos back with VLC.
The videos are the right length, at least most of the time (I am choosing 1 FPS and most videos output are the correct 8 seconds in length), but I don't see any of what I should be seeing.
Originally the first frame was black, and I thought FFMPEG ignoring other images might be the problem, but I have tried forcing all frames to be keyframes (with -g 1
, with -keyint_min 1
, and with both), and I have tried making a white image the first frame, but I still got black output videos.
Here are some strings I have tried entering:
ffmpeg -r 1 -i f_%02d.png output.mp4
ffmpeg -r 1 -f image2 -i f_%02d.png output.mp4
ffmpeg -r 1 -f image2 -i f_%02d.png -g 1 -keyint_min 1 output.mp4
In case it matters, the first two commands give me a video where playback time is only 6 seconds, but the third gives me an 8-second video.
As requested, the output from the 1st command is:
G:\FFMPEG>ffmpeg -r 1 -i f_%02d.png output.mp4
ffmpeg version N-55515-gbbbd959 Copyright (c) 2000-2013 the FFmpeg developers
built on Aug 13 2013 18:01:31 with gcc 4.7.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-
amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --
enable-libxvid --enable-zlib
libavutil 52. 42.100 / 52. 42.100
libavcodec 55. 27.100 / 55. 27.100
libavformat 55. 13.102 / 55. 13.102
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 82.100 / 3. 82.100
libswscale 2. 4.100 / 2. 4.100
libswresample 0. 17.103 / 0. 17.103
libpostproc 52. 3.100 / 52. 3.100
Input #0, image2, from 'f_%02d.png':
Duration: 00:00:00.36, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgb24, 320x240 [SAR 3779:3779 DAR 4:3], 25 fps, 25
tbr, 25 tbn, 25 tbc
File 'output.mp4' already exists. Overwrite ? [y/N] y
No pixel format specified, yuv444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 003ff8e0] using SAR=1/1
[libx264 @ 003ff8e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 003ff8e0] profile High 4:4:4 Predictive, level 1.2, 4:4:4 8-bit
[libx264 @ 003ff8e0] 264 - core 135 r2345 f0c1c53 - H.264/MPEG-4 AVC codec - Cop
yleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro
ma_qp_offset=4 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 in
terlaced=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 : Lavf55.13.102
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv444p, 320x24
0 [SAR 1:1 DAR 4:3], q=-1--1, 16384 tbn, 1 tbc
Stream mapping:
Stream #0:0 -> #0:0 (png -> libx264)
Press [q] to stop, [?] for help
frame= 9 fps=0.0 q=-1.0 Lsize= 2kB time=00:00:07.00 bitrate= 2.3kbits
/s
video:1kB audio:0kB subtitle:0 global headers:0kB muxing overhead 82.314815%
[libx264 @ 003ff8e0] frame I:1 Avg QP: 2.00 size: 91
[libx264 @ 003ff8e0] frame P:5 Avg QP: 1.00 size: 42
[libx264 @ 003ff8e0] frame B:3 Avg QP: 2.00 size: 18
[libx264 @ 003ff8e0] consecutive B-frames: 33.3% 66.7% 0.0% 0.0%
[libx264 @ 003ff8e0] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 003ff8e0] mb P I16..4: 19.9% 0.1% 0.0% P16..4: 0.0% 0.0% 0.0%
0.0% 0.0% skip:80.0%
[libx264 @ 003ff8e0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.3% 0.0% 0.0%
direct: 0.0% skip:99.7% L0: 0.0% L1:100.0% BI: 0.0%
[libx264 @ 003ff8e0] 8x8 transform intra:0.2%
[libx264 @ 003ff8e0] coded y,u,v intra: 0.0% 0.0% 0.0% inter: 0.0% 0.0% 0.0%
[libx264 @ 003ff8e0] i16 v,h,dc,p: 93% 0% 7% 0%
[libx264 @ 003ff8e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 0% 0% 100% 0% 0% 0% 0%
0% 0%
[libx264 @ 003ff8e0] Weighted P-Frames: Y:80.0% UV:0.0%
[libx264 @ 003ff8e0] kb/s:0.31
G:\FFMPEG>
As requested, the original image files:
f_01.png and f_02.png (same image twice)
f_03.png and f_04.png (same image twice)
f_05.png and f_06.png (same image twice)
f_07.png and f_08.png (same image twice)
Your full, uncut ffmpeg command line output is missing. (The one from the first command you tried should suffice.) Does it work if you add
-pix_fmt yuv420p
before the output file name? – slhck – 2013-08-15T20:32:46.240I have added the output. Thanks for the command tip, but it still produces an all-black video (6 seconds in length). – A.M. – 2013-08-15T20:44:18.553
Weird. That should usually fix it. Can you supply those images as a sample for us to test? (By the way, I'm curious – did you notice the message "Use -pix_fmt yuv420p for compatibility with outdated media players." when you ran your previous tests? Or was it not obvious to you what it meant?) – slhck – 2013-08-15T20:51:30.487
I originally just used a solid black image and a solid white image (both 320 x 240 px, created in MS Paint and saved .png files from MS Paint) and just wanted to see a video where the black turned white...but could never get it to happen. I then tried 2 frames of solid black, 2 dark grey, 2 light grey, and 2 white, in case the last frame was getting cut off or something. ...nothing special, just extremely simple images. – A.M. – 2013-08-15T20:59:19.130
I had not noticed that output message ("Use -pix_fmt yuv420p[...]"), but I am running the second-latest version of VLC. – A.M. – 2013-08-15T21:00:20.710