[FFmpeg-user] Docs, filtering introduction example
Michael Ludwig
milu71 at gmx.de
Thu Apr 4 18:34:44 CEST 2013
http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction
There's an example to show how filters work. The description is: "The
result will be that in output the top half of the video is mirrored onto
the bottom half." The command is:
ffmpeg -i input -vf "[in] split [T1], [T2] overlay=0:H/2 [out]; [T1] crop=iw:ih/2:0:ih/2, vflip [T2]" output
I'm getting an error running that with ffmpeg 1.1.3, verified for three
different input sizes:
320x180:
Overlay area (0,45)<->(320,225) not within the main area (0,0)<->(320,90) or zero-sized
480x270:
Overlay area (0,67)<->(480,337) not within the main area (0,0)<->(480,134) or zero-sized
240x134:
Overlay area (0,33)<->(240,167) not within the main area (0,0)<->(240,66) or zero-sized
See complete output at the end of this mail.
(Okay, no error with N-51511-g599866f from 2013-04-01, but not the
desired result either.)
The following filter works for me and produces a horizontally mirrored
video, which I think is the objective of the example:
-vf "[in] split [T1], crop=iw:ih/2:0:0, [T2] overlay [out]; [T1] vflip [T2]"
This puts the vflipped video as the background and overlays the cropped
top part of the video so it is visible twice, cropped in the top half,
and vflipped in the bottom half.
Hope I didn't misunderstand completely … but here's my two cents:
Two things made the original example a bit hard to understand for me:
(1) One of the two outputs of the split filter is named, but the other
one is not.
(2) One of the inputs of the overlay filter is unnamed, and it's not
clear whether that input comes first or second.
Maybe this could be pointed out, given that it's the introduction, to
make it a bit easier for newbies …
Okay, I just tested with a newer version N-51511-g599866f …
http://ffmpeg.zeranoe.com/builds/win64/shared/ffmpeg-20130401-git-599866f-win64-shared.7z
… which does not error out, but does not produce the mirrored video
either:
[Parsed_overlay_1 @ 0000000000313660] Overlay area with coordinates x1:0 y1:33 x2:240 y2:167 is not completely contained within the output with size 240x66
My modified example works correctly with both versions, by the way, so
if you think it's correct and illustrative enough maybe substitute it
to the original example.
Sorry for this long post.
Michael
PS: Here's the complete uncut console output of running the command
from the doc page:
:: ffmpeg -i m2.mp4 -vf "[in] split [T1], [T2] overlay=0:H/2 [out]; [T1] crop=iw:ih/2:0:ih/2, vflip [T2]" out.mp4 -y > e.txt 2>&1
==== For the older version:
ffmpeg version 1.1.3 Copyright (c) 2000-2013 the FFmpeg developers
built on Mar 3 2013 02:04:56 with gcc 4.7.2 (GCC)
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 13.100 / 52. 13.100
libavcodec 54. 86.100 / 54. 86.100
libavformat 54. 59.106 / 54. 59.106
libavdevice 54. 3.102 / 54. 3.102
libavfilter 3. 32.100 / 3. 32.100
libswscale 2. 1.103 / 2. 1.103
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'm2.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf54.59.106
Duration: 00:00:49.13, start: 0.000000, bitrate: 125 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x180 [SAR 1:1 DAR 16:9], 122 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc
Metadata:
handler_name : VideoHandler
[Parsed_overlay_1 @ 00000000005637c0] Overlay area (0,45)<->(320,225) not within the main area (0,0)<->(320,90) or zero-sized
[auto-inserted scaler 0 @ 0000000000563460] Failed to configure input pad on Parsed_overlay_1
Error opening filters!
==== For the newer version:
ffmpeg version N-51511-g599866f Copyright (c) 2000-2013 the FFmpeg developers
built on Apr 1 2013 12:52:07 with gcc 4.8.0 (GCC)
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --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-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 24.100 / 52. 24.100
libavcodec 55. 2.100 / 55. 2.100
libavformat 55. 1.100 / 55. 1.100
libavdevice 55. 0.100 / 55. 0.100
libavfilter 3. 48.105 / 3. 48.105
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'm2.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf54.59.106
Duration: 00:00:49.13, start: 0.000000, bitrate: 125 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x180 [SAR 1:1 DAR 16:9], 122 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc
Metadata:
handler_name : VideoHandler
[Parsed_overlay_1 @ 00000000003136c0] Overlay area with coordinates x1:0 y1:45 x2:320 y2:225 is not completely contained within the output with size 320x90
[libx264 @ 00000000003dfb20] using SAR=1/1
[libx264 @ 00000000003dfb20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 00000000003dfb20] profile High, level 1.2
[libx264 @ 00000000003dfb20] 264 - core 130 r2274 c832fe9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - 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=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 'out.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.1.100
Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 320x90 [SAR 1:1 DAR 32:9], q=-1--1, 15360 tbn, 30 tbc
Metadata:
handler_name : VideoHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> libx264)
Press [q] to stop, [?] for help
frame= 340 fps=0.0 q=29.0 size= 46kB time=00:00:09.60 bitrate= 38.9kbits/s
frame= 568 fps=552 q=29.0 size= 124kB time=00:00:17.20 bitrate= 58.9kbits/s
frame= 845 fps=547 q=29.0 size= 179kB time=00:00:26.43 bitrate= 55.6kbits/s
frame= 1072 fps=521 q=29.0 size= 258kB time=00:00:34.00 bitrate= 62.3kbits/s
frame= 1335 fps=519 q=29.0 size= 324kB time=00:00:42.76 bitrate= 62.1kbits/s
frame= 1474 fps=497 q=-1.0 Lsize= 403kB time=00:00:49.06 bitrate= 67.3kbits/s
video:386kB audio:0kB subtitle:0 global headers:0kB muxing overhead 4.606866%
[libx264 @ 00000000003dfb20] frame I:9 Avg QP:19.49 size: 2054
[libx264 @ 00000000003dfb20] frame P:503 Avg QP:22.40 size: 583
[libx264 @ 00000000003dfb20] frame B:962 Avg QP:26.56 size: 86
[libx264 @ 00000000003dfb20] consecutive B-frames: 5.4% 18.5% 12.6% 63.5%
[libx264 @ 00000000003dfb20] mb I I16..4: 20.5% 51.7% 27.9%
[libx264 @ 00000000003dfb20] mb P I16..4: 2.9% 2.1% 0.8% P16..4: 49.1% 16.7% 7.6% 0.0% 0.0% skip:20.8%
[libx264 @ 00000000003dfb20] mb B I16..4: 0.1% 0.0% 0.0% B16..8: 34.6% 2.0% 0.2% direct: 0.8% skip:62.4% L0:41.1% L1:55.0% BI: 3.9%
[libx264 @ 00000000003dfb20] 8x8 transform intra:39.7% inter:69.6%
[libx264 @ 00000000003dfb20] coded y,uvDC,uvAC intra: 33.8% 78.1% 42.1% inter: 7.6% 18.8% 1.9%
[libx264 @ 00000000003dfb20] i16 v,h,dc,p: 38% 43% 12% 7%
[libx264 @ 00000000003dfb20] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 31% 35% 2% 2% 2% 2% 2% 4%
[libx264 @ 00000000003dfb20] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 43% 17% 2% 4% 2% 5% 2% 5%
[libx264 @ 00000000003dfb20] i8c dc,h,v,p: 46% 37% 14% 3%
[libx264 @ 00000000003dfb20] Weighted P-Frames: Y:15.9% UV:10.5%
[libx264 @ 00000000003dfb20] ref P L0: 62.1% 14.1% 16.6% 6.7% 0.5%
[libx264 @ 00000000003dfb20] ref B L0: 86.2% 11.4% 2.5%
[libx264 @ 00000000003dfb20] ref B L1: 92.9% 7.1%
[libx264 @ 00000000003dfb20] kb/s:64.16
More information about the ffmpeg-user
mailing list