3
1
I have a set of images from a timelapse shot (172 JPG files) that I want to convert into a movie. I tried several parameters with FFmpeg, but all I get is a video with black frames (though it has the expected length).
ffmpeg -f image2 -vcodec mjpeg -y -i img_%03d.jpg timelapse2.mpg
The command above creates this video: http://sdm-net.org/data/timelapse2.mpg
What I'm expecting is something like this (created with Time Lapse Assembler.app): https://vimeo.com/39038362 - This is my fallback option, but I'd really like to create timelapse movies from a script.
I'm on OSX Lion (10.7.3) with FFmpeg version (0.10) installed via Homebrew.
I also tried to find a proper version of mencoder for OSX, but this doesn't seem to be an easy task. Also, ImageMagick's convert doesn't seem to work nicely, it creates really bad output and it seems there's not much I can do about it...
Edit:
With libx264 and an mp4 container:
ffmpeg -f image2 -y -i img_%03d.jpg -vcodec libx264 timelapse4.mp4
Output:
ffmpeg version 0.10 Copyright (c) 2000-2012 the FFmpeg developers
built on Mar 26 2012 13:47:02 with clang 3.0 (tags/Apple/clang-211.12)
configuration: --prefix=/usr/local/Cellar/ffmpeg/0.10 --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-libfreetype --cc=/usr/bin/clang --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --disable-ffplay
libavutil 51. 34.101 / 51. 34.101
libavcodec 53. 60.100 / 53. 60.100
libavformat 53. 31.100 / 53. 31.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 60.100 / 2. 60.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 6.100 / 0. 6.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, image2, from 'img_%03d.jpg':
Duration: 00:00:06.88, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj420p, 3888x2592 [SAR 72:72 DAR 3:2], 25 fps, 25 tbr, 25 tbn, 25 tbc
[buffer @ 0x7f8ec9415f20] w:3888 h:2592 pixfmt:yuvj420p tb:1/1000000 sar:72/72 sws_param:
[libx264 @ 0x7f8ec981d800] using SAR=1/1
[libx264 @ 0x7f8ec981d800] frame MB size (243x162) > level limit (36864)
[libx264 @ 0x7f8ec981d800] MB rate (984150) > level limit (983040)
[libx264 @ 0x7f8ec981d800] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX
[libx264 @ 0x7f8ec981d800] profile High, level 5.1
[libx264 @ 0x7f8ec981d800] 264 - core 120 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - 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=12 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
Output #0, mp4, to 'timelapse4.mp4':
Metadata:
encoder : Lavf53.31.100
Stream #0:0: Video: h264 (![0][0][0] / 0x0021), yuvj420p, 3888x2592 [SAR 72:72 DAR 3:2], q=-1--1, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg -> libx264)
Press [q] to stop, [?] for help
frame= 172 fps= 18 q=-1.0 Lsize= 259kB time=00:00:06.80 bitrate= 312.3kbits/s
video:256kB audio:0kB global headers:0kB muxing overhead 1.089647%
[libx264 @ 0x7f8ec981d800] frame I:1 Avg QP: 9.60 size:212820
[libx264 @ 0x7f8ec981d800] frame P:43 Avg QP:30.50 size: 291
[libx264 @ 0x7f8ec981d800] frame B:128 Avg QP:31.00 size: 285
[libx264 @ 0x7f8ec981d800] consecutive B-frames: 0.6% 0.0% 1.7% 97.7%
[libx264 @ 0x7f8ec981d800] mb I I16..4: 22.5% 77.2% 0.3%
[libx264 @ 0x7f8ec981d800] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.0% 0.0% 0.0% 0.0% 0.0% skip:100.0%
[libx264 @ 0x7f8ec981d800] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.0% 0.0% 0.0% direct: 0.0% skip:100.0% L0: 1.2% L1:98.8% BI: 0.0%
[libx264 @ 0x7f8ec981d800] 8x8 transform intra:77.2% inter:100.0%
[libx264 @ 0x7f8ec981d800] coded y,uvDC,uvAC intra: 41.2% 23.4% 0.6% inter: 0.0% 0.0% 0.0%
[libx264 @ 0x7f8ec981d800] i16 v,h,dc,p: 40% 25% 35% 1%
[libx264 @ 0x7f8ec981d800] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 32% 30% 1% 0% 0% 0% 0% 0%
[libx264 @ 0x7f8ec981d800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 51% 40% 6% 1% 1% 0% 1% 0% 1%
[libx264 @ 0x7f8ec981d800] i8c dc,h,v,p: 60% 21% 19% 0%
[libx264 @ 0x7f8ec981d800] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7f8ec981d800] ref P L0: 92.3% 0.0% 0.0% 7.7%
[libx264 @ 0x7f8ec981d800] ref B L0: 50.0% 0.0% 50.0%
[libx264 @ 0x7f8ec981d800] ref B L1: 99.4% 0.6%
[libx264 @ 0x7f8ec981d800] kb/s:304.49
Output timelapse4.mp4: http://sdm-net.org/data/timelapse4.mp4
You need to place the codec option after the input option. Try that! – slhck – 2012-03-27T08:54:52.137
@slhck: I tried "ffmpeg -f image2 -y -i img_%03d.jpg -vcodec mjpeg timelapse3.mpg", which created this video: http://sdm-net.org/data/timelapse3.mpg (doesn't even play on my VLC...)
– resamsel – 2012-03-27T09:47:18.560Hmm. Why use the MJPEG option? Try another codec like libx264 with an MP4 container, and please post the full uncut output! – slhck – 2012-03-27T10:12:12.420
I edited the post with libx264 and an mp4 container, hope this helps! – resamsel – 2012-03-27T10:32:07.880