[FFmpeg-user] Problem with vf pad ... help please

PyProg PyProg pyprog05 at gmail.com
Sun Sep 16 19:14:40 CEST 2012


2012/9/16 Mark Himsley <mark at mdsh.com>:

Hello !,

> Your English is probably better than mine.

Humhum, I'm not sure !

> Not according to ffmpeg:
>
> Input #0, avi, from '/home/toto/blender/dronez.avi':
>   Duration: 00:03:11.24, start: 0.000000, bitrate: 1536 kb/s
>     Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 720x576
>
> Your original video is a 4:3 standard definition 720x576 file. You might
> have a video player (QuickTime, for instance) that lies slightly and tells
> you the file is 768x576 because it knows that standard definition pixels are
> not square (although Apple should scale up to 788x576, but that's another
> argument).

> I'm sure I will get flack for this - but this is the way I would scale that
> video (keeping your pink border):
>
> -vf scale=984:720:interl=1,pad=1280:720:148:0:0xd28080
>
> Those numbers might be unfamiliar to many, but retains the video's display
> aspect ratio to within 0.07%.

My calculations of the moment are:

For a final 16:9 disposition with a 4/3 original video ... calculate:

* Calculation of the width (after scale): height x (4.0 / 3.0) ->
here: 720.0 * (4.0 / 3.0) ==> 960.0
* Calculating the size (width) of each band for example the left band):
(1280.0 - 960.0) / 2.0 ==> 160.0
--> band_width = (final_width - intermediate_width) / 2.0

Here in FFmpeg:

toto at toto-kubuntu:~$
/home/toto/ekd_toto/linux_dependances_portables/ffmpeg/ffmpeg  -i
"/home/toto/blender/big_buck_bunny_4_3.avi" -vf
"scale=960:720:interl=1,pad=1280:720:160:0:0xa05f41,setdar=16:9"
-sameq -y "/home/toto/a/nouv_EKD/video/version_3/filtres_vidéo/15_09_12_bd_ext_1280x720_16_9.avi"
ffmpeg version N-44443-g570931d Copyright (c) 2000-2012 the FFmpeg developers
  built on Sep 14 2012 05:11:00 with gcc 4.6 (Debian 4.6.3-1)
  configuration: --prefix=/root/ffmpeg-static/32bit --arch=x86_32
--extra-cflags='-m32 -I/root/ffmpeg-static/32bit/include -static'
--extra-ldflags='-m32 -L/root/ffmpeg-static/32bit/lib -static'
--extra-libs='-lxml2 -lexpat -lfreetype' --enable-static
--disable-shared --disable-ffserver --disable-doc --enable-bzlib
--enable-zlib --enable-postproc --enable-runtime-cpudetect
--enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis
--enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype
--enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc
--enable-libvo-amrwbenc --enable-version3 --enable-libvpx
  libavutil      51. 73.100 / 51. 73.100
  libavcodec     54. 55.100 / 54. 55.100
  libavformat    54. 27.100 / 54. 27.100
  libavdevice    54.  2.100 / 54.  2.100
  libavfilter     3. 16.103 /  3. 16.103
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[avi @ 0xa4517a0] non-interleaved AVI
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, avi, from '/home/toto/blender/big_buck_bunny_4_3.avi':
  Metadata:
    encoder         : MEncoder svn r34540 (Ubuntu), built with gcc-4.6
  Duration: 00:09:56.45, start: 0.000000, bitrate: 9750 kb/s
    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuv420p, 768x576,
24 tbr, 24 tbn, 24 tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz,
stereo, s16, 1536 kb/s
Output #0, avi, to
'/home/toto/a/nouv_EKD/video/version_3/filtres_vidéo/15_09_12_bd_ext_1280x720_16_9.avi':
  Metadata:
    ISFT            : Lavf54.27.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1280x720
[SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 24 tbn, 24 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg -> mpeg4)
  Stream #0:1 -> #0:1 (pcm_s16le -> libmp3lame)
Press [q] to stop, [?] for help
frame=14315 fps= 56 q=5.0 Lsize=  195250kB time=00:09:56.47
bitrate=2681.6kbits/s
video:175731kB audio:18584kB subtitle:0 global headers:0kB muxing
overhead 0.481061%

The result is very good !

> Then you must learn how to write a script that probes your source file first
> and calculates the scale and pad arguments for you.

In fact it's for my software: EnKoDeur-Mixeur (EKD). I'm the creator
and devlopper (with two other people). I've implemented this
fonctionnality for a moment but I put it up with the old syntax of
FFmpeg (padleft ... padright ...). If you're interested with the
software, you can see the links in my signature.

Check out this video (it's a teachware for this fonctionnality in EKD):

http://www.youtube.com/watch?v=2qN97JFuO7c

The youtube channel for EnKoDeur-Mixeur:

http://www.youtube.com/user/EnKoDeurMixeur

a+

-- 
http://ekd.tuxfamily.org
http://ekdm.wordpress.com
http://glouk.legtux.org/guiescputil
http://lcs.dunois.clg14.ac-caen.fr/~alama/blog
http://lprod.org/wiki/doku.php/video:encodage:avchd_converter


More information about the ffmpeg-user mailing list