2
I'm working in a project where I should generate a video, from an input set of videos or images.
The problem is when I generate the video I must add a zoomin effect to each input element.
I solved the problem with images in this way (I repeat this command for each image):
ffmpeg -loop 1 -i test.jpg -vf "zoompan=z='min(zoom+0.0015,1.5)':d=125" -c:v libx264 -pix_fmt yuvj420p -t 5 -s "796x450" test.mp4
And after I concat the generated videos.
Now, I trying the same solution for videos, but without success. Should I convert before the video in images? Or there's another way?
Thank you!
UPDATE
This is the command I use for videos.
ffmpeg -i small.mp4 -vf "zoompan=z='min(zoom+0.0015,1.5)':d=125:s=640x360" -c:v libx264 -c:a libfdk_aac -y smallzoom.mp4ffmpeg version 2.3.git Copyright (c) 2000-2014 the FFmpeg developers
built on Aug 7 2014 18:14:20 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --prefix=/home/stuzzo/ffmpeg_build --extra-cflags=-I/home/stuzzo/ffmpeg_build/include --extra-ldflags=-L/home/stuzzo/ffmpeg_build/lib --bindir=/home/stuzzo/bin --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-nonfree
libavutil 52. 98.100 / 52. 98.100
libavcodec 55. 72.102 / 55. 72.102
libavformat 55. 51.101 / 55. 51.101
libavdevice 55. 13.102 / 55. 13.102
libavfilter 4. 11.102 / 4. 11.102
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'small.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
creation_time : 2010-03-20 21:29:11
encoder : HandBrake 0.9.4 2009112300
Duration: 00:00:05.57, start: 0.000000, bitrate: 551 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 560x320, 465 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc (default)
Metadata:
creation_time : 2010-03-20 21:29:11
encoder : JVT/AVC Coding
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 83 kb/s (default)
Metadata:
creation_time : 2010-03-20 21:29:11
[libx264 @ 0x3066180] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x3066180] profile High, level 3.0
[libx264 @ 0x3066180] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - 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 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=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 'smallzoom.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isomavc1
encoder : Lavf55.51.101
Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x360, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
creation_time : 2010-03-20 21:29:11
encoder : Lavc55.72.102 libx264
Stream #0:1(eng): Audio: aac (libfdk_aac) ([64][0][0][0] / 0x0040), 48000 Hz, mono, s16, 104 kb/s (default)
Metadata:
creation_time : 2010-03-20 21:29:11
encoder : Lavc55.72.102 libfdk_aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
[output stream 0:0 @ 0x30671a0] 100 buffers queued in output stream 0:0, something may be wrong.
frame= 175 fps= 11 q=-1.0 Lsize= 244kB time=00:00:05.76 bitrate= 346.6kbits/s dup=0 drop=20575
video:165kB audio:71kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.131025%
[libx264 @ 0x3066180] frame I:1 Avg QP:20.98 size: 20122
[libx264 @ 0x3066180] frame P:46 Avg QP:21.52 size: 2151
[libx264 @ 0x3066180] frame B:128 Avg QP:25.80 size: 385
[libx264 @ 0x3066180] consecutive B-frames: 2.3% 0.0% 1.7% 96.0%
[libx264 @ 0x3066180] mb I I16..4: 46.3% 27.6% 26.1%
[libx264 @ 0x3066180] mb P I16..4: 1.8% 0.4% 0.1% P16..4: 37.3% 7.8% 5.7% 0.0% 0.0% skip:46.8%
[libx264 @ 0x3066180] mb B I16..4: 0.0% 0.1% 0.0% B16..8: 22.7% 1.1% 0.2% direct: 0.4% skip:75.5% L0:45.0% L1:52.6% BI: 2.4%
[libx264 @ 0x3066180] 8x8 transform intra:25.2% inter:68.0%
[libx264 @ 0x3066180] coded y,uvDC,uvAC intra: 29.7% 62.3% 31.5% inter: 2.9% 9.0% 1.4%
[libx264 @ 0x3066180] i16 v,h,dc,p: 0% 30% 1% 69%
[libx264 @ 0x3066180] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 30% 17% 4% 6% 4% 13% 4% 9%
[libx264 @ 0x3066180] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 30% 9% 4% 8% 6% 13% 4% 7%
[libx264 @ 0x3066180] i8c dc,h,v,p: 44% 40% 9% 7%
[libx264 @ 0x3066180] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x3066180] ref P L0: 61.2% 5.1% 22.5% 11.1%
[libx264 @ 0x3066180] ref B L0: 82.0% 13.6% 4.4%
[libx264 @ 0x3066180] ref B L1: 94.0% 6.0%
[libx264 @ 0x3066180] kb/s:230.91
Do you absolutely have to do this in terminal? Is installing OpenShot not an option? If I remember correctly, there's an option in OpenShot, an effect which lets you pan and zoom on the video. And you can also composite images into video much more easily... Or are you doing this on Windows? I assumed it wasn't Windows because you're using ffmpeg... – zorvalent – 2015-01-28T11:50:02.713
1What command did you try for videos? What was the console output? – Rajib – 2015-01-28T14:23:31.667
@zorvalent I'm in a web project and I need a command line tool. Thanks anyway. – stuzzo – 2015-01-28T15:13:45.620
@Rajib I edited my answer. ffmpeg generates a new video, but no zoom effect is added. – stuzzo – 2015-01-28T15:18:35.883
Hm.
– slhck – 2015-02-07T08:39:43.777ffplay test.mp4 -vf "scale=640:360, zoompan=z='min(zoom+0.0015,1.5)':d=125"
works for me, while the same usingffmpeg
gives a 1280x720 output. When I use the scale filter like you I get the same buggy behavior. Maybe we should post another bug report. Have to investigate more. Also try asking on https://ffmpeg.org/mailman/listinfo/ffmpeg-user